From e55252b9ff7432695bbcffd494b689bf62603a87 Mon Sep 17 00:00:00 2001 From: Koenkk Date: Sat, 29 Sep 2018 21:12:47 +0200 Subject: [PATCH] Mock state ON when moveToLevelWithOnOff succeeds. https://github.com/Koenkk/zigbee-shepherd-converters/pull/81 --- lib/controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/controller.js b/lib/controller.js index e13fce3e7..225bde039 100644 --- a/lib/controller.js +++ b/lib/controller.js @@ -550,10 +550,10 @@ class Controller { const callback = (error) => { // Devices do not report when they go off, this ensures state (on/off) is always in sync. - if (!error && key.startsWith('state')) { + if (!error && (key.startsWith('state') || key === 'brightness')) { const msg = {}; - const _key = topicPrefix ? `${key}_${topicPrefix}` : key; - msg[_key] = json[key]; + const _key = topicPrefix ? `state_${topicPrefix}` : 'state'; + msg[_key] = key === 'brightness' ? 'ON' : json['state']; this.mqttPublishDeviceState(device, msg, true); } };