Add custom fields in automation.yaml file

How can we add custom fields in the yaml file for automation? I’m​ getting “extra keys are not allowed @ …” error when i try to add one.

Post the whole error message, and maybe the code that’s causing the error, and/or give us a clue what you’re trying to achieve?

I suspect that the data: key is more-friendly to accepting extra keys. Have you tried grouping your custom fields there?

  data:
    value1: this
    value2: that

Please find the below image containing the code (highlighted custom attributes that are need to be added) and the error.

Also, I’m little doubtful if whether the “data” attribute is platform specific too?

No, I haven’t tried that part yet. Will try that too. Thanks.

I might be totally off track here, but aren’t switches just ‘on’ or ‘off’? What is the extra data for?

Yea. But i need to store some custom data that is used in the custom front-end panel screen. Thanks.

Figured it out. I just had to add those keys as properties for the automation in the _init.py file. Anyways, Thank you guys.

1 Like