Why looks automations created with Editor so strange?

Hi,

a few versions ago I converted all my automations to fit the Automation Editor. I works “ok” for me, but sometimes I have to edit the automation manually in the automations.yaml.
Why looks the automations created with the editor so illogical.
The ID is somewhere in the middle.
The action at the beginnen…nearly everything is mixxed.

This is what the editor does:

- action:
  - alias: Schalte Luftbefeuchter Schlafzimmer aus
    data:
      entity_id: switch.luftbefeuchter_schlafzimmer
    service: switch.turn_off
  alias: Luftbefeuchter Schlafzimmer aus Regel
  condition: []
  id: Luftbefeuchter Schlafzimmer aus Regel
  trigger:
  - above: '54'
    entity_id: sensor.humidity_158d0001720bba
    for:
      hours: 0
      minutes: 10
      seconds: 0
    platform: numeric_state

This is how I would do this.

- id: Luftbefeuchter Schlafzimmer aus Regel
  alias: Luftbefeuchter Schlafzimmer aus Regel
  trigger:
    platform: numeric_state
    entity_id: sensor.humidity_158d0001720bba
    above: '54'
    for:
      hours: 0
      minutes: 10
      seconds: 0
  action:
    alias: Schalte Luftbefeuchter Schlafzimmer aus
    service: switch.turn_off
    data:
      entity_id: switch.luftbefeuchter_schlafzimmer

Bigger Automations looks a far more confusing.
Hope this can be changed in future HA versions.

2 Likes

Yeah, I agree, would be nice if it would organise them in the readable format we’re used to, if nothing else it’s easier to help people when their automation doesn’t work if we can actually read it.

2 Likes

Again. Look at this.

Automation I did. Clean and readable.

- id: Weihnachtsstern 
  alias: Weihnachtsstern
  trigger:
    - platform: sun
      event: sunset
      offset: "-01:00:00"
    - platform: time
      at: "16:08"
  action:
    service_template: >
      {% if trigger.event == "sunset" %}
      homeassistant.turn_on
      {% else %}
      homeassistant.turn_off
      {% endif %}
    entity_id: switch.weihnachtsstern

What the editor did after saving.

- id: Weihnachtsstern
  alias: Weihnachtsstern
  trigger:
  - platform: sun
    event: sunset
    offset: -00:01:00
  - platform: time
    at: '20:00'
  action:
    service_template: '{% if trigger.event == "sunset" %} homeassistant.turn_on {%
      else %} homeassistant.turn_off {% endif %}

      '
    entity_id: switch.weihnachtsstern

WHY?

looking for the same answer

1 Like