One of my primary and very important goals working with Home Assistant is that I want to be able to update Home Assistant at any time without anything breaking in my setup, for example integrations, automations, scripts etc.
I simply don’t want to have to do rework after an update, because it requires time and it also means something is not working in our home (which is something the wife will notice and mention, of course).
Today I just update Home Assistant when a new update is available. I don’t wait, and I don’t test if the update will work in a separate environment. I just update. I have done this for over a year now, and without any issues.
So how do I make sure that goal is reached? I follow a simple ruleset / guideline when working with Home Assistant:
1. Setup integrations through the GUI
If an integration can be setup through the GUI, I do it. The Home Assistant team will from update to update make sure that each integration work when setup through the GUI.
If you set it up through YAML files instead, you could be hit by breaking changes to that configuration.
Of course not every integrations can be setup through GUI, so I still have some setup through YAML files. In this case I’m aware that I could be hit by breaking changes. Normally I follow up on the release notes to see if any of these integration can be setup through GUI in a new release, and if so, I will before next release have moved from YAML configuration to GUI setup.
2. Follow best practise for YAML files
I always follow the best practise for coding in the YAML files. This means that the code is more protected from updates breaking the code.
A good thing is to read the Templating documentation: Templating – Home Assistant (home-assistant.io)
It gives you a lot of information on how to work with different variabel types, check states of entities etc. It’s a must-read page of the documentation.
3. Using blueprints
Whenever I can I build my code by using blueprints. Blueprints is pre-made automations that can be used for multiple cases. For example all my automations for my different motion sensors is handled by the same blueprint.
Read more about blueprints here: Using Automation Blueprints – Home Assistant (home-assistant.io)
The advantage of using blueprints is, that I only need to change the code at one place. I have 8 motion sensors in the house, but because the automations related to each of them uses the same blueprint, I only need to change the code in the blueprint to change it for all the automations.
It simplifies coding and making it possible to reuse the code already made.