How do I get HA to leave my formatting alone?

I am having formatting problems with script.yaml, tts and ssml.

When using the GUI, from time to time HA apparently thinks it’s a good idea to reformat scripts.yaml to around 80 characters.
I redid the formatting of two of my scripts in a “external editor” (file editor from add ons store) that reside within script.yaml and everything saved and re-read as expected with the same formatting.

I redid parts of my script/automation that called/used previous, other, formatted scripts and later on when I re-opened scripts.yaml the formatting I hade done was undone again.

This screws up my TTS syntax with SSML and makes the script more or less unreadable.

How do I get around this and get HA to leave my script formatting alone?

I still would like to be able to call/add/use the formatted scripts from the GUI but doing so seems to give HA carte blanche to reformat said script =(

Add the following to configuration.yaml:

script my_yaml_scripts: !include my_yaml_scripts.yaml

Then make a file called my_yaml_scripts.yaml and put them in there.

You’ll no longer be able to edit those scripts in the UI but HA won’t touch their formatting.

scripts.yaml is intended only to be modified by the UI, not in a text editor. As such it gives you no control over the formatting. The reasons for this are technical but basically for each script you either need to choose between ability to use the GUI editor or full control over formatting in YAML. You can’t have both.

But I can still “call” the scripts from my_yaml.scripts.yaml from the GUI (tested and verified) and that is good enough for me.

Thanks, you have hopefully saved me alot of headache and time

1 Like