Hello
Apologies if this is the wrong section in which to ask this question.
Is there a plan to allow devices and entities to be addressed/selected using newly introduced labels in things such as automations and scripts. For example, a UI display card that shows all entities labelled as “Battery” and an automation that turns of all devices labelled “Lights” and “Sockets” when leaving the house?
I think such a capability would be incredibly powerful and would simplify HASS tremendously.
How does one select trigger devices with a specific label?
I would like to set the trigger part so that any device labelled “humidity” gets to trigger an automation if humidity levels reach a certain threshold? or for devices labelled “radiator” to trigger an event when they begin heating.
For something like that, you’d want to use a template as your trigger and use the label_entities() function to get all the entities with that label. I’m currently mobile at the moment, but this [crappy ] example should get you started. I don’t have any humidity labels, but the concept is pretty much the same.
{% set lights_on = false %}
{% for entity in label_entities("light") %}
{% if is_state(entity, 'on') %}
{% set lights_on = true %}
{% break %}
{% endif %}
{% endfor %}
{{ lights_on }}
However, that only applies to entities. You don’t really trigger off devices, just entities.