Please help with what i hope is a simple issue. I have 2 binary door sensors which show in the UI as Open or Closed. I have tried both an automation and an alert that will send an ios_notification to my device.
If i manually trigger the automation then the notification is sent to my ios device but if i Open the sensor i do not get a notification.
I would ideally like to use the alert method (config below)
back_door:
name: Back Door is open
done_message: Back Door is closed
entity_id: binary_sensor.back_door_sensor
state: 'Open'
repeat: 30
can_acknowledge: true
skip_first: false
notifiers:
- ios_id (real ID removed)
If i am not able to get the alert to work then the automation would also do the trick (config below)
- alias: 'Back Door Notify'
trigger:
- platform: state
entity_id: binary_sensor.back_door_sensor
to: 'Open'
condition:
- condition: state
entity_id: device_tracker.device (real ID removed)
state: 'not_home'
action:
service: notify.ios_ID (removed)
data:
title: "Smart Home Alert"
message: "Back Door has been opened!"
data:
subtitle: "Is anyone home?"
I cant for the life of me work this out.
Please help
Your binary_sensors are indicating Open and Closed in the Lovelace UI but that’s because you probably defined them using:
device_class: door
That option presents the binary_sensor’s state in a more meaningful way (Open/Closed, Disconnected/Connected, Wet/Dry, etc). However, a binary_sensor’s two actual states are on and off.
When referring to a binary_sensor’s state in a template, regardless of its device_class, the state is either on or off.
You’ve instructed the Alert to monitor the state of binary_sensor.back_door_sensor so that when it changes to Open the Alert will be activated. As per my explanation above, the binary_sensor state you want to detect is on and not Open.
alert:
rear_door:
name: Rear Door is open
done_message: Rear Door is closed
entity_id: binary_sensor.rear_door
state: 'on'
repeat: 1
can_acknowledge: true
skip_first: false
notifiers:
- test_file_notify
I opened Rear Door, left it open for few minutes, then closed it. Here’s what was recorded in file_notify.txt:
2019-10-18T19:36:33.680448+00:00 Rear Door is open
2019-10-18T19:37:34.009737+00:00 Rear Door is open
2019-10-18T19:38:35.014560+00:00 Rear Door is open
2019-10-18T19:39:19.575631+00:00 Rear Door is closed
It demonstrates the Alert is functioning properly and reporting the door is open every minute as per its configuration.
EDIT
Perhaps the issue you are experiencing has something to do with how the Alert is interacting with the iOS notifier?
Thanks again for your responses. It gives me a good place to start. The automation will get me going for now and I will take a look at the alert going forwards.
Sorry to jump in on an old thread, but was interested in the response time for the Hive door sensor states changing in HA? Looking to get a few in the sale but didn’t want to be waiting too long for the state to be updated. Thanks