55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
function SwitchHomekitExport(itemId, label, stateTopic, stateFeedbackTopic, type) {
|
|
let out;
|
|
switch (type) {
|
|
case 'bulb':
|
|
out = SwitchHomekitBulbExport(itemId, label, stateTopic, stateFeedbackTopic);
|
|
break;
|
|
case 'outlet':
|
|
out = SwitchHomekitOutletExport(itemId, label, stateTopic, stateFeedbackTopic);
|
|
break;
|
|
default:
|
|
throw new Error(`no homekit export function for type ${type}`);
|
|
}
|
|
return out;
|
|
}
|
|
exports.SwitchHomekitExport = SwitchHomekitExport;
|
|
function SwitchHomekitBulbExport(id, label, setOn, statusOn) {
|
|
let o = {
|
|
"id": id,
|
|
"name": label,
|
|
"service": "Lightbulb",
|
|
"topic": {
|
|
"setOn": setOn,
|
|
"statusOn": statusOn
|
|
},
|
|
"payload": {
|
|
"onTrue": "ON",
|
|
"onFalse": "OFF",
|
|
"brightnessFactor": "",
|
|
"hueFactor": "",
|
|
"saturationFactor": ""
|
|
},
|
|
"config": {}
|
|
};
|
|
return { 'id': id, 'object': o };
|
|
}
|
|
function SwitchHomekitOutletExport(id, label, setOn, statusOn) {
|
|
let o = {
|
|
"id": id,
|
|
"name": label,
|
|
"service": "Outlet",
|
|
"topic": {
|
|
"setOn": setOn,
|
|
"statusOn": statusOn
|
|
},
|
|
"payload": {
|
|
"onTrue": "ON",
|
|
"onFalse": "OFF"
|
|
},
|
|
"config": {}
|
|
};
|
|
return { 'id': id, 'object': o };
|
|
}
|
|
//# sourceMappingURL=Export.js.map
|