normally with a defined state, can add the above for:… but if using templates, then
trigger:
platform: state
entity: my_entity
condition:
condition: template
value_template: "{{ 'foo' not in states.trigger.to_state.state and trigger.for.time().min > 1 }}'
this doesn’t work.
possibly for numerous reasons. not sure if i’m using the trigger.for component correctly and also wondering if it can discern how long the my_entity has been in the new state (whatever the new state is so long as it’s not foo)?
Use the same template to create a template sensor. Then base your automation on the state of that sensor. Here’s an example of a template sensor that I use to detect when it’s “gloomy” for light handling:
If you have several sensors (several batteries), you can use the states of multiple entity_id’s to trigger an automation. Automations are able to get data from their trigger. So you could create a single automation to act on any “battery sensor” and then have it report which battery was the problem within the automation.