I’m trying to make a simple alarm system with Xiaomi gateway a door sensor and a wireless switch.
The thing I’m trying to achieve :
Press single click, set alarm after 60 seconds.
Door open -> wait 10 seconds -> trigger alarm for 10 minutes or until disarmed with long press.
It kinda works, I found 1 problem with it, after 5-6 seconds, the gateway stops playing the alarm ringtone. HA stays it is in “triggered” state and I can see it is alarming, but sound stops. Tried to increase trigger_time but no sound at all.
configuration.yaml
alarm_control_panel:
- platform: manual
name: HAalarm
automations.yaml
- alias: Alarm - Away
trigger:
# alarm on fire
- platform: state
entity_id: binary_sensor.smoke_sensor_158d0001xxxxxx
to: 'on'
# door opened
- platform: state
entity_id: binary_sensor.door_window_sensor_158d0001xxxxxx
to: 'on'
# motion detected
- platform: state
entity_id: group.all_motion
to: 'on'
condition:
- condition: state
entity_id: alarm_control_panel.haalarm
state: armed_away
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.haalarm
- alias: Alarm!
hide_entity: true
trigger:
- platform: state
entity_id: alarm_control_panel.haalarm
to: 'triggered'
action:
- service: xiaomi_aqara.play_ringtone
data:
gw_mac: 34CE009xxxxx
ringtone_id: 2
ringtone_vol: 2
####################################################################################################
- alias: Disarm
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001xxxxxx
click_type: long_click_press
action:
- service: xiaomi_aqara.play_ringtone
data:
ringtone_id: 11
ringtone_vol: 1
gw_mac: 34CE009xxxxx
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.haalarm
- alias: Disarm!
hide_entity: true
trigger:
- platform: state
entity_id: alarm_control_panel.haalarm
to: 'disarmed'
action:
- service: xiaomi_aqara.stop_ringtone
data:
gw_mac: 34CE009xxxxx