So I have been using home assistant for a while and think it is pretty great. However as my system become more complicated I am hitting some pretty big annoyances regarding the yaml configuration.
I am no ymal expert and I have a few inbuilt biases (why must some things insist on making white space important, please just let me use brackets, it’s more readable than guessing if that empty section is a space short when I’m not on a machine without a decent code editor /rant). Anyway I am finding that any time I want to add something to my system, I can’t just write a bunch of config at the bottom of my file to test things out because I can only have a single “input_boolean:” and a single “sensor:” etc that is in a separate include file. As such a single bit of functionality such as a zigbee2mqtt setup, requires me to go paste a small bit of config in my sensor file, some stuff in my automation and timing file for allowing new devices to join. By the time I’m done I have stuff spread out across my config files that I have to bounce around and change as I debug things to get the new stuff working well.
What I would like to do is have all this functionality in a single include file that I could call a sensible name such as zigbee2mqtt.yaml, and in it have all the relevant input booleans, sensors and automatons in one logical place. It would be amazing to effectively have a more object oriented setup where I could simply add a new entity to the input_boolean object from anywhere.
So if there is any advice or wisdom out there on ways I can improve what I am doing I would love to hear it.
Use packages. You can have an input_boolean, automation, sensor defined in every package so you can just create a new package for a test etc.
Define packages in configuration.yaml
Just did a bit of testing and it seems like this packages trick indeed addresses my issue, cheers mate. Also that nswfireincidents package looks useful!
I would suggest using the Visual Studio Code Add-on. It has autocomplete, formatting, etc. Then it never matters if the system you are on has a good editor, as HA has it built in.
I can see that been useful but probably a little heavy for the Pi 4 I am currently running on. If I eventually switch to a proper server box I might add it.
I’m running on a Pi 4 as well and it handles it just fine. The Pi 4 is pretty beefy, it can handle a lot. I’ve got a ton of stuff running on there just fine.
What do I need to do in order to (re)load changes in packages?
I assume that new sensors, input_xxx, etc. will only be loaded doing a complete re-start, but what about scripts and automations inside a package?