mqtt: always send globally, always retain, thermostat und windowContact completed
This commit is contained in:
24
dist/MqttDispatcher.js
vendored
24
dist/MqttDispatcher.js
vendored
@ -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();
|
||||
|
Reference in New Issue
Block a user