Fix group publish on Node 10 (doesn't support Object.fromEntries). https://github.com/Koenkk/zigbee2mqtt/issues/9085

This commit is contained in:
Koen Kanters
2021-10-09 15:50:03 +02:00
parent 45f096ec0a
commit 4e520bb042
+8 -3
View File
@@ -140,9 +140,14 @@ export default class Publish extends Extension {
const device = re instanceof Device ? re.zh : null;
const entitySettings = re.settings;
const entityState = this.state.get(re) || {};
const membersState = re instanceof Group ?
Object.fromEntries(re.zh.members.map((e) => [e.getDevice().ieeeAddr,
this.state.get(this.zigbee.resolveEntity(e.getDevice().ieeeAddr))])) : null;
const membersState: {[s: string]: KeyValue} = {};
if (re.isGroup()) {
re.zh.members.forEach((e) => {
const device = e.getDevice();
membersState[device.ieeeAddr] = this.state.get(this.zigbee.resolveEntity(e.getDevice().ieeeAddr));
});
}
let converters: zhc.ToZigbeeConverter[];
{
if (Array.isArray(definition)) {