I’m still confused by all of this tbh, and the main issue I’m having is with this one…
sensor:
- platform: template
sensors:
unavailable_entities:
friendly_name: Unavailable Entities
value_template: "{{states|selectattr('state', 'in', ['unavailable', 'unknown', 'none'])
|rejectattr('entity_id', 'in', state_attr('group.entity_blacklist', 'entity_id'))
|rejectattr('entity_id', 'eq' , 'group.entity_blacklist')
|map(attribute='entity_id')|list|length }}"
attribute_templates:
entities: "{{states|selectattr('state', 'in', ['unavailable', 'unknown', 'none'])
|rejectattr('entity_id', 'in', state_attr('group.entity_blacklist', 'entity_id'))
|rejectattr('entity_id', 'eq' , 'group.entity_blacklist')
|map(attribute='entity_id')|list|join(', ') }}"
unit_of_measurement: items
What I want is for this to react to every state change in my system, set the sensors state to the number of unavailable entities, and set the attribute ‘entities’ to a comma separated list of the entity_ids that are unavailable.
If I must compromise on update frequency, then I would much prefer once every second. Currently it is once per minute.
I would rather not use an automation to do this as the current logic of my system is to wait until all entities are available before turning on my automations, and I would prefer not to make an exception just for this sensor (for OCD reasons if nothing else).
What would be the best way to adapt this sensor to update every second, or even better update with every state change as desired please?
(I clicked the reply arrow on petro’s post but this is meant for everyone, not a specific reply to him, sorry!)