Fix report on/off for devices with multiple states (e.g. state_left/state_right). #117

This commit is contained in:
Koenkk committed 2018-06-16 20:38:44 +02:00
1 parent 95db22e12b
commit 0d6c001f2c
1 file changed
+2 -1
+2 -1
View File
@@ -461,7 +461,8 @@ class Controller {
// Devices do not report when they go off, this ensures state (on/off) is always in sync.
if (!error && key.startsWith('state')) {
const msg = {};
msg[key] = json[key];
const _key = topicPrefix ? `${key}_${topicPrefix}` : key;
msg[_key] = json[key];
this.mqttPublishDeviceState(deviceID, msg, true);
}
};