šŸ“¢ Notifications & Announcements

Hi @Blacky ,

Is there any chance in the roadmap to have option for ā€œpreviousā€ (aka from/to) state which is more close to what a classic automation UI has?
I have a use case where I get some false positives (after power outage) because I can’t validate the previous state

@fumantsu

You can use the global condition and add the condition you would like for ā€œpreviousā€ (aka from/to) state.

How To:
Add a condition > search template and select it then use the code below but change ot to your states.

{{ trigger.from_state.state == 'on' and trigger.to_state.state == 'off' }}

Blacky :grinning:

3 Likes

I didn’t know that conditions can have this type of check and I use HA few years. It will be very useful for other automations.
Still learning something new :wink:

2 Likes

Would love to see this too! I have a bit of an unreliable sensor and now I keep getting notifications because it moves from unavailable/unknown to ā€˜on’. Thanks!

Try using a Global condition.

Add a condition, select template and the use this code in the Value template

{{ trigger.from_state.state not in ['unknown', 'unavailable'] }}

Blacky :grinning:

2 Likes

Aah that’s even cleaner than the hack I made. Thanks again Blacky!

1 Like