Hi all. I’m pretty new to Home Assistant. I currently have an automation which disarms my Yale smart sync alarm when my yale conexis door handle is unlocked. However, I want that to only happen if it detects my phone or my wife’s phone in the home zone. Ive added a condition, however, I can only make it work with 2 presence sensors or none at all. I have to add conditions that trigger the automation if it detects both mine and wife’s phone in home zone. At present, the conditions are my presence sensor and wife’s presence sensor should be home. This makes the automation only work if we’re both home. However, I want it to work so the automation works if it detects either of our phones. For example, I could be at work but wife comes home from work and the automation should still work. How can I do this? Hope that makes sense!
Post the automation you created (as formatted YAML code).
Sorry! Forgot to do that. Here it is:
alias: Alarm disarm when door unlocked
description: Disarm the alarm once the door handle is unlocked
trigger:
- platform: state
entity_id: lock.yale_door_lock
from: locked
to: unlocked
condition:
- condition: state
entity_id: alarm_control_panel.yale_smart_alarm
state: armed_away
- condition: state
entity_id: binary_sensor.amina_s_s21_ultra_presence
state: home
- condition: state
entity_id: binary_sensor.rayhaan_s_galaxy_note20_ultra_5g_presence
state: home
action:
- service: alarm_control_panel.alarm_disarm
data: {}
target:
entity_id: alarm_control_panel.yale_smart_alarm
mode: single
I think the problem is that the way you have structured your conditions then all these must be true for the action to get executed (your list of conditions is an implied ‘AND’).
Try changing this to an ‘OR’ condition as shown in the docs:
Ahh that makes sense! I have updated it like this. Is this correct?
alias: Alarm disarm when door unlocked
description: Disarm the alarm once the door handle is unlocked
trigger:
- platform: state
entity_id: lock.yale_door_lock
from: locked
to: unlocked
condition:
- condition: state
entity_id: alarm_control_panel.yale_smart_alarm
state: armed_away
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.amina_s_s21_ultra_presence
state: home
- condition: state
entity_id: binary_sensor.rayhaan_s_galaxy_note20_ultra_5g_presence
state: home
action:
- service: alarm_control_panel.alarm_disarm
data: {}
target:
entity_id: alarm_control_panel.yale_smart_alarm
mode: single
Not quite. You appear to have the AND/OR logic stated correctly but the normal valid states for a binary_sensor
are on
or off
and not home
or not_home
(which would be valid states for a device_tracker
entity).
Is presence for your phone represented as a binary_sensor
or a device_tracker
?
NOTE
The entity states you see in Developer Tools > States are the correct states to use in Triggers, Conditions, etc. The ones you see in the Lovelace UI might be different if the entity has a device_class
attribute.
For example, a binary_sensor
whose device_class
is set to door
will display Open
or Closed
in the UI but its actual state remains either on
or off
.
Thank you. They are binary sensors. I have changed it to on and off. It is working perfectly now. Thank you both so much!