Hi all, I am trying to find a way to use only one trigger to arm or disarm Alarmo, something like a toggle arm/disarm action but can’t seem to find a solution. What I would like to achieve is to have one NFC tag at the entrance of the house so I can scan it and depending the current status of Alarmo (armed or disarmed) it would change to the other. Anyone has any idea how to do that?
You should be able to get what you want from this:
Scripts:
alarm_arm_instant:
sequence:
- service: alarmo.arm
data:
entity_id: alarm_control_panel.alarmo
code: !secret alarm_code
mode: away
skip_delay: true
alarm_disarm:
sequence:
- service: alarmo.disarm
data:
entity_id: alarm_control_panel.alarmo
code: !secret alarm_code
Automation:
- id: 50eaa8f9-0caa-40c3-b095-c584e94cc7ea
alias: 'RFID Valid'
trigger:
- platform: state
entity_id: binary_sensor.red_keys
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.yellow_keys
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.main_keys
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.spare_keys
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.black_disc
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.rfid_ring
from: 'off'
to: 'on'
action:
- service: >
{% if is_state('alarm_control_panel.alarmo', 'disarmed') %}
script.alarm_arm_instant
{% else %}
script.alarm_disarm
{% endif %}
- service: camera.snapshot
data:
entity_id: camera.front_camera_sub_2
filename: '/config/www/snapshots/front_rfid.jpg'
- service: notify.telegram_general
data:
message: ' '
data:
photo:
- file: /config/www/snapshots/front_rfid.jpg
caption: '{{trigger.to_state.name}} detected.'
- service: mqtt.publish
data:
payload: '{{trigger.to_state.name}}'
topic: 'home-assistant/variable/last_rfid'
retain: true
- delay: 3