Merge remote-tracking branch 'refs/remotes/origin/master'
This commit is contained in:
11
dist/Export.js
vendored
11
dist/Export.js
vendored
@ -28,6 +28,17 @@ function HueColorLightExport(itemId, label, stateTopic, stateFeedbackTopic, brig
|
|||||||
return { 'homekit': HueColorLightHomekitExport(itemId, label, stateTopic, stateFeedbackTopic, brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic, saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic), 'openhab': '' };
|
return { 'homekit': HueColorLightHomekitExport(itemId, label, stateTopic, stateFeedbackTopic, brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic, saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic), 'openhab': '' };
|
||||||
}
|
}
|
||||||
exports.HueColorLightExport = HueColorLightExport;
|
exports.HueColorLightExport = HueColorLightExport;
|
||||||
|
function RelayBoxExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
|
||||||
|
return { 'homekit': RelayBoxHomekitExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames),
|
||||||
|
'openhab': RelayBoxOpenHABExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) };
|
||||||
|
}
|
||||||
|
exports.RelayBoxExport = RelayBoxExport;
|
||||||
|
function RelayBoxHomekitExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
|
||||||
|
return { 'id': '', 'object': {} };
|
||||||
|
}
|
||||||
|
function RelayBoxOpenHABExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
function SwitchHomekitBulbExport(id, label, setOn, statusOn) {
|
function SwitchHomekitBulbExport(id, label, setOn, statusOn) {
|
||||||
let o = {
|
let o = {
|
||||||
"id": id,
|
"id": id,
|
||||||
|
2
dist/MqttDispatcher.js
vendored
2
dist/MqttDispatcher.js
vendored
@ -76,7 +76,7 @@ class MqttHandler {
|
|||||||
// sent = this.processMessage(topic, payload)
|
// sent = this.processMessage(topic, payload)
|
||||||
//}
|
//}
|
||||||
//if (! sent) {
|
//if (! sent) {
|
||||||
logger.info(`External sending required: ${topic}`);
|
logger.info(`External sending required: ${topic} ${payload}`);
|
||||||
let options = { retain: true, qos: 0 };
|
let options = { retain: true, qos: 0 };
|
||||||
this.mqttClient.publish(topic, payload, options);
|
this.mqttClient.publish(topic, payload, options);
|
||||||
//} else {
|
//} else {
|
||||||
|
4
dist/RelayBox.js
vendored
4
dist/RelayBox.js
vendored
@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const logger = require("./log");
|
const logger = require("./log");
|
||||||
const MqttDispatcher_1 = require("./MqttDispatcher");
|
const MqttDispatcher_1 = require("./MqttDispatcher");
|
||||||
const AItem_1 = require("./AItem");
|
const AItem_1 = require("./AItem");
|
||||||
|
const Export_1 = require("./Export");
|
||||||
class RelayBoxThing extends AItem_1.AItem {
|
class RelayBoxThing extends AItem_1.AItem {
|
||||||
constructor(floor, room, item, deviceCommandTopic, deviceStatusTopic, itemNames) {
|
constructor(floor, room, item, deviceCommandTopic, deviceStatusTopic, itemNames) {
|
||||||
super(floor, room, item, '');
|
super(floor, room, item, '');
|
||||||
@ -18,6 +19,9 @@ class RelayBoxThing extends AItem_1.AItem {
|
|||||||
];
|
];
|
||||||
this.oldSwitchStates = '';
|
this.oldSwitchStates = '';
|
||||||
}
|
}
|
||||||
|
exportItem() {
|
||||||
|
return Export_1.RelayBoxExport(this.stateTopicPre, this.feedbackTopicPre, this.conflictTopicPre, this.itemNames);
|
||||||
|
}
|
||||||
processMessage(topic, payload) {
|
processMessage(topic, payload) {
|
||||||
// logger.info(`RT: ${topic}, ${payload}`)
|
// logger.info(`RT: ${topic}, ${payload}`)
|
||||||
if (topic == this.deviceStatusTopic) {
|
if (topic == this.deviceStatusTopic) {
|
||||||
|
@ -45,6 +45,21 @@ export function HueColorLightExport(itemId: string, label: string,
|
|||||||
brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic,
|
brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic,
|
||||||
saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic), 'openhab': ''}
|
saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic), 'openhab': ''}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function RelayBoxExport(stateTopicPre: string, feedbackTopicPre: string, conflictTopicPre: string, itemNames: string[]) : ExportType {
|
||||||
|
return {'homekit': RelayBoxHomekitExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames),
|
||||||
|
'openhab': RelayBoxOpenHABExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames)}
|
||||||
|
}
|
||||||
|
|
||||||
|
function RelayBoxHomekitExport(stateTopicPre: string, feedbackTopicPre: string, conflictTopicPre: string, itemNames: string[]) : HomekitExportType{
|
||||||
|
return {'id': '', 'object': {}}
|
||||||
|
}
|
||||||
|
|
||||||
|
function RelayBoxOpenHABExport(stateTopicPre: string, feedbackTopicPre: string, conflictTopicPre: string, itemNames: string[]) : string {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function SwitchHomekitBulbExport(id: string, label: string, setOn: string, statusOn: string) : HomekitExportType {
|
function SwitchHomekitBulbExport(id: string, label: string, setOn: string, statusOn: string) : HomekitExportType {
|
||||||
let o : any = {
|
let o : any = {
|
||||||
"id": id,
|
"id": id,
|
||||||
|
@ -97,7 +97,7 @@ class MqttHandler {
|
|||||||
// sent = this.processMessage(topic, payload)
|
// sent = this.processMessage(topic, payload)
|
||||||
//}
|
//}
|
||||||
//if (! sent) {
|
//if (! sent) {
|
||||||
logger.info(`External sending required: ${topic}`)
|
logger.info(`External sending required: ${topic} ${payload}`)
|
||||||
let options : IClientPublishOptions = { retain: true, qos: 0 }
|
let options : IClientPublishOptions = { retain: true, qos: 0 }
|
||||||
this.mqttClient.publish(topic, payload, options)
|
this.mqttClient.publish(topic, payload, options)
|
||||||
//} else {
|
//} else {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import * as logger from './log'
|
import * as logger from './log'
|
||||||
import { mqttHandler } from './MqttDispatcher'
|
import { mqttHandler } from './MqttDispatcher'
|
||||||
import { AItem } from './AItem'
|
import { AItem } from './AItem'
|
||||||
|
import { RelayBoxExport, ExportType } from './Export'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -31,6 +32,10 @@ export class RelayBoxThing extends AItem {
|
|||||||
this.oldSwitchStates = ''
|
this.oldSwitchStates = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exportItem() : ExportType|null {
|
||||||
|
return RelayBoxExport(this.stateTopicPre, this.feedbackTopicPre, this.conflictTopicPre, this.itemNames)
|
||||||
|
}
|
||||||
|
|
||||||
processMessage(topic: string, payload: string) {
|
processMessage(topic: string, payload: string) {
|
||||||
// logger.info(`RT: ${topic}, ${payload}`)
|
// logger.info(`RT: ${topic}, ${payload}`)
|
||||||
if (topic == this.deviceStatusTopic) {
|
if (topic == this.deviceStatusTopic) {
|
||||||
|
Reference in New Issue
Block a user