Automation Trigger: list of devices

I’d suggest a template sensor. Play around in the template editor — something like this should give a list of entities that you’re looking for, provided the battery level is the sensor state and not an attribute:

{% for sensor in states.sensor %}
  {{ sensor.entity_id if "_battery_level" in sensor.entity_id and sensor.state|int < 50 }}
{% endfor %}

Then you need to work out a way for the template to return True if there is an entity in the list.

Need to sort out:

Recommendation: use AppDaemon instead. It’s ideal for this sort of more complex logic, but is a bit of a learning curve.

Alternatively, see this topic.

1 Like