hue light

This commit is contained in:
Wolfgang Hottgenroth
2018-01-27 17:40:33 +01:00
parent 11c3def220
commit b979969324
3 changed files with 94 additions and 6 deletions

View File

@ -35,6 +35,16 @@ export function ContactExport(itemId: string, label: string, status: string) : E
return {'homekit': ContactHomekitExport(itemId, label, status), 'openhab': ''}
}
export function HueColorLightExport(itemId: string, label: string,
stateTopic: string, stateFeedbackTopic: string,
brightnessTopic: string, brightnessFeedbackTopic: string,
hueTopic: string, hueFeedbackTopic: string,
saturationTopic: string, saturationFeedbackTopic: string,
colorTemperatureTopic: string, colorTemperatureFeedbackTopic: string) {
return {'homekit': HueColorLightHomekitExport(itemId, label, stateTopic, stateFeedbackTopic,
brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic,
saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic), 'openhab': ''}
}
function SwitchHomekitBulbExport(id: string, label: string, setOn: string, statusOn: string) : HomekitExportType {
let o : any = {
"id": id,
@ -109,3 +119,38 @@ function SwitchOpenHABExport(id: string, label: string, setOn: string, 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: string, label: string,
stateTopic: string, stateFeedbackTopic: string,
brightnessTopic: string, brightnessFeedbackTopic: string,
hueTopic: string, hueFeedbackTopic: string,
saturationTopic: string, saturationFeedbackTopic: string,
colorTemperatureTopic: string, colorTemperatureFeedbackTopic: string) {
let o: any = {
"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}
}