export of thermostat and windowcontact

This commit is contained in:
Wolfgang Hottgenroth
2018-01-16 21:06:00 +01:00
parent 72731b74b7
commit 1847db3934
4 changed files with 56 additions and 2 deletions

View File

@ -27,6 +27,13 @@ export function SwitchExport(itemId: string, label: string, stateTopic: string,
return { 'homekit': homekitOut, 'openhab': openhabOut }
}
export function ThermostatExport(itemId: string, label: string, temperatureTopic: string, temperatureFeedbackTopic: string) : ExportType {
return {'homekit': ThermostatHomekitExport(itemId, label, temperatureTopic, temperatureFeedbackTopic), 'openhab': ''}
}
export function ContactExport(itemId: string, label: string, status: string) : ExportType {
return {'homekit': ContactHomekitExport(itemId, label, status), 'openhab': ''}
}
function SwitchHomekitBulbExport(id: string, label: string, setOn: string, statusOn: string) : HomekitExportType {
let o : any = {
@ -67,6 +74,36 @@ function SwitchHomekitOutletExport(id: string, label: string, setOn: string, sta
return { 'id': id, 'object': o }
}
function ThermostatHomekitExport(id: string, label: string, setTemperature: string, statusTemperature: string) : HomekitExportType {
let o : any = {
"id": id,
"name": label,
"service": "Thermostat",
"topic": {
"setTargetTemperature": setTemperature,
"statusTargetTemperature": statusTemperature,
"statusCurrentTemperature": statusTemperature
},
"payload": {}
}
return { 'id': id, 'object': o }
}
function ContactHomekitExport(id: string, label: string, status: string) : HomekitExportType {
let o : any = {
"id": id,
"name": label,
"service": "ContactSensor",
"topic": {
"statusContactSensorState": status
},
"payload": {
"onContactDetected": "CLOSED"s
}
}
return { 'id': id, 'object': o }
}
function SwitchOpenHABExport(id: string, label: string, setOn: string, statusOn: string): string {
// Switch windowLightKitchen {mqtt=">[localbroker:nodered/items/windowLightKitchen:command:*:default]", mqtt="<[localbroker:nodered/items/windowLightKitchen/feedback:state:default]"}