Hello.
I have an automation that has 2 conditions that need to be met to fire the action. Once the conditions are met and the automation runs, I get a notification that it has run. All is good.
Where I am having the problem is getting a notification when it does not run because the conditions are not met.
Is it possible to have a notification sent when the conditions are not met and the automation does not continue?
Yes, first of you need to remove the original condition so that the automation can run.
Then use a “Choose” with same logic you had in the original condition.
If the Choose condition is true then carry out the relevant actions and notify “conditions met”.
Otherwise there are no actions to carry out and just notify “conditions not met”.
Hi Mark.
Thanks for the really quick response.
The Choose option is not something I have used or seen before. I had a quick look but I am not sure where to put it in the code.
My code looks like this
alias: Hot Water Automation
description: ‘’
trigger:
- platform: time
at: ‘20:00:00’
condition: - condition: and
conditions:- condition: state
entity_id: timer.mqtt_watchdog
state: active - condition: numeric_state
entity_id: sensor.hot_water_temperature
below: ‘45’
action:
- condition: state
- service: input_boolean.turn_on
target:
entity_id: input_boolean.hot_water_boost - service: notify.mobile_app_main_iphone
data:
message: Hot Water Automatic Boost Activated - service: notify.mobile_app_backup_iphone
data:
message: Hot Water Automatic Boost Activated - delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0 - service: input_boolean.turn_off
target:
entity_id: input_boolean.hot_water_boost
mode: single
Where would I put the Choose option?
I haven’t figured out how to post my code either. Sorry.
Highlight the code and use: </>
Use the “Choose” action and place the “fail” action as the default at the end… That way the “not activated” message will be sent whenever the automation is triggered, but the conditions fail.
alias: Hot Water Automation
description: ''
mode: single
trigger:
- platform: time
at: '20:00:00'
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: timer.ztest_timer
state: active
- condition: numeric_state
entity_id: sensor.hot_water_temperature
below: 45
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.hot_water_boost
- service: notify.mobile_app_shanes_iphone
data:
message: Hot Water Automatic Boost Activated
- service: notify.mobile_app_alexandras_iphone
data:
message: Hot Water Automatic Boost Activated
default:
- service: notify.mobile_app_shanes_iphone
data:
message: Hot Water Automatic Boost was not Activated
- service: notify.mobile_app_alexandras_iphone
data:
message: Hot Water Automatic Boost was not Activated
Thanks Mark for the idea and Didgeridrew for putting it into code. Seeing the code was extremely helpful to understand how to use the option. The choose option is very cool and something I never heard of. The code works perfectly. I did get an error when I tried to copy and paste the code but once did it from scratch, all is well. Thanks again.