From fcfeac81e496530e2c2aca88207c87d9d605c5de Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 21 Jan 2019 18:02:50 +0100 Subject: [PATCH] Fix state when controlling brightness via brightness_percent. https://github.com/Koenkk/zigbee2mqtt/issues/902 --- lib/extension/devicePublish.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/extension/devicePublish.js b/lib/extension/devicePublish.js index c8c309a2..9aa21394 100644 --- a/lib/extension/devicePublish.js +++ b/lib/extension/devicePublish.js @@ -163,10 +163,10 @@ class DevicePublish { (error, rsp) => { // Devices do not report when they go off, this ensures state (on/off) is always in sync. if (entity.type === 'device' && topic.type === 'set' && - !error && (key.startsWith('state') || key === 'brightness')) { + !error && (key.startsWith('state') || key.startsWith('brightness'))) { const msg = {}; const _key = topic.postfix ? `state_${topic.postfix}` : 'state'; - msg[_key] = key === 'brightness' ? 'ON' : json['state']; + msg[_key] = key.startsWith('brightness') ? 'ON' : json['state']; this.publishDeviceState(device, msg, true); }