Stored_traces

On https://www.home-assistant.io/docs/automation/yaml is described how to set number of stored_traces
The description does however not match the strucrure of my automation yaml file. I remember that the structure was change some time back, but I cannot figure out how to use the example in the new structure.
Can some body provide an example which new example ?
Should the help page not be updated ? How to initiate that ?

What do you mean by the above statement? By default, the stored_traces entry will not be present in an automation, since it will be using the default of 5. You simply need to add the below to override it. Just make sure your indentation is correct:

alias: "Automation Name"
trace:
  stored_traces: 10
triggers:

The example in the docs shows the automation: header because it refers to automations written directly in automations.yaml. If you’re editing an automation in the UI by switching to yaml mode, then that header will not be there, and everything will need to be indented back by a couple of spaces, like my example.

This other doc makes it slightly more clear.

The example at the linked page uses

 
- alias: "Automation Name"

That is not what I see when I switch to edit the automation in yaml, i see

alias: Periodically optimize export
description: ""
triggers:

I see no dash in front of the alias and I could not figure out have to add the stored _traces line. Should this not be described on the man page ?

I got it to work now, I am confused by the dash and hwo to indent the traces.
I gave it a try again and this time it accepted it, I dont know what I did wrong the first time. The traces: and the stored_traces are however pushed to the end of the automation yaml whe i save, but I guess that is ok.

Don’t worry about that part. The actual order doesn’t matter in yaml (unless indentation is involved.

The reason you saw a dash in front of the alias in the example, is that is an example of a single automation in an entire list of automations. Again, that only applies if you are managing your automations via automations.yaml - viewing the automation via GUI and switching to yaml mode will only show you the code for a single automation, therefore there will be no - to represent a list.