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

This commit is contained in:
Fabio Manganiello 2020-02-25 18:13:11 +01:00
parent 87a51b391c
commit f74c44c7fb

View file

@ -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',