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);
|
||||
|
52
homekit.json
52
homekit.json
@ -149,6 +149,32 @@
|
||||
},
|
||||
"config": {}
|
||||
},
|
||||
"Gnd_DiningRoom_NaehkaestchenLight": {
|
||||
"id": "Gnd_DiningRoom_NaehkaestchenLight",
|
||||
"name": "Lampe Naehkaestchen",
|
||||
"service": "Lightbulb",
|
||||
"manufacturer": "hue2mqtt - Hue",
|
||||
"model": "color light",
|
||||
"topic": {
|
||||
"setOn": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/state",
|
||||
"statusOn": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/state/feedback",
|
||||
"setBrightness": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/bright",
|
||||
"statusBrightness": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/bright/feedback",
|
||||
"setHue": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/hue",
|
||||
"statusHue": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/bright/hue",
|
||||
"setSaturation": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/saturation",
|
||||
"statusSaturation": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/bright/saturation",
|
||||
"setColorTemperature": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/colorTemperature",
|
||||
"statusColorTemperature": "dispatcher_ng/items/Gnd/DiningRoom/NaehkaestchenLight/colorTemperature/feedback"
|
||||
},
|
||||
"payload": {
|
||||
"onTrue": "ON",
|
||||
"onFalse": "OFF",
|
||||
"brightnessFactor": 1,
|
||||
"hueFactor": 1,
|
||||
"saturationFactor": 1
|
||||
}
|
||||
},
|
||||
"Gnd_LivingRoom_LargeLight": {
|
||||
"id": "Gnd_LivingRoom_LargeLight",
|
||||
"name": "große Lampe Wohnzimmer",
|
||||
@ -319,6 +345,32 @@
|
||||
},
|
||||
"config": {}
|
||||
},
|
||||
"1st_BedRoom_WolfgangBedLight": {
|
||||
"id": "1st_BedRoom_WolfgangBedLight",
|
||||
"name": "Bettlicht",
|
||||
"service": "Lightbulb",
|
||||
"manufacturer": "hue2mqtt - Hue",
|
||||
"model": "color light",
|
||||
"topic": {
|
||||
"setOn": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/state",
|
||||
"statusOn": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/state/feedback",
|
||||
"setBrightness": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/bright",
|
||||
"statusBrightness": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/bright/feedback",
|
||||
"setHue": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/hue",
|
||||
"statusHue": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/bright/hue",
|
||||
"setSaturation": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/saturation",
|
||||
"statusSaturation": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/bright/saturation",
|
||||
"setColorTemperature": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/colorTemperature",
|
||||
"statusColorTemperature": "dispatcher_ng/items/1st/BedRoom/WolfgangBedLight/colorTemperature/feedback"
|
||||
},
|
||||
"payload": {
|
||||
"onTrue": "ON",
|
||||
"onFalse": "OFF",
|
||||
"brightnessFactor": 1,
|
||||
"hueFactor": 1,
|
||||
"saturationFactor": 1
|
||||
}
|
||||
},
|
||||
"1st_BedRoom_PattysSide": {
|
||||
"id": "1st_BedRoom_PattysSide",
|
||||
"name": "Pattys Seite Schlafzimmer",
|
||||
|
@ -7,6 +7,7 @@ Switch Gnd_DiningRoom_SmallLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Di
|
||||
Switch Gnd_DiningRoom_StandLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/StandLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/StandLight/state/feedback:state:default]"}
|
||||
Switch Gnd_DiningRoom_CupboardLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/CupboardLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/CupboardLight/state/feedback:state:default]"}
|
||||
Switch Gnd_DiningRoom_ShelfLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/ShelfLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/ShelfLight/state/feedback:state:default]"}
|
||||
|
||||
Switch Gnd_LivingRoom_LargeLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/LivingRoom/LargeLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/LivingRoom/LargeLight/state/feedback:state:default]"}
|
||||
Switch Gnd_LivingRoom_SmallLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/LivingRoom/SmallLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/LivingRoom/SmallLight/state/feedback:state:default]"}
|
||||
Switch Gnd_LivingRoom_Stars {mqtt=">[localbroker:dispatcher_ng/items/Gnd/LivingRoom/Stars/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/LivingRoom/Stars/state/feedback:state:default]"}
|
||||
@ -17,6 +18,7 @@ Switch Gnd_Hallway_WardrobeLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Ha
|
||||
Switch Gnd_Kitchen_WindowLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowLight/state/feedback:state:default]"}
|
||||
Switch Gnd_Kitchen_CeilingLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Kitchen/CeilingLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Kitchen/CeilingLight/state/feedback:state:default]"}
|
||||
Switch 1st_BedRoom_WolfgangsSide {mqtt=">[localbroker:dispatcher_ng/items/1st/BedRoom/WolfgangsSide/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/BedRoom/WolfgangsSide/state/feedback:state:default]"}
|
||||
|
||||
Switch 1st_BedRoom_PattysSide {mqtt=">[localbroker:dispatcher_ng/items/1st/BedRoom/PattysSide/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/BedRoom/PattysSide/state/feedback:state:default]"}
|
||||
Switch 1st_BedRoom_WindowLight {mqtt=">[localbroker:dispatcher_ng/items/1st/BedRoom/WindowLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/BedRoom/WindowLight/state/feedback:state:default]"}
|
||||
Switch Gnd_Hallway_DayLight {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Hallway/DayLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Hallway/DayLight/state/feedback:state:default]"}
|
||||
|
@ -51,7 +51,7 @@ export class HueColorBulbItem extends AHomegearItem implements HasStateAndFeedba
|
||||
this.saturationFeedbackTopic = `${this.topicFirstPart}/bright/saturation`
|
||||
this.colorTemperatureFeedbackTopic = `${this.topicFirstPart}/colorTemperature/feedback`
|
||||
this.stateActionTopic = `${this.actionTopicPre}/1/STATE`
|
||||
this.brightActionTopic = `${this.actionTopicPre}/1/BRIGHTNESS`
|
||||
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`
|
||||
|
@ -145,7 +145,7 @@ let bedRoomWolfgangsSide = new M433SwitchItem('1st', 'BedRoom', 'WolfgangsSide',
|
||||
bedRoomWolfgangsSide.start()
|
||||
allLabeledItems.push(bedRoomWolfgangsSide)
|
||||
|
||||
let bedRoomWolfgangBedLight = new HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 15)
|
||||
let bedRoomWolfgangBedLight = new HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 16)
|
||||
bedRoomWolfgangBedLight.start()
|
||||
allLabeledItems.push(bedRoomWolfgangBedLight)
|
||||
|
||||
|
Reference in New Issue
Block a user