Hello All!
I have a reed sensor that I’m using to detect when my doorbell gets pressed. This shows up as a binary sensor in HA and is normally open.
When watching in the states ui and the developer states page, I can see the sensor changing states from ‘open’ to ‘closed’ and quickly back again (when the doorbell button is pressed).
This is merely to explain that this part is working.
I have an automation setup to trigger a notification when the state changes from open to closed.
below is my config:
#################
#Doorbell Notify#
#################
- id: doorbell_notify
alias: Doorbell Notify
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.doorbell
from: Open
to: Closed
- platform: state
entity_id: binary_sensor.doorbell
from: Closed
to: Open
condition:
- condition: time
after: '06:30:00'
before: '22:00:00'
action:
- service: notify.husband
data:
title: doorbell rang
message: someone is at the door
- data:
entity_id: switch.doorbell_notify
service: switch.turn_on
- delay:
seconds: '5'
- data:
entity_id: switch.doorbell_notifiy
service: switch.turn_off
A couple things to note regarding the above yaml
-
the two triggers were to try and capture either of the state changes since they happen so quickly (might not matter, but I’ve tried).
I’ve tried just from open to closed and from closed to open separately. Neither triggers work. -
the capital letters Open and Closed are how it shows up in my states UI. I’ve tried them as lowercase as well and this also didn’t trigger the automation. I’ve also tried them inside single quotation marks ie ‘open’ and ‘closed’ and ‘Open’ and ‘Closed’
Also note that I’ve tried “to: Closed” without the “from”
to: Closed
- in case you are wondering about the switch that turns on, delays and then turns off. This is a virtual switch through my isy994i changes an isy variable that in turn triggers an Alexa routine. This is my Alexa workaround since I paid for the network portal for the isy before I began using Home Assistant. This works fine when manually triggering the virtual switch in Lovelace.
I’ve searched some other topics regarding this and it usually seems to be a yaml error. As you can see I’ve tried numerous permutations of the trigger and none seem to work.
The state change from open to closed and back to open happens super quickly, but I would think that HA would still register the change and trigger the automation.
Anyone see an error that I’m missing? or something else entirely?
edit: for clarity