Alert syntax not clear - not working

Hey there,
I run a hass --script check_config
and do get the error:

2017-11-26 17:13:41 ERROR (MainThread) [homeassistant.config] Invalid config for [alert]: expected a dictionary for dictionary value @ data['alert']. Got [OrderedDict([('Schlafzimmer_Fenster_offen', OrderedDict([('name', 'Offenes Fenster im Schlafzimmer Alert'), ('entity_id', 'binary_sensor.schlafzimmer_cold_outside'), ('state', 'on'), ('repeat', [30, 5]), ('can_acknowledge', True), ('skip_first', 'true'), ('notifiers', ['iOS_iphone'])]))]), OrderedDict([('Bad_Fenster_offen', OrderedDict([('name', 'Offenes Fenster im Bad Alert'), ('entity_id', 'binary_sensor.bad_cold_outside'), ('state', 'on'), ('repeat', [30, 5]), ('can_acknowledge', True), (.... (See /home/homeassistant/.homeassistant/configuration.yaml, line 316). Please check the docs at https://home-assistant.io/components/alert/
2017-11-26 17:13:41 ERROR (MainThread) [homeassistant.setup] Setup failed for alert: Invalid config.

My config in configraiton.yaml looks like:
alert: !include alerts.yaml

and the alerts.yaml contains:

#alert:
      - Schlafzimmer_Fenster_offen:
          name: Offenes Fenster im Schlafzimmer Alert
          entity_id: binary_sensor.schlafzimmer_cold_outside
          state: 'on'
          repeat:
            - 30
            - 5
          can_acknowledge: True
          skip_first: 'true'
          notifiers:
            - iOS_iphone
      - Bad_Fenster_offen:
          name: Offenes Fenster im Bad Alert
          entity_id: binary_sensor.bad_cold_outside
          state: 'on'
          repeat:
            - 30
            - 5
          can_acknowledge: True
          skip_first: 'true'
          notifiers:
            - iOS_iphone
      - Buero_Fenster_offen:
          name: Offenes Fenster im Buero Alert
          entity_id: binary_sensor.buero_cold_outside
          state: 'on'
          repeat:
            - 30
            - 5
          can_acknowledge: True
          skip_first: 'true'
          notifiers:
            - iOS_iphone

You need to remove the alert: line from the include file, and align everything else back to the left, keeping the formatting the same, but removing the hyphens…

Schlafzimmer_Fenster_offen:
  name: Offenes Fenster im Schlafzimmer Alert
  entity_id: binary_sensor.schlafzimmer_cold_outside
  state: 'on'
  repeat:
     - 30
     - 5
   can_acknowledge: True
   skip_first: 'true'
   notifiers:
      - iOS_iphone
Bad_Fenster_offen:
  name: Offenes Fenster im Bad Alert
  entity_id: binary_sensor.bad_cold_outside
  state: 'on'
  repeat:
    - 30
    - 5
  can_acknowledge: True
  skip_first: 'true'
  notifiers:
     - iOS_iphone
Buero_Fenster_offen:
  name: Offenes Fenster im Buero Alert
  entity_id: binary_sensor.buero_cold_outside
  state: 'on'
  repeat:
      - 30
      - 5
    can_acknowledge: True
    skip_first: 'true'
    notifiers:
        - iOS_iphone

(please note I’ve edited that on my phone so there may be a stray space or two)

The result of alerts.yaml

Schlafzimmer_Fenster_offen:
  name: Offenes Fenster im Schlafzimmer Alert
  entity_id: binary_sensor.schlafzimmer_cold_outside
  state: 'on'
  repeat:
    - 30
    - 5
  can_acknowledge: True
  skip_first: 'true'
  notifiers:
    - iOS_iphone
Bad_Fenster_offen:
  name: Offenes Fenster im Bad Alert
  entity_id: binary_sensor.bad_cold_outside
  state: 'on'
  repeat:
    - 30
    - 5
  can_acknowledge: True
  skip_first: 'true'
  notifiers:
    - iOS_iphone
Buero_Fenster_offen:
  name: Offenes Fenster im Buero Alert
  entity_id: binary_sensor.buero_cold_outside
  state: 'on'
  repeat:
    - 30
    - 5
  can_acknowledge: True
  skip_first: 'true'
  notifiers:
    - iOS_iphone

hass --script check_config is telling me:

2017-11-26 18:33:49 ERROR (MainThread) [homeassistant.config] Invalid config for [alert]: [Schlafzimmer_Fenster_offen] is an invalid option for [alert]. Check: alert->alert->Schlafzimmer_Fenster_offen. (See /home/homeassistant/.homeassistant/configuration.yaml, line 316). Please check the docs at https://home-assistant.io/components/alert/
2017-11-26 18:33:49 ERROR (MainThread) [homeassistant.setup] Setup failed for alert: Invalid config.

You might have to take the capital letters out of the first line of each alert (the lines that are all the way across to the left) , some components don’t like it for some reason.

Thanks.
now working. Important was NO capital Letters and no blanks in the first line.

How would I change the syntax of each Alert when I change from

alert: !include alerts.yaml
where I have one file inlcuding all alerts to a more individual solution to have one yaml for every alert. So a change to

alert: !include_dir_merge_named Alerts
with files like:
schlafzimmer_fenster_offen.yaml
bad_fenster_offen.yaml
buero_fenster_offen.yaml

created a directory Alerts and created three individual files
schlafzimmer_fenster_offen.yaml

schlafzimmer_fenster_offen:
  name: Offenes Fenster im Schlafzimmer Alert
  entity_id: binary_sensor.schlafzimmer_cold_outside
  state: 'on'
  repeat:
    - 30
    - 5
  can_acknowledge: True
  skip_first: 'true'
  notifiers:
    - iOS_iphone

bad_fenster_offen.yaml

bad_fenster_offen:
  name: Offenes Fenster im Bad Alert
  entity_id: binary_sensor.bad_cold_outside
  state: 'on'
  repeat:
    - 30
    - 5
  can_acknowledge: True
  skip_first: 'true'
  notifiers:
    - iOS_iphone

buero_fenster_offen.yaml

buero_fenster_offen:
  name: Offenes Fenster im Buero Alert
  entity_id: binary_sensor.buero_cold_outside
  state: 'on'
  repeat:
    - 30
    - 5
  can_acknowledge: True
  skip_first: 'true'
  notifiers:
    - iOS_iphone

hass --script check_config
does run through without issues. Let’s see if it is working after my new start of HA

2 Likes

it is working !

1 Like