diff --git a/src/Export.ts b/src/Export.ts index 648e186..41024fb 100644 --- a/src/Export.ts +++ b/src/Export.ts @@ -32,7 +32,7 @@ export function ThermostatExport(itemId: string, label: string, temperatureTopic } export function ContactExport(itemId: string, label: string, status: string) : ExportType { - return {'homekit': ContactHomekitExport(itemId, label, status), 'openhab': ''} + return {'homekit': ContactHomekitExport(itemId, label, status), 'openhab': ContactOpenHABExport(itemId, label, status)} } export function HueColorLightExport(itemId: string, label: string, @@ -120,6 +120,11 @@ function SwitchOpenHABExport(id: string, label: string, setOn: string, statusOn: return `Switch ${id} {mqtt=">[localbroker:${setOn}:command:*:default],<[localbroker:${statusOn}:state:default]"}` } +function ContactOpenHABExport(id: string, label: string, status: string): string { + // Switch windowLightKitchen {mqtt=">[localbroker:nodered/items/windowLightKitchen:command:*:default]", mqtt="<[localbroker:nodered/items/windowLightKitchen/feedback:state:default]"} + return `Switch ${id} {mqtt="<[localbroker:${status}:state:default]"}` +} + function ThermostatOpenHAPExport(id: string, label: string, setTemperature: string, statusTemperature: string) : string { return `Number ${id} {mqtt=">[localbroker:${setTemperature}:command:*:default],<[localbroker:${statusTemperature}:state:default]"}` }