hi guys i have this automation to send notification if a switch is turned ON…
- alias: Notification - SWITCH IS ON
trigger:
platform: state
entity_id: switch.switch_5
from: 'off'
to: 'on'
action:
- service: notify.notify
data:
message: 'SWITCH IS ON'
this one works fine but i get multiple notifications every time this switch is turn ON even from ON position (i used automation to turn it on when my phone is connected on my network). I would like to only send notification if the switch is actually toggled to ON from OFF. I tried this code but it gives HA an ERROR and not able to start HA (fully im not confusing you guys)
- alias: Notification - SWITCH IS ON
trigger:
platform: state
entity_id: switch.switch_5
from: 'off'
to: 'on'
condition: state
entity_id: 'switch.switch_5'
from: 'off'
to: 'on'
action:
- service: notify.notify
data:
message: 'SWITCH ON'
can please someone point me to the right direction