Since ZHA supports Zigbee updates since today, I was trying to create a template sensor that counts how many updates are due for my Zigbee devices. I tried to use this as a template:
{{ states.update | integration_entities('Zigbee Home Automation') | selectattr('state', '==', 'on') | list | count }}
However, the integration_entities piece is not working. As per the documentation it should give me a list of all entities in ZHA, however the template sensor returns “not available”. Also tried lower case, using “ZHA”, “zha”… I also tried another way that I found in a forum:
{{ states.update | selectattr('attributes.integration', 'in', ['zigbee']) | selectattr('state', '==', 'on') | list | count }}
However the sensor returns 0 (I removed the state filter for testing - should count the number of update-entities in the ZHA integration).
Does anyone have an idea how to fix this?
EDIT: Experimented a little more, the integration_entities part seems to work if I put it as the first item in the template:
{{ integration_entities('zha') | list | count }}
Buuuuut… once I add the filter that selects only the update entities… it doesn’t work anymore and returns 0:
{{ integration_entities('zha') | selectattr('domain', 'contains', 'update') | list | count }}
Also tried another way since zha is adding the keyword “firmware” to all those entities:
{{ integration_entities('zha') | selectattr('unique_id', 'contains', 'firmware') | list | count }}
… returns 0 as well.