Automation Editor Breaks YAML Lists

Hello! I’m very new to HASS and was playing around with automations.

My first automation worked great, but suddenly stopped working and was driving me up a wall!

I found out that it was because when using lists in yaml, the editor will convert those from yaml lists to a comma separated string, which breaks the trigger. Is this a known bug, or is there a work around or setting to prevent it? Or are yaml lists not preferred?

In my example, I was using my smart phone state as a trigger; This is what works in yaml for a trigger:

trigger:
  - platform: state
    entity_id: sensor.my_phone_phone_state
    from: idle
    to: 
      - ringing
      - offhook

I save this automation, and when I leave and go back into the automation editor its changed to:

trigger:
  - platform: state
    entity_id: sensor.my_phone_phone_state
    from: idle
    to: 'ringing,offhook'

Which if saved, does not work and the automation no longer triggers.

try wrapping each entry in the list in quotes:

trigger:
  - platform: state
    entity_id: sensor.my_phone_phone_state
    from: idle
    to: 
      - "ringing"
      - "offhook"

Same thing, those are wrapped in quotes and it works when saved, but if you edit the automation again via the UI it changes to a comma separated string. Going into the YAML you see the YAML list is gone and its a string like shown in the UI.

I can work around this by using distinct triggers for ringing/offhook but it would be cleaner if the YAML list stayed.

Yet, another reason to avoid the UI editors.

I think I’m up to about 100 reasons now and counting. :wink:

Agreed! Is there a way to disable the UI editor, or switch it to YAML only?

Just don’t use it.

in your configuration.yaml put the following:

automation yaml: !include automations_yaml.yaml

then create that file in your config directory.

After that you can write all of your yaml automations in that file while still keeping all of your other UI based automations in the automations.yaml file.