Mock state ON when moveToLevelWithOnOff succeeds. https://github.com/Koenkk/zigbee-shepherd-converters/pull/81

This commit is contained in:
Koenkk
2018-09-29 23:05:18 +02:00
parent 71d12c3c71
commit e55252b9ff
+3 -3
View File
@@ -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);
}
};