fixes
This commit is contained in:
33
dist/Export.js
vendored
33
dist/Export.js
vendored
@ -24,6 +24,10 @@ function ContactExport(itemId, label, status) {
|
||||
return { 'homekit': ContactHomekitExport(itemId, label, status), 'openhab': '' };
|
||||
}
|
||||
exports.ContactExport = ContactExport;
|
||||
function HueColorLightExport(itemId, label, stateTopic, stateFeedbackTopic, brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic, saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic) {
|
||||
return { 'homekit': HueColorLightHomekitExport(itemId, label, stateTopic, stateFeedbackTopic, brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic, saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic), 'openhab': '' };
|
||||
}
|
||||
exports.HueColorLightExport = HueColorLightExport;
|
||||
function SwitchHomekitBulbExport(id, label, setOn, statusOn) {
|
||||
let o = {
|
||||
"id": id,
|
||||
@ -93,4 +97,33 @@ function SwitchOpenHABExport(id, label, setOn, statusOn) {
|
||||
// Switch windowLightKitchen {mqtt=">[localbroker:nodered/items/windowLightKitchen:command:*:default]", mqtt="<[localbroker:nodered/items/windowLightKitchen/feedback:state:default]"}
|
||||
return `Switch ${id} {mqtt=">[localbroker:${setOn}:command:*:default],<[localbroker:${statusOn}:state:default]"}`;
|
||||
}
|
||||
function HueColorLightHomekitExport(id, label, stateTopic, stateFeedbackTopic, brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic, saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic) {
|
||||
let o = {
|
||||
"id": id,
|
||||
"name": label,
|
||||
"service": "Lightbulb",
|
||||
"manufacturer": "hue2mqtt - Hue",
|
||||
"model": "color light",
|
||||
"topic": {
|
||||
"setOn": stateTopic,
|
||||
"statusOn": stateFeedbackTopic,
|
||||
"setBrightness": brightnessTopic,
|
||||
"statusBrightness": brightnessFeedbackTopic,
|
||||
"setHue": hueTopic,
|
||||
"statusHue": hueFeedbackTopic,
|
||||
"setSaturation": saturationTopic,
|
||||
"statusSaturation": saturationFeedbackTopic,
|
||||
"setColorTemperature": colorTemperatureTopic,
|
||||
"statusColorTemperature": colorTemperatureFeedbackTopic
|
||||
},
|
||||
"payload": {
|
||||
"onTrue": "ON",
|
||||
"onFalse": "OFF",
|
||||
"brightnessFactor": 1,
|
||||
"hueFactor": 1,
|
||||
"saturationFactor": 1
|
||||
}
|
||||
};
|
||||
return { 'id': id, 'object': o };
|
||||
}
|
||||
//# sourceMappingURL=Export.js.map
|
85
dist/HueColorBulbItem.js
vendored
Normal file
85
dist/HueColorBulbItem.js
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const MqttDispatcher_1 = require("./MqttDispatcher");
|
||||
const AHomegearItem_1 = require("./AHomegearItem");
|
||||
const Export_1 = require("./Export");
|
||||
class HueColorBulbItem extends AHomegearItem_1.AHomegearItem {
|
||||
getStateTopic() {
|
||||
return this.stateTopic;
|
||||
}
|
||||
getInTopic() {
|
||||
return this.stateTopic;
|
||||
}
|
||||
getStateFeedbackTopic() {
|
||||
return this.stateFeedbackTopic;
|
||||
}
|
||||
constructor(floor, room, item, label, hmId) {
|
||||
super(floor, room, item, label, hmId);
|
||||
this.stateTopic = `${this.topicFirstPart}/state`;
|
||||
this.brightTopic = `${this.topicFirstPart}/bright`;
|
||||
this.colorTemperatureTopic = `${this.topicFirstPart}/colorTemperature`;
|
||||
this.hueTopic = `${this.topicFirstPart}/hue`;
|
||||
this.saturationTopic = `${this.topicFirstPart}/saturation`;
|
||||
this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`;
|
||||
this.brightFeedbackTopic = `${this.topicFirstPart}/bright/feedback`;
|
||||
this.hueFeedbackTopic = `${this.topicFirstPart}/bright/hue`;
|
||||
this.saturationFeedbackTopic = `${this.topicFirstPart}/bright/saturation`;
|
||||
this.colorTemperatureFeedbackTopic = `${this.topicFirstPart}/colorTemperature/feedback`;
|
||||
this.stateActionTopic = `${this.actionTopicPre}/1/STATE`;
|
||||
this.brightActionTopic = `${this.actionTopicPre}/1/FAST_BRIGHTNESS`;
|
||||
this.hueActionTopic = `${this.actionTopicPre}/1/HUE`;
|
||||
this.saturationActionTopic = `${this.actionTopicPre}/1/SATURATION`;
|
||||
this.colorTemperatureActionTopic = `${this.actionTopicPre}/1/COLOR_TEMPERATURE`;
|
||||
this.subscribeTopics = [
|
||||
this.stateTopic,
|
||||
this.brightTopic,
|
||||
this.colorTemperatureTopic,
|
||||
this.hueTopic,
|
||||
this.saturationTopic
|
||||
];
|
||||
this.state = 'OFF';
|
||||
this.bright = 0;
|
||||
this.colorTemperature = 0;
|
||||
this.hue = 0;
|
||||
this.saturation = 0;
|
||||
}
|
||||
exportItem() {
|
||||
return Export_1.HueColorLightExport(this.itemId, this.label, this.stateTopic, this.stateFeedbackTopic, this.brightTopic, this.brightFeedbackTopic, this.hueTopic, this.hueFeedbackTopic, this.saturationTopic, this.saturationFeedbackTopic, this.colorTemperatureTopic, this.colorTemperatureFeedbackTopic);
|
||||
}
|
||||
processMessage(topic, payload) {
|
||||
switch (topic) {
|
||||
case this.stateTopic:
|
||||
this.state = payload;
|
||||
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||
if (this.state == "ON") {
|
||||
MqttDispatcher_1.mqttHandler.send(this.stateActionTopic, "true");
|
||||
}
|
||||
else {
|
||||
MqttDispatcher_1.mqttHandler.send(this.stateActionTopic, "false");
|
||||
}
|
||||
break;
|
||||
case this.brightTopic:
|
||||
this.bright = parseFloat(payload);
|
||||
MqttDispatcher_1.mqttHandler.send(this.brightFeedbackTopic, `${this.bright}`);
|
||||
MqttDispatcher_1.mqttHandler.send(this.brightActionTopic, `${this.bright * 2.54}`);
|
||||
break;
|
||||
case this.hueTopic:
|
||||
this.hue = parseFloat(payload);
|
||||
MqttDispatcher_1.mqttHandler.send(this.hueFeedbackTopic, `${this.hue}`);
|
||||
MqttDispatcher_1.mqttHandler.send(this.hueActionTopic, `${this.hue * 65535.0 / 360.0}`);
|
||||
break;
|
||||
case this.saturationTopic:
|
||||
this.saturation = parseFloat(payload);
|
||||
MqttDispatcher_1.mqttHandler.send(this.saturationFeedbackTopic, `${this.saturation}`);
|
||||
MqttDispatcher_1.mqttHandler.send(this.saturationActionTopic, `${this.saturation * 2.54}`);
|
||||
break;
|
||||
case this.colorTemperatureTopic:
|
||||
this.colorTemperature = parseInt(payload);
|
||||
MqttDispatcher_1.mqttHandler.send(this.colorTemperatureFeedbackTopic, `${this.colorTemperature}`);
|
||||
MqttDispatcher_1.mqttHandler.send(this.colorTemperatureActionTopic, `${this.colorTemperature}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.HueColorBulbItem = HueColorBulbItem;
|
||||
//# sourceMappingURL=HueColorBulbItem.js.map
|
14
dist/main.js
vendored
14
dist/main.js
vendored
@ -17,7 +17,7 @@ const MaxThermostat_1 = require("./MaxThermostat");
|
||||
const MaxWindowContact_1 = require("./MaxWindowContact");
|
||||
const UrlSwitchItem_1 = require("./UrlSwitchItem");
|
||||
const Cron_1 = require("./Cron");
|
||||
const HueColorTemperatureBulbItem_1 = require("./HueColorTemperatureBulbItem");
|
||||
const HueColorBulbItem_1 = require("./HueColorBulbItem");
|
||||
logger.info("Dispatcher starting");
|
||||
let allLabeledItems = new Array();
|
||||
// Anna -----------------------------------------------------------------------------------------------------
|
||||
@ -67,8 +67,9 @@ allLabeledItems.push(diningRoomCupboardLight);
|
||||
let diningRoomShelfLight = new UrlSwitchItem_1.UrlSwitchItem('Gnd', 'DiningRoom', 'ShelfLight', 'Regallicht Esszimmer', 'http://regallampe/dv?dv=1023', 'http://regallampe/dv?dv=0');
|
||||
diningRoomShelfLight.start();
|
||||
allLabeledItems.push(diningRoomShelfLight);
|
||||
let diningRoomNaehkaestchenLight = new HueColorTemperatureBulbItem_1.HueColorTemperatureBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15);
|
||||
let diningRoomNaehkaestchenLight = new HueColorBulbItem_1.HueColorBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15);
|
||||
diningRoomNaehkaestchenLight.start();
|
||||
allLabeledItems.push(diningRoomNaehkaestchenLight);
|
||||
// Wohnzimmer -----------------------------------------------------------------------------------------------
|
||||
// Wohnzimmer grosse Lampe 65557 24 1 65556 24 1
|
||||
let livingRoomLargeLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'LivingRoom', 'LargeLight', 'große Lampe Wohnzimmer', '65557 24 1', '65556 24 1');
|
||||
@ -113,6 +114,9 @@ allLabeledItems.push(kitchenCeilingLight);
|
||||
let bedRoomWolfgangsSide = new M433SwitchItem_1.M433SwitchItem('1st', 'BedRoom', 'WolfgangsSide', 'Wolfgangs Seite Schlafzimmer', '13976916 24 1', '13976913 24 1');
|
||||
bedRoomWolfgangsSide.start();
|
||||
allLabeledItems.push(bedRoomWolfgangsSide);
|
||||
let bedRoomWolfgangBedLight = new HueColorBulbItem_1.HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 16);
|
||||
bedRoomWolfgangBedLight.start();
|
||||
allLabeledItems.push(bedRoomWolfgangBedLight);
|
||||
// Schlafzimmer Pattys Seite 13980756 24 1 13980753 24 1
|
||||
let bedRoomPattysSide = new M433SwitchItem_1.M433SwitchItem('1st', 'BedRoom', 'PattysSide', 'Pattys Seite Schlafzimmer', '13980756 24 1', '13980753 24 1');
|
||||
bedRoomPattysSide.start();
|
||||
@ -125,14 +129,14 @@ allLabeledItems.push(bedRoomWindowLight);
|
||||
let dayLightScene = new Scene_1.LightScene('Gnd', 'Hallway', 'DayLight', 'DayLight', [
|
||||
kitchenWindowLight, kitchenCeilingLight, hallwayDeskLight, hallwayStandLight, hallwayWardrobeLight,
|
||||
diningRoomSmallLight, diningRoomStandLight, diningRoomCupboardLight, diningRoomShelfLight,
|
||||
livingRoomLargeLight, livingRoomSmallLight, livingRoomStars, livingRoomStandLight
|
||||
livingRoomLargeLight, livingRoomSmallLight, livingRoomStars, livingRoomStandLight, diningRoomNaehkaestchenLight
|
||||
], []);
|
||||
dayLightScene.start();
|
||||
allLabeledItems.push(dayLightScene);
|
||||
let ecoLightScene = new Scene_1.LightScene('Gnd', 'Hallway', 'EcoLight', 'EcoLight', [
|
||||
kitchenWindowLight, hallwayDeskLight, hallwayWardrobeLight,
|
||||
diningRoomSmallLight, diningRoomStandLight, diningRoomCupboardLight, diningRoomShelfLight,
|
||||
livingRoomStars, livingRoomStandLight
|
||||
livingRoomStars, livingRoomStandLight, diningRoomNaehkaestchenLight
|
||||
], [
|
||||
kitchenCeilingLight, hallwayStandLight,
|
||||
livingRoomLargeLight, livingRoomSmallLight
|
||||
@ -146,7 +150,7 @@ let morningLightScene = new Scene_1.LightScene('Gnd', 'Hallway', 'MorningLight',
|
||||
hallwayStandLight
|
||||
], [
|
||||
diningRoomSmallLight, diningRoomStandLight, diningRoomCupboardLight, diningRoomShelfLight,
|
||||
livingRoomStars, livingRoomStandLight, livingRoomLargeLight, livingRoomSmallLight
|
||||
livingRoomStars, livingRoomStandLight, livingRoomLargeLight, livingRoomSmallLight, diningRoomNaehkaestchenLight
|
||||
]);
|
||||
morningLightScene.start();
|
||||
allLabeledItems.push(morningLightScene);
|
||||
|
Reference in New Issue
Block a user