-
Notifications
You must be signed in to change notification settings - Fork 200
Description
So I have some custom code using zigpy and I updated it to work with current zigpy. However I see that I don't get AttributeUpdatedEvent and when I look at the logic I don't see how it's supposed to work.
So a report comes in and eventually ends up in handle_cluster_general_request ( zigpy/zcl/__init__.py ).
This eventually makes it way to
cached_value = self._legacy_apply_quirk_attribute_update(
attr_def, value
)and then depending if cached_value == value, it will emit either AttributeUpdatedEvent or AttributeReportedEvent. But in my case, they always match. And it's not surprising because in _legacy_apply_quirk_attribute_update we have :
with _suppress_attribute_update_event(self.cluster_id, attr_def.id):
self._update_attribute(attr_def.id, value)
try:
return self._attr_cache.get_value(attr_def)
except KeyError:
pass So the returned value is self._attr_cache.get_value(attr_def) in the normal case.
But just before there is a call to self._update_attribute(attr_def.id, value) which itself is going to do:
self._attr_cache.set_value(attr_def, value)So the _attr_cache is updated with the new value and then we return that as the cached_value so obviously cached_value == value all the time.
Am I missing something here ?