Feature request: Monitor only devices from a specific integration
Schnabulation opened this issue ยท 9 comments
I was wondering if it is feasable to monitor only devices within a specific integration.
As I would like to only monitor my ZigBee devices that would be all devices from the "deCONZ" integration.
I don't know if this value is represented in the entities itself.
I know I would be able to add these devices to a group and then interate through this group but I actually would like to have all ZigBee devices automatically added to this sensor.
Thanks for your help!
Basically this should be quite easy to implement, just a filter required.
But forget about ZigBee devices integrated using deCONZ.
deCONZ only reports devices as unavailable (e. g. battery dead) after 24 hours of missing status updates. See https://forum.phoscon.de/t/inacceptable-huge-default-sensor-unavailable-time-of-24-hours/1592.
That's complete crap and forces us to think about better monitoring approaches not based on the deCONZ integration itself. Like this idea:
Could you maybe provide me with a filter for integration? Because the integration is not published as an attribute of the entity as far as I know. Thatโs why I was asking here.
Regarding deCONZ: yes I know. But itโs still better to have a notification after 24h than none at all.
Basically this should be quite easy to implement, just a filter required.
I know you can filter/sort by integration in the front end, but I've never found a way to do this with a template. As far as I know there is no jinja filter or test for an entities parent integration. If you have the secret sauce for this please share!
@Schnabulation If you look at the thread @bcutter posted I gave a couple of examples there of how to filter out entities for an integration. Easiest way - just add the integration's entities to your ignored entities group manually.
Wish I had a better answer.
If you have the secret sauce for this please share!
I was actually hoping you might.
But nevermind, seems like this is not possible with the current implementation of integrations. I'll close this ticket. Thanks again for your great work!
Basically this should be quite easy to implement, just a filter required.
I know you can filter/sort by integration in the front end, but I've never found a way to do this with a template. As far as I know there is no jinja filter or test for an entities parent integration. If you have the secret sauce for this please share!
Well for another usecase I use e. g.:
{{ integration_entities('deconz') | list | length }}
(which gives the number of entities for the deCONZ integration)
That should be something to work with right?
That should be something to work with right?
@bcutter Absolutely! Well I'll be damned. I have never seen that anywhere. It works perfectly. I'm going to add a little note in the README when I get a minute to document this.
Any chance you know where that is documented in the HA docs? I did a quick search on the forum and I can't even find anyone using this function on there.
@Schnabulation try this template out. Replace "alarmo" with the integration you want to monitor.
{% set ignore_seconds = 60 %}
{% set ignored = state_attr('group.ignored_unavailable_entities','entity_id') %}
{% set ignore_ts = (now().timestamp() - ignore_seconds)|as_datetime %}
{% set entities = expand(integration_entities('alarmo'))
|rejectattr('last_changed','ge',ignore_ts)
|selectattr('state','in',['unavailable','unknown']) %}
{% if ignored != none %}
{% set entities = entities|rejectattr('entity_id','in',ignored) %}
{% endif %}
{{ entities|map(attribute='entity_id')|list }}
Any chance you know where that is documented in the HA docs? I did a quick search on the forum and I can't even find anyone using this function on there.
No unfortunately I don't. I came across this at the beginning of this year during research for my statistics project (before that I had to use command line instead of template sensors to manually search in the entity / devices registry file).
I think someone on the forums or another HA community noted it - there are a few topics using this on the HA forum. But no official documentation (which is strange and makes me think "Well, maybe there are another great filters out there?" ๐คท๐ปโโ๏ธ) ๐ซค
Hot damn you guys are awesome! I have adjusted the templated as you mentioned (replaced alarmo
with deconz
) and this works absolutely perfectly.
I have even tried to shutdown the deCONZ plugin and after the set 60 seconds all deCONZ entities have been displayed in the sensor.
Very nice work you guys!