add all existing items, homekit export

This commit is contained in:
Wolfgang Hottgenroth
2018-01-10 14:15:43 +01:00
parent 153b8570e4
commit 8a6547ff91
20 changed files with 746 additions and 42 deletions

55
dist/Export.js vendored Normal file
View File

@ -0,0 +1,55 @@
"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