export relaybox

This commit is contained in:
2018-04-03 00:00:42 +02:00
parent e883c9a791
commit 8350b21161
6 changed files with 109 additions and 99 deletions

16
dist/Export.js vendored
View File

@ -28,16 +28,20 @@ function HueColorLightExport(itemId, label, stateTopic, stateFeedbackTopic, brig
return { 'homekit': HueColorLightHomekitExport(itemId, label, stateTopic, stateFeedbackTopic, brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic, saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic), 'openhab': '' };
}
exports.HueColorLightExport = HueColorLightExport;
function RelayBoxExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
return { 'homekit': RelayBoxHomekitExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames),
'openhab': RelayBoxOpenHABExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) };
function RelayBoxExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
return { 'homekit': RelayBoxHomekitExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames),
'openhab': RelayBoxOpenHABExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) };
}
exports.RelayBoxExport = RelayBoxExport;
function RelayBoxHomekitExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
function RelayBoxHomekitExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
return { 'id': '', 'object': {} };
}
function RelayBoxOpenHABExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
return '';
function RelayBoxOpenHABExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
let o = [];
itemNames.forEach((label, index) => {
o.push(`Switch ${itemId}${index} "${label} "{mqtt=">[localbroker:${stateTopicPre}/${index}:command:*:default],<[localbroker:${feedbackTopicPre}/${index}:state:default]"}`);
});
return o;
}
function SwitchHomekitBulbExport(id, label, setOn, statusOn) {
let o = {