Alert component: how to remove it from the configuration.yaml

Hello all,

I’ve been using HA for some time now and all the configurations and customizations are rather easy to do just reading the documentation or using Google. :slight_smile:

But now i’m trying to use the alert: component but i’m getting stuck with the sintax.
In my general config, i try to put all that i can outside of the configuration.yaml file, each component in a .yaml file.
This is working without any problems on most (sensors, cameras, binary_sensor, etc). If i put the configuration on the main file (configuration.yaml), it works perfectly, but on a seperate file is giving me an error (and i’ve tried several combinations os formating the text:

Configuration.yaml (works without problems):

alert:
  3d_printer:
    name: 3D Printer Idle
    message: "WARNING: 3D Printer a consumir {{ states('sensor.shelly_tomada_3d_current_consumption') | float}} W mas sem jobs."
    done_message: "INFO: 3D Printer desligada."
    entity_id: binary_sensor.3d_on_no_print
    state: 'on'
    repeat:
      - 15
      - 30
      - 60
    can_acknowledge: true
    skip_first: false
    notifiers:
      - bmad_telegram
      - bmad_iphone

Trying to get it on a seperate file:
file Configuration.yaml:
alert: !include_dir_list entities/alerts/

file entities/alerts/3d_on.yaml:

3d_printer:
  name: 3D Printer Idle
  message: "WARNING: 3D Printer a consumir {{ states('sensor.shelly_tomada_3d_current_consumption') | float}} W mas sem jobs."
  done_message: "INFO: 3D Printer desligada."
  entity_id: binary_sensor.3d_on_no_print
  state: 'on'
  repeat:
    - 15
    - 30
    - 60
  can_acknowledge: true
  skip_first: false
  notifiers:
    - bmad_telegram
    - bmad_iphone

The error i get when verifying the config is:

Invalid config for [alert]: expected dictionary for dictionary value @ data[‘alert’]. Got [OrderedDict([(‘3d_printer’, OrderedDict([(‘name’, ‘3D Printer Idle’), (‘message’, “WARNING: 3D Printer a consumir {{ states(‘sensor.shelly_tomada_3d_current_consumption’) | float}} W mas sem jobs.”), (‘done_message’, ‘INFO: 3D Printer desligada.’), (‘entity_id’, ‘binary_sensor.3d_on_no_print’), (‘state’, ‘on’), (‘repeat’, [15, 30, 60]), (‘can_acknowledge’, True), (‘skip_first’, False), (‘notifiers’, [‘bmad_telegram’, ‘bmad_iphone’])]))])]. (See ?, line ?).

What am i doing wrong?? Thanks for the help,

Alerts aren’t lists. They are named dictionaries. Lists start with a dash (-) like in automations, sensors, switches.

Named dictionaries don’t start with a dash. Like in scripts, groups and alerts

try this instead:

alert: !include_dir_merge_named entities/alerts/

Many thanks!! Worked like a charm. :slight_smile:

1 Like