From f74c44c7fbafe7a85ca501e7ff2d12130dc9daf4 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 25 Feb 2020 18:13:11 +0100 Subject: [PATCH] There can be many Zigbee property set events; don't trigger a full refresh on all of them and only update the impacted devices instead --- .../backend/http/static/js/plugins/zigbee.mqtt/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platypush/backend/http/static/js/plugins/zigbee.mqtt/index.js b/platypush/backend/http/static/js/plugins/zigbee.mqtt/index.js index 024728a7..c8ba5e8b 100644 --- a/platypush/backend/http/static/js/plugins/zigbee.mqtt/index.js +++ b/platypush/backend/http/static/js/plugins/zigbee.mqtt/index.js @@ -170,6 +170,10 @@ Vue.component('zigbee-mqtt', { this.bus.$emit('refreshProperties'); }, + updateProperties: function(device, props) { + Vue.set(this.devices[device], 'values', props); + }, + addGroup: async function() { const name = prompt('Group name'); if (!name) { @@ -287,9 +291,12 @@ Vue.component('zigbee-mqtt', { }); }, 'platypush.message.event.zigbee.mqtt.ZigbeeMqttErrorEvent'); + registerEventHandler((event) => { + self.updateProperties(event.device, event.properties); + }, 'platypush.message.event.zigbee.mqtt.ZigbeeMqttDevicePropertySetEvent'); + registerEventHandler(this.refresh, 'platypush.message.event.zigbee.mqtt.ZigbeeMqttOnlineEvent', - 'platypush.message.event.zigbee.mqtt.ZigbeeMqttDevicePropertySetEvent', 'platypush.message.event.zigbee.mqtt.ZigbeeMqttDevicePairingEvent', 'platypush.message.event.zigbee.mqtt.ZigbeeMqttDeviceConnectedEvent', 'platypush.message.event.zigbee.mqtt.ZigbeeMqttDeviceBannedEvent',