While editing automations.yaml with Studio Code Server it shows the message:
String does not match the pattern of “LEGACY_SYNTAX^”
next to lines like:
platform: state
platform: device
Why is it complaining? How to fix?
Update:
I found that the legacy syntax issues will be fixed automatically, when the automation is (slightly) changed via the automation editor and then saved. The change then can be undone and the automation saved again.
I have a blog post and a video if you want to know more thru my process in fixing these, and yes, it you open in the ui editor and save, it will fix it all. I didn’t use that.
Most of it I already fixed yesterday, but I learned from you, that also condition has changed to conditions.
Strangely the editor didn’t complain about that, but it is now fixed, too.
Thanks for the question and answer! Just getting into proper HA programming. This was a top Google result, and solved an issue immediately. That balances out that other issues are taking way longer than expected.
Hmmm this page is not available to me. Can you please just put here a summary or maybe a link how to fix these errors?
Mine is like this
input:
motion_sensor:
name: Motion Sensor
description: The motion sensor that triggers the snapshots
selector:
entity:
domain: binary_sensor << and here is the exact same error
Nothing in that code quote has YAML affected by this change.
What exactly is not available to you?
The legacy syntax warning is telling you your code works, but you are using a legacy way of doing it not the modern way.
The code in that box is legacy and was changed years ago.
Thank you. I’ll checkit. I just started this Blueprint journey so I’m a bit lame Do you know any useful tool for exmple for vs-code which helps avoiding such issues and can speed up blueprint development?
It’s a confusing error because it says the pattern does not match legacy syntax, when the error actually is that we are using legacy syntax. Got me caught up and confused as well.
Right now it is working as intended-ish. I believe this will change in the Beta on Wednesday and if that works, the next release.
I see the same thing and heard there is a round 3 of clean-up happening.
I sure hope reformatting gets automated a bit. I tried the find/replace method mentioned above, but since some of my automations are already the new format, it isn’t working right.
1., The hint helped, now most of the errors are gone. Many thanks. (BTW: what is the reason for the changes, do you know?)
2., I still have errors with other syntax things. Is there any “dictionary” to compare old and recent methods?(e.g: “hvac_mode”, friendly name, sequence, etc. is marked as “not allowed” what was working before.) Thanks
Is your pihole or adguard blocking it? I’m a YT creator and those programs tend to mess with our lives quite a bit…
Otherwise here’s the YT link. The description text is that same as my blog.
I found that with 2024.12.* I was getting errors with triggers and actions as documented on your site. I never did watch the video. I did get a “Configuration will not prevent Home Assistant from starting!” in Developer tools.
In my scripts.yaml, I have the following code to create a switch that immediately (after 1 second) turns off again. Essentially, it’s like a push button that automatically returns to its 0 state.
In my opinion, this code is correct, but I get the error “string does not match the pattern of LEGACY_SYNTAX” on both service lines. Does anyone have any idea how I should fix this issue? I’m a bit stuck.