The documentation says that a state trigger with only the entity id will trigger on all state changes.
My testing shows that this is not the case.
I have an automation with 2 triggers. One of them is a state trigger without a condition.
- alias: Attic Fan
trigger:
- platform: state
entity_id: 'sensor.living_room_thermostat_temperature_test'
action:
- service: notify.ios_tr7p
data:
message: "You should turn on the attic fan 6"
I can set the state of my test object using the developer tools and the automation fires about 1 out of 5 times.
So my question is…
Is there a time limit on how frequently an automation can fire or is there some other limitation to state triggers?
That’s a valid point, but the reason I’m doing this with the developer tools is that I’m getting inconsistent results on the real object that I want to monitor.
it works this way however you will need a condition for your trigger as well - I had a similar issue and have just changed to this sort of trigger which now works perfectly fine when combined with a condition - the state will trigger and the conditions will be evaluated and if true, the action will be performed … not sure if it actually should work without a condition to be honest …
The final automation I was working on has a number of triggers, and each trigger has a matching condition, because I want all the conditions to be true regardless of which condition triggered the event. This was set up as a test to confirm what I was seeing. In testing, triggers fire inconsistently for quickly changing items, sometimes not at all, and sometimes more than once. In practice this is rarely a concern.
For example, I have a trigger “on sunset” that turns on the outside lights and sends me a notice. About once a week, this trigger fires twice, sending me 2 notices, but since the lights are already on, it’s not an issue. I have yet to see a situation where that event never fired.