I am trying to set up an extremely simple automation based on weather temperature. But no matter what I do I can’t get the automation to work. Trying to debug any automation is almost impossible. I expected the run automation button in the interface to output a debug log where it would log all input states and actions but there doesn’t seem to be any kind of debugging available. How do people create any kind of complex automation at all?
I have a very simple automation based on weather temperature, that should fire all the time:
platform: numeric_state
entity_id: weather.fagrihjalli_56
attribute: temperature
above: '-100'
below: '100'
In the developer tools I can examine the entity weather.fagrihjalli_56:
But that will only fire when you are outside of that range and enter it.
So if the temperature is below -100 and it warms up to above -100, then it will fire.
Or if it’s above 100 and drops down to 99 or less.
I’m not sure whether the quotes matter in this case as mentioned by @m0wlheld.
However, the reason your automation doesn’t trigger is that a numeric state trigger only triggers qhen the value goes outside your thresholds and then inside again.
In your case it will only trigger if the value goes above 100 and then below 100 OR below -100 and then above -100 again.
What exactly do you want to do? Do you want to trigger it when the value goes above 100 or below -100?
I believe your trigger is correct.
And because it’s so boring to wait for the weather to cooperate you can replace the weather with a input_number.
That way you can “test” the conditions and actions with a slider.
And when you are satisfied just add the weather again.
Yes the -100,100 values where just for testing. I finally made it to work using input_number as suggested by Hellis81 and sliding the number up/down. So this will never fire unless there is a state change into the threshold, even if the automation is changed it seems. Well how would this behave if the state is offline or Home Assistant is offline and comes back up into this threshold? How can I have 100% guaranteed automation for specific state?
Change the numeric state trigger to a state trigger and add your desired thresholds in the condition. This way it will trigger every time the state changes but only fire the notification when the conditions are met. Something like this:
trigger:
- platform: state
entity_id: weather.fagrihjalli_56
attribute: temperature
condition:
- "{{ trigger.to_state.state | int > 100 or trigger.to_state.state | int < 100 }}"
action:
...