Home Assistant: Updating w/ Custom Components

  • Post author:
  • Post category:Home Projects
  • Post last modified:October 17, 2020
  • Reading time:4 min(s) read

A few months ago, I wrote a tutorial on modifying Home Assistant to allow for customizing Ecobee hold modes. Today, I’ll explain how to upgrade HASS once you have this (or any other customization) in place. It’s a little more complicated than just a straight upgrade as described in their documentation.

For the original tutorial see my post: Customizing Ecobee Hold Modes in Home Assistant

docker-compose.yml Changes

First, let’s make some changes to our docker-compose.yml file.

services:
  hass:
    container_name: hass_hass_latest
-    image: homeassistant/home-assistant:latest
+    image: homeassistant/home-assistant:0.114.3
    volumes:
      - /home/hass/hass-latest/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /home/hass/hass-latest/custom-install/hass-core/homeassistant/components/ecobee:/config/custom_components/ecobee
-      - /home/hass/hass-latest/custom-install/dependencies/python-ecobee-api/pyecobee:/usr/local/lib/python3.7/site-packages/pyecobee

As you can see, there are two changes we need here.

I’ve changed the docker image from the “latest” tag to a defined version, so that I always know exactly what version I’m upgrading to. When we upgrade in the future, we’ll change this version number to whatever version we want to upgrade to.

As of at least 0.114.3 (perhaps earlier), our Python Ecobee Library changes are merged into the master branch. Since these changes are now included in Home Assistant, we no longer need to use a custom dependency.

Now, update the docker image for Home Assistant.

docker-compose pull hass && docker-compose up -d hass

Create a Git Backup Pointer for Old Version

In this case, we are upgrading from Home Assistant 0.108.8 to 0.114.3. I want to make sure I have a backup for my custom Ecobee component, in case I need to go backwards in the future.

git checkout -b additional_hold_modes.0.108.8
git push origin additional_hold_modes.0.108.8

# move back to our original branch (new pointer is just a backup)
g

We should already be on our custom Ecobee branch, so all we need to do (as seen above) is create a new branch for that point, and push it to our repository.

Get Main HASS Changes

You need to make sure you have the main Home Assistant repository configured as a remote, so that you can pull in all the changes between your old version and the one you’re upgrading to. Then, pull in any new changes and merge them into both your master and dev branches.

# check to see if you have main home assistant repo as a remote
git remote -v

# if it doesn't already exist, add upstream for main home assistant repo
git remote add upstream https://github.com/home-assistant/core.git

# fetch any new changes to the main home assistant repo
git fetch upstream

# merge any new changes into master
git checkout master
git merge upstream/master

# merge any new changes into dev
git checkout dev
git merge upstream/dev

Merge New HASS Changes

Now that you have all necessary code, merge the new Home Assistant changes into your custom component.

# merge the tag for the upgrade release into our ecobee branch
git checkout additional_hold_modes
git merge 0.114.3

Potential Caveat: Breaking Changes

In this case, there were no breaking changes on my install between 0.108.0 and 0.114.3. Please be sure to check the Home Assistant site and release notes for all versions between your upgrade versions, and make sure there are no breaking changes that might compromise your install.

Potential Caveat: Merge Conflicts

The only other potential caveat I can see here is that there may be merge conflicts on your attempted merge of the new core code into your own branch. If you encounter any, please feel free to post a comment here and I’ll try my best to help you figure out exactly how to resolve it.

Profit

Now, restart Home Assistant one more time, just to be safe. That’s all there is to it.

docker restart hass_hass_latest

You now have a working Home Assistant install on the newer version, with your custom Ecobee component still running. This same procedure would apply to any other custom components you might have on your install.

0 0 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments