Sanity check for double entries in configuration.yaml

This morning I found out the hard way that I, due to some copy paste changes, accidentally had a double sensor: entry in my configuration.yaml file.
The effect of this was that all sensors under the first sensor: entry were completely ignored. Only the sensors under the second sensor: entry were still functional.
However, this error was not seen by the “CHECK CONFIGURATION” validation check on the “Developer Tools → YAML” page.
It took me a lot of time to find this error myself.
Therefore this feature request: can you please add a check for this kind of double entries in the configuration.yaml file to the “CHECK CONFIGURATION” validation check?

The configuration check is to see if something hinders HA from starting up.
A double entry does not, so it will pass the check, but during boot there should be a warning in your logs about the double entry.

OK, thanks Wally, that’s clear, and I accept.
It was just that I was a little frustrated by wasting so much time for such a simple mistake…

And indeed: it is shown in the logs:

2023-02-03 12:20:08.738 WARNING (SyncWorker_6) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key “sensor”. Check lines 525 and 574

So next time I should better check the logs :wink:

And it appears to be visible in the File editor Add-on as well:


Up to now I am using Notepad++ to directly edit the configuration.yaml file, but probably I can better do it in the File editor Add-on…

Should I retract (delete?) my feature request?

You forgot to vote in your own feature request.

Try using the Visual Studio Code for editing your yaml files. The editor is quite good on highlighting this kind of issue.

Leave it.
It might help others, because you will not be the only one to stand in that situation.

1 Like

I was not aware that I had to vote myself.
However, like I wrote in my reply to Wally, I now understand that the configuration validity check is only meant to check if HA is hindered starting-up by something, making my request not valid anymore.

Thanks, I will check-out this add-on.

1 Like