Just getting started with Home Assistant automations… I’m using the aarlo integration and have been able to get this setup correctly. However with the newer Arlo cameras, they all appear as separate alarm panel entities. I am trying to create a manual alarm panel that has 4 modes [arm_away, arm_home, arm_night, disarm]
and then map each of those modes to a different set of the aarlo alarm panel entities. Something like this:
Desired mapping:
home_alarm.state = disarmed -> camera1=disarmed, camera2=disarmed, camera3=disarmed
home_alarm.state = arm_home -> camera1=armed, camera2=disarmed, camera3=disarmed
home_alarm.state = arm_night -> camera1=armed, camera2=armed, camera3=disarmed
home_alarm.state = arm_away -> camera1=armed, camera2=armed, camera3=armed
Here is the config I have now.
configuration.yaml:
alarm_control_panel:
- platform: aarlo
away_mode_name: armed
home_mode_name: armed
night_mode_name: armed
trigger_time: 30
alarm_volume: 8
- platform: manual
name: Home Alarm
code: !secret alarm_code
automations.yaml:
- id: "1630711012673"
alias: Arlo State
description: Arm/Disarm the Arlo Cameras based on the main alarm state
trigger:
- platform: state
entity_id: alarm_control_panel.home_alarm
to: arm_home
- platform: state
entity_id: alarm_control_panel.home_alarm
to: arm_away
- platform: state
entity_id: alarm_control_panel.home_alarm
to: arm_night
- platform: state
entity_id: alarm_control_panel.home_alarm
to: disarm
action:
- service: alarm_control_panel.alarm_arm
data_template:
entity_id: >
{% if trigger.to_state == \"arm_home\" %}
alarm_control_panel.aarlo_camera1
{% else if trigger.to_state == \"arm_night\" %}
alarm_control_panel.aarlo_camera1,
alarm_control_panel.aarlo_camera2
{% else if trigger.to_state == \"arm_away\" %}
alarm_control_panel.aarlo_camera1,
alarm_control_panel.aarlo_camera2,
alarm_control_panel.aarlo_camera3
{% endif %}
- service: alarm_control_panel.alarm_disarm
data_template:
entity_id: >
{% if trigger.to_state == \"arm_home\" %}
alarm_control_panel.aarlo_camera2,
alarm_control_panel.aarlo_camera3
{% else if trigger.to_state == \"arm_night\" %}
alarm_control_panel.aarlo_camera3
{% else if trigger.to_state == \"disarm\" %}
alarm_control_panel.aarlo_camera1,
alarm_control_panel.aarlo_camera2,
alarm_control_panel.aarlo_camera3
{% endif %}
mode: single
However I can’t seem to get this working right. Maybe an automation isn’t the right way to go?
When I attempt to switch the home_alarm
to arm_away
, then I get the following error:
2021-09-08 08:30:45 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: invalid template (TemplateSyntaxError: unexpected char '\\' at 26) for dictionary value @ data['action'][0]['data_template']. Got None. (See /config/configuration.yaml, line 8).
In this came config, I’m also looking for a way to transition from one armed state to another. From the lovelace alarm panel, when the home_alarm
manual alarm entity is set to any of the armed states, the only available option is to disarm. Is there a way to have the other arm states available as choices when the panel is already armed?
Is there a better way to do this?