mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-02 18:11:36 +00:00
Fix state when controlling brightness via brightness_percent. https://github.com/Koenkk/zigbee2mqtt/issues/902
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user