mekaneck
(Rick)
September 14, 2024, 10:49am
9
vingerha is on the right track, expand will take the list of entity_id’s and convert it to a list of state objects, and then the filtering will work. Then it can be mapped back to an entity_id or a friendly name depending on what output you want.
{{ integration_entities('rest') | expand | selectattr('state', 'eq', 'unavailable') | map(attribute='entity_id') | list }}
However there are more polished solutions for listing all unavailable entities.
This template sensor will iterate the states object and return a count and list of entities that have a state of unknown, unavailable. This is a new version that incorporates a couple of new features such as ignoring entities for a time period and filtering entities based on a partial string match in addition to the entities declared in the ignored_entities group.
The package has been moved to it’s own repository with updated documentation.
Update 2023-9-22: Template and documentation have be…
So, in case anyone else wants it, here is the final full code – tested, tidied up and annotated.
Thanks to all of you for your help and to others on the forum and elsewhere on the internet who made contributions to this subject.
##----------------------------------------------------------------------------------------------------------------------
##
## Unavailable Entities Sensor
##
## 05-Feb-2024 | Andy Symons | created
##
## Credit: based loosely on https://github.com/jazzyisj/unavailable-e…