Here is my code, I want it to notify during 6am to 7pm. Remove condition, the code is run, but when I put condition back, it stop working.
- alias: WPump Idle Warning
trigger:
- platform: state
entity_id: switch.waterpump
to: "off"
for:
minutes: 3
condition:
condition: time
after: '06:00:00'
before: '19:00:00'
action:
- service: notify.browsernotification
data_template:
message: "WARNING!!! WaterPump is OFF for 4hrs {{now().strftime('%H:%M:%S %d-%m-%Y')}}."
Bartem
March 11, 2020, 4:46pm
2
You need a hyphen before the second condition line… that’s a start… did it pass the config check ?
I already try it, still no luck. The config check is always ok. I remember read this somewhere, if you have 1 condition, you dont need hyphen
You only need a hyphen if you have two or more conditions. You also don’t need it in your trigger and action part, because it’s only one block of code.
How did you verify that your automation doesn’t work?
Your indentation for the condition is too far, but I don’t think this should be a problem.
It doesnt send any notification, and I check it in developer tool, it doesnt trigger
Did you try correcting the indentation? What time does your HA system show?
its weird, only worked 1 time this morning. While it suppose to trigger every time the pump show OFF
It’s supposed to trigger every time the pump is “off” for 3 minutes.