mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-10-23 06:12:23 +00:00
Fix some properties not being published when debounce is used (#5509)
* initial * More logging. https://github.com/Koenkk/zigbee-herdsman-converters/issues/1988 * More logging * Ignore group_optimistic * Cleanup * Add logging again * We got him? * go * linto
This commit is contained in:
1 parent
2524020963
commit
2942ae9f4a
2 files changed
+8
-7
No files matched your search
+1
-1
@@ -344,7 +344,7 @@ class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
this.eventBus.emit('publishEntityState', {payload: messagePayload, entity: resolvedEntity, stateChangeReason});
|
||||
this.eventBus.emit('publishEntityState', {messagePayload, entity: resolvedEntity, stateChangeReason, payload});
|
||||
}
|
||||
|
||||
async iteratePayloadAttributeOutput(topicRoot, payload, options) {
|
||||
|
||||
@@ -436,10 +436,10 @@ class HomeAssistant extends Extension {
|
||||
const endpoint = match[1];
|
||||
const endpointRegExp = new RegExp(`(.*)_${endpoint}`);
|
||||
const payload = {};
|
||||
for (const key of Object.keys(data.payload)) {
|
||||
for (const key of Object.keys(data.messagePayload)) {
|
||||
const keyMatch = endpointRegExp.exec(key);
|
||||
if (keyMatch) {
|
||||
payload[keyMatch[1]] = data.payload[key];
|
||||
payload[keyMatch[1]] = data.messagePayload[key];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,7 +456,8 @@ class HomeAssistant extends Extension {
|
||||
* https://github.com/Koenkk/zigbee2mqtt/issues/959#issuecomment-480341347
|
||||
*/
|
||||
if (settings.get().advanced.homeassistant_legacy_triggers) {
|
||||
const keys = ['action', 'click'].filter((k) => data.payload.hasOwnProperty(k) && data.payload[k] !== '');
|
||||
const keys = ['action', 'click'].filter((k) =>
|
||||
data.messagePayload.hasOwnProperty(k) && data.messagePayload[k] !== '');
|
||||
for (const key of keys) {
|
||||
this.publishEntityState(data.entity.device.ieeeAddr, {[key]: ''});
|
||||
}
|
||||
@@ -469,9 +470,9 @@ class HomeAssistant extends Extension {
|
||||
* and republish it to zigbee2mqtt/my_devic/action
|
||||
*/
|
||||
if (data.entity.definition) {
|
||||
const keys = ['action', 'click'].filter((k) => data.payload[k] && data.payload[k] !== '');
|
||||
const keys = ['action', 'click'].filter((k) => data.messagePayload[k] && data.messagePayload[k] !== '');
|
||||
for (const key of keys) {
|
||||
const value = data.payload[key].toString();
|
||||
const value = data.messagePayload[key].toString();
|
||||
await this.publishDeviceTriggerDiscover(data.entity, key, value);
|
||||
await this.mqtt.publish(`${data.entity.name}/${key}`, value, {});
|
||||
}
|
||||
@@ -502,7 +503,7 @@ class HomeAssistant extends Extension {
|
||||
];
|
||||
|
||||
for (const entry of mockedValues) {
|
||||
if (entry.condition && !data.payload.hasOwnProperty(entry.property)) {
|
||||
if (entry.condition && !data.messagePayload.hasOwnProperty(entry.property)) {
|
||||
logger.debug(`Mocking '${entry.property}' value for Home Assistant`);
|
||||
this.publishEntityState(data.entity.device.ieeeAddr, {[entry.property]: entry.value});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user