diff --git a/lib/controller.js b/lib/controller.js index 12baa042e..ebc628e51 100644 --- a/lib/controller.js +++ b/lib/controller.js @@ -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); } };