Hey everyone,
I have several cameras integrated through the Tapo Camera integration.
I want to create a sensor that I can use to notify my when one of the devices go offline/unknown.
Following this, and other similar threads i managed to get close, but im not there yet
{{ integration_entities('tapo_control')
| select('match', 'update')
| list
}}
Using this, i can filter all the update
entities of each camera, thiking that if one of them goes unavailable or unknown, it means the camera is offline. It indeed returns all the update.xxx
entities belonging to the tapo control integration.
The issue is that if i try to filter any further (i.e. for unavailable), i get no results.
{{ integration_entities('tapo_control')
| select('match', 'update')
| selectattr('state','in', ['unknown', 'unavailable', 'off', 'on'])
| list
}}
This gives me []
(I added off and on for test purposes)
Additionally, in this case, if I try to map anything (like | map(attribute='entity_id')
) I get a list of undefined
results.
On the other hand, if i try to filter all update
entities starting with states
then i can select only the unavalable/unknown etc
{{ states
| selectattr('domain','in',['update'])
| selectattr('state','in', ['unknown', 'unavailable', 'off', 'on'])
| map(attribute='entity_id')
| list }}
this gives me pretty much all update entities, and i can filter correctly by choosing the keywords in the 3rd line.
What am I missing here?
How can i filter entities when starting by state when looking into a specific integration?
Or how can i filter only a specific integration’s entities when starting from all states?
Thanks in advance