mqtt: always send globally, always retain, thermostat und windowContact completed

This commit is contained in:
Wolfgang Hottgenroth
2018-01-15 17:10:42 +01:00
parent f88cf5ee0d
commit 09a63fe736
8 changed files with 179 additions and 32 deletions

View File

@ -70,18 +70,18 @@ class MqttHandler {
return found;
}
send(topic, payload, internalFirst = false) {
let sent = false;
if (internalFirst) {
logger.info(`Try internal sending: ${topic}`);
sent = this.processMessage(topic, payload);
}
if (!sent) {
logger.info(`External sending required: ${topic}`);
this.mqttClient.publish(topic, payload);
}
else {
logger.info(`Internally delivered: ${topic}`);
}
//let sent = false
//if (internalFirst) {
// logger.info(`Try internal sending: ${topic}`)
// sent = this.processMessage(topic, payload)
//}
//if (! sent) {
logger.info(`External sending required: ${topic}`);
let options = { retain: true, qos: 0 };
this.mqttClient.publish(topic, payload, options);
//} else {
// logger.info(`Internally delivered: ${topic}`)
//}
}
}
exports.mqttHandler = new MqttHandler();