Trying to make some alarm automations with my Aqara door sensors, but it will not trigger the automations and I can not understand why. Automations triggers when I do them directly from HA, but when I open door nothing happens.
Hopefully some of you can see what I am doing wrong here.
- id: '1595944448528'
alias: Test alarm NYTT panel
description: test av alarm
trigger:
- entity_id: binary_sensor.openclose_3
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: alarm_control_panel.alarm
state: arm_home
- condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarm
state: arm_away
action:
- data: {}
entity_id: alarm_control_panel.alarm
service: alarm_control_panel.alarm_trigger
mode: single
- id: '1595945146903'
alias: Trigger alarm
description: ''
trigger:
- entity_id: alarm_control_panel.alarm
platform: state
to: triggered
condition: []
action:
- data:
message: Stue åpnet!
title: ALARM STUE!
service: notify.mobile_app_iphone
mode: single
Don’t understand your condition on the first one. The way it’s indented suggests that the overall condition is always false, as the arm_home is not under the condition: or but at the top level (see docs).
I suspect you mean:
condition:
condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarm
state: arm_home
- condition: state
entity_id: alarm_control_panel.alarm
state: arm_away
…and with 0.113 you can do this instead:
condition:
condition: state
entity_id: alarm_control_panel.alarm
state:
- arm_home
- arm_away
Have you checked that the state of the sensor is working via Developer Tools / States?
Thanks, changed the code now. Also checked the sensor, and it shows on when door is opened, and off when door is closed. But still does not trigger the automation.
My new code is now:
- id: '1595944448528'
alias: Test alarm NYTT panel
description: test av alarm
trigger:
- entity_id: binary_sensor.openclose_3
from: 'off'
platform: state
to: 'on'
condition:
- condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarm
state: arm_away
- condition: state
entity_id: alarm_control_panel.alarm
state: arm_home
action:
- data: {}
entity_id: alarm_control_panel.alarm
service: alarm_control_panel.alarm_trigger
mode: single
- id: '1595945146903'
alias: Trigger alarm
description: ''
trigger:
- entity_id: alarm_control_panel.alarm
platform: state
to: triggered
condition: []
action:
- data:
message: Stue åpnet!
title: ALARM STUE!
service: notify.mobile_app_iphone
mode: single