Configuration.yaml - seems I'm missing something here

Hello there,

Seems I don’t know completelly how to make automations in YAML. I took example configuration for lights from here:


(example is at bottom)

Then I pasted it to my automation changing only entity_id to match mine of course.

When I hit “Save” I got this:

Not mentioning that values for brightness and kelvin should be in [brackets] and in example on official HA page they are not.

Also if I create new empty automation and click “Edit as YAML” on top right of screen the script looks completelly different than in official documentation. Whole structure is different - looking like this:

alias: New automation
description: ''
mode: single
trigger:
  - platform: device
    device_id: ''
    domain: ''
    entity_id: ''
condition: []
action:
  - device_id: ''
    domain: ''
    entity_id: ''

Please tell me is official documentation wrong or I’m stupid and missing something here. It makes me real frustrated.

The example clearly says “example configuration.yaml entry”

There’s two takeaways from that. First is that it’s an example, and the second is that this particular example would go in the configuration.yaml, but you’re trying to put it in automations.yaml.

Please read up on basic yaml for homeassistant and basic configuration splitting before proceeding.

Not mentioned because they should not be in brackets. The two options expect integer values, not lists.

1 Like

Hi Jakub,

the YAML you pasted has a few flaws and the documentation is meant for a pure YAML-file configuration with a text editor.

This is not obvious to people that joined after the introduction of the GUI configuration possibilities.

  1. The key automation: is not allowed here since you are already in the context of automations in the GUI.
  2. The key trigger: is missing other keys and values, also the example you are referring to has something in there.

What keeps you from using the GUI editor?
If it’s just the brightness and kelvin options in the action:, you can just edit the action as YAML via the 3-dot menu:

Hope that helps you to sort things out.

1 Like

During the copy-paste operation, somehow you lost the example’s trigger section. Without it, the automation monitors nothing so is never activated by anything.

Well… if I put value without brackets it’s mared on red as error:

image

While when using brackets:

image

I didn’t used any trigger on purpose. I just wanted to check if automation will be done when fired up manually from automations configuration.

I didn’t used any trigger on purpose. I just wanted to check if automation will be done when fired up manually from automations configuration.

When you manually execute an automation, it skips the automation’s trigger and condition (so there’s no need to leave out the trigger section).

No, it’s red because that’s the color it uses in Dark Theme (a misguided design choice) whereas it’s orange in Light Theme.

Ah OK. The color was confusing. Thank you :slight_smile:

You’re right. I didn’t realize the difference between automation.yaml and configuration.yaml.

Thank you.

BTW… why when I hit reply to your message and post it you’re original message is not quoted before mine reply?

This is solved different in this Forum implementation. It is there but “collapsed”.
If you click on the person you responded to:

His/Her message is expanded: