Automation for managing alarm entities

Hi.

I’m trying to manage all the alarm entities and my alarm device, from two different sources:

  • Alarm card, in the front end (both home_alarm and alexa_guard ones)
  • RF remotes, monitored from the binary_sensor.alarm_armar

This automation:

- alias: 'Gere o estado do alarme'
  trigger:
    - platform: state
      entity_id: binary_sensor.alarme_armar
    - platform: state
      entity_id: alarm_control_panel.home_alarm, alarm_control_panel.alexa_guard_9fc9e
  condition:
    condition: or
    conditions:
    - condition: template
      value_template: >
        {% set usefull_states = 'on', 'off' %}
        {{ states('binary_sensor.alarme_armar') in usefull_states }}
    - condition: template
      value_template: >
        {% set usefull_states = 'disarmed', 'armed_away', 'armed_night' %}
        {{ states('alarm_control_panel.home_alarm') in usefull_states }}
    - condition: template
      value_template: >
        {% set usefull_states = 'disarmed', 'armed_away' %}
        {{ states('alarm_control_panel.alexa_guard_9fc9e') in usefull_states }}
  action:
    - service_template: >
          {% if is_state('binary_sensor.alarme_armar', "on") and trigger.entity_id == binary_sensor.alarme_armar %}
            alarm_control_panel.alarm_arm_away
          {% elif is_state('binary_sensor.alarme_armar', "off") and trigger.entity_id == binary_sensor.alarme_armar %}
            alarm_control_panel.alarm_disarm
          {% else %}
             broadlink.send
          {% endif %}
      data_template: >
          {% if trigger.entity_id == binary_sensor.alarme_armar %}
            {{ entity_id:
               - alarm_control_panel.house_alarm
               - alarm_control_panel.alexa_guard_9fc9e }}
          {% else %}
            {{ host: !secret broadlink_host
               packet: !secret automation_alarm_rf_broadlink }}
          {% endif %}

Gets this error:

Invalid config for [automation]: expected a dictionary for dictionary value @ data['action'][0]['data_template']. Got None. (See /config/configuration.yaml, line 2584). Please check the docs at https://home-assistant.io/integrations/automation/

Could get some help, please?

Thanks.

Which line is 2584? That’s where it is telling you the issue is.

Hi.

That line is the start of my automations.yaml file. Removing this piece of yaml it passes the check.

Even on the templating page, the error remains.

Thanks.