I start to be VERY bored of HA that breaks each time you edit config file without any explanations in log and no way to debug the thing !! I have done in the past manually with vi, also used graphical text editor through samba share, and lastly using the web editor included as plugin in hassio but all are bad !
Whatever you use the check config file tool included in HA, or like the web editor of hassio that tells you when file is correct or not, it’s still completely insufficient in checks done.
Is there a real efficient way to check your yaml files before saving them and killing your HA ? or a way to make f*cking HA to tell you where is problem in file when it has an issue with it ?
I don’t want even edit the file to activate the more complete log option to get HA more verbose as I’m pretty sure once done HA will never restart !!
Thanks for your tips on this as it’s really killing me in use of HA !
You should really spend the time to understand yaml and it’s errors. I understand your complaint, but these errors come from YAML not home assistant. You can use ANY yaml checker to verify your changes are correct via yaml. The errors in home assistant literally come from yaml errors. Also, they do tell you exactly what the problem is and where to find it. People tend to glance at the errors instead of trying to understand them.
This is a website where you can paste any yaml in and it will tell you were the problem is. It’s going to be the same errors that home assistant gives. So this won’t really help you. Instead, you should understand the errors.
(<unknown>): mapping values are not allowed in this context at line 4 column 15
The error literally tells you the line and character number that the error is in.
4 entity_id: light.foo
^ ^
| character 15
line4
So at this point, yaml is not expecting a mapped value. Mapped value is where you set a value equal to another value. I.e. entity_id: light.foo, entity_id is being mapped to light.foo. So what is the error saying? “I (the yaml) do not expect a mapped value at this position, i expect something else.”
99% of your errors will be this, spacing. So check your spacing. Sometimes you’ll get errors referring to getting “None”, but it still points to a line and character.
In the special cases where you get a line number and a ? character, this means the error is inside that section. You’ll only get this error when using !include. At that point, take the contents of the file and plop it into the link I posted above and it will show you the error.
I can count on one hand the number of times I have prevented HA from restarting due to bad yaml. Perhaps you should use a text editor that actually understand yaml and can highlight issues in the context.
The log file will literally tell you where the problem is.
Thanks for explanation and taking time on this Unhappy in my cases where I got that problem of HA unavalaible after yaml editing, it was passing basic checking of the hassio editor but I’ll take care to copy/paste each time now in website you indicated so I see any mistakes before it’s a drama in HA Is Atom a viable solution for yaml validation ? as I was used to it in past to edit some config files !
I thought but I was too naive I guess to think that the editor plugin included in hassio was doing it but it looks that it’s not
As indicated above, what do you think of Atom ? Is it doing efficient check on yaml files ?
Sorry but not, each time I got that problem, there was absolutely nothing in log of HA or do I need to activate a specific log level to get these errors in logs ?
The first thing I do after editing my config is running hass --script check_config. If that gives me an error I’ll fix it, otherwise I’ll give it a try and restart. Another option would be to hit the button to check the config in the settings menu.
the log is located in your config folder. There is no way the log is empty on a bad startup. You cannot rely on the built in log in the interface on a bad startup. You have to consult the file. It’s named homeassistant.log (or something similar) inside your config folder.
I use VSCode, nice editor. Which extensions are you using for yaml? I just have the redhat one but wonder if I’m missing out on anything good with others.
Sorry but as previously indicated the config check in HA menu is just bullshit since always ! It tells you file is ok when it’s not so it’s not an option since a long time !! I have learnt a long time ago not to use it so my question for some good yaml editors able to do thoroughly that check
oki, will give it a try with Atom then, thanks it should be easier than the web editor and copy/paste each time on http://www.yamllint.com/ that it’s syntax correct:D
Not always for yaml syntax errors unhappy It was confirmed by someone here previously when I hit that problem the first time and not understanding what was the source of the problem ! and got it again today two times (each time I just had edited the config file to add something in it and at next start no more HA gui avalaible and nothing relating to config file error in log file of HA !).
Yes, there will be an entry in the log file that indicates a LINE number and a COLUMN number, and usually an exact message that tells you why it is failing.
If it is a YAML formatting issue, and not necessarily tied to a specific component, it will fail just after the last thing “loaded”.
Again, the log file will tell you all, sometimes in detail, sometimes it requires a little thought.