openhab export added
This commit is contained in:
17
dist/Export.js
vendored
17
dist/Export.js
vendored
@ -1,20 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function SwitchHomekitExport(itemId, label, stateTopic, stateFeedbackTopic, type) {
|
||||
let out;
|
||||
function SwitchExport(itemId, label, stateTopic, stateFeedbackTopic, type) {
|
||||
let homekitOut;
|
||||
switch (type) {
|
||||
case 'bulb':
|
||||
out = SwitchHomekitBulbExport(itemId, label, stateTopic, stateFeedbackTopic);
|
||||
homekitOut = SwitchHomekitBulbExport(itemId, label, stateTopic, stateFeedbackTopic);
|
||||
break;
|
||||
case 'outlet':
|
||||
out = SwitchHomekitOutletExport(itemId, label, stateTopic, stateFeedbackTopic);
|
||||
homekitOut = SwitchHomekitOutletExport(itemId, label, stateTopic, stateFeedbackTopic);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`no homekit export function for type ${type}`);
|
||||
}
|
||||
return out;
|
||||
let openhabOut = SwitchOpenHABExport(itemId, label, stateTopic, stateFeedbackTopic);
|
||||
return { 'homekit': homekitOut, 'openhab': openhabOut };
|
||||
}
|
||||
exports.SwitchHomekitExport = SwitchHomekitExport;
|
||||
exports.SwitchExport = SwitchExport;
|
||||
function SwitchHomekitBulbExport(id, label, setOn, statusOn) {
|
||||
let o = {
|
||||
"id": id,
|
||||
@ -52,4 +53,8 @@ function SwitchHomekitOutletExport(id, label, setOn, statusOn) {
|
||||
};
|
||||
return { 'id': id, 'object': o };
|
||||
}
|
||||
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]", mqtt="<[localbroker:${statusOn}:state:default]"}`;
|
||||
}
|
||||
//# sourceMappingURL=Export.js.map
|
Reference in New Issue
Block a user