Is homeassistant: *needed* in configuration.yaml?

I was impressed with a YouTube video from Slacker Labs that incidentally showed Jeff using the Studio Code Server add-on in Home Asststant.
Cool! I installed the Studio Code Server add-on and on the first yaml file I looked at (configuration.yaml), it showed me a couple of places where my indentations weren’t correct. This is going to be handy since correctly indenting YAML is my curse.

However, a line that has been in my configuration.yaml for a couple of years showed an error.


Since I am defining everything in the Settings sidebar, there is nothing in the homeassistant: component.

Do I even need this?

I’m pretty sure you do since it’s required and it’s not listed in the default_config list of integrations.

I guess you could remove it and restart and see what happens. :wink:

I don’t have it in mine. I think I noticed I didn’t need it after I removed customize and some of the other items that used to be keyed under homeassistant

That’s what I did. Nothing bad happened. I just wanted to know if I was going to brick my HA.

It’s no longer added to the base configuration of new setups.
So unless you need to change any of the sub keys, it’s not needed.

1 Like

I didn’t know that.

is that something brand new or did I miss it somehow?

I should also note that this error is probably not correct even if you left homeassistant: in your YAML. One issue the schema checker has in that addon is its not nearly as flexible as HA actually is.

For example its yelling there because according to the schema the homeassistant: key has a dictionary as its value and having nothing there is not a dictionary in YAML. However if you actually started your config it would be fine. That’s because HA has a lenient validator that defaults the value of that key to a dictionary if its left empty. So the error can safely be ignored.

This happens a bit unfortunately. For instance, nearly every place in HA where you can put a list you can also put one single item. Like trigger in automation wants a list of triggers. But this is totally valid as well even though its not a list:

  platform: state
  entity_id: binary_sensor.test

HA’s lenient validator will turn that into a list of one item for you without you needing to explicitly make it into a list:

  - platform: state
    entity_id: binary_sensor.test

But sometimes when you shortcut like this the schema validator in studio code server complains.

Just something to be aware of. It tends to be more strict then HA actually is.

So, if I write my yaml code in Studio Code without errors, I will more likely have the correct formatting?

I have been using Home Assistant for a few years (I started about the time that Lovelace was introduced), but I am still baffled sometimes by the syntax. For example, where is “Trigger wants a list of triggers” defined?