From 0d6c001f2c0917e33fb706d5d569a25d94959146 Mon Sep 17 00:00:00 2001 From: Koenkk Date: Sat, 16 Jun 2018 20:38:44 +0200 Subject: [PATCH] Fix report on/off for devices with multiple states (e.g. state_left/state_right). #117 --- lib/controller.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } };