add all existing items, homekit export
This commit is contained in:
55
dist/Export.js
vendored
Normal file
55
dist/Export.js
vendored
Normal 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
|
Reference in New Issue
Block a user