Migrating from hass.io on RPi3 to HA on NUC+Docker

Want to share how I migrated from hass.io on RPi 3 to HA docker build on a NUC. I wasn’t able to find something on the web and ended up slogging through some mud. Hopefully someone finds this useful.

I was happy with how I had things set up on RPi 3, but I wanted more horsepower, a more robust hard drive and more options with the server for future expansion. Also wanted to use Docker with volumes. My config uses HA for device/state tracking, Node-RED for logic/automation and z-wave for communication with home automation devices. Telegram is used for notifications. Currently home automation is exclusively z-wave. I had intentions to use snips.ai, have several Pi zero Ws with mics but Evil Inc. crushed those plans: https://www.home-assistant.io/integrations/snips/.

Starting point is a running instance of hass.io with SSH installed. A NUC with Debian Buster updated, configured, and secured. Docker installed on Debian https://docs.docker.com/install/linux/docker-ce/debian/. You can use almost any combo of metal and OS. I had a NUC sitting there looking bored and I prefer Debian.

You will need to replace “ip.of.hass” with the ip address of your hass.io (needs to be root@ though) and “[email protected]” with your username and ip. Everywhere there is xxx/user/xxx need to replace “user” with your username.

First I made zwave stick /dev/ttyACM0 when plugged into the NUC. This works with the Zooz stick or the Aeotec stick, I have both but use the Zooz. If you have something else you can run lsusb and look for your vendor/product id and replace accordingly. Not 100% certain this is necessary, but I wanted to make sure the device had the same name it used on hass.io. Originally wanted to use a Pi zero for the z-stick, but that didn’t work right away and ran out of time. Basically pinched this from aleatorvb in Reddit question about using remote RPi to pipe z-stick over network to HA server.

sudo su
echo "SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"0658\", ATTRS{idProduct}==\"0200\", SYMLINK+=\"ttyACM0\"" > /etc/udev/rules.d/99-zwave-stick.rules
exit
exit

The pièce de résistance - copying the config from hass.io machine into a tarball:

ssh [email protected]
cd /
tar -cf hass.tar config
exit
scp [email protected]:../hass.tar hass.tar
scp hass.tar [email protected]:/home/user/hass.tar

Extract tarball on NUC:

ssh [email protected]
tar -xf hass.tar

Create docker volumes and copy data:

sudo docker volume create nodered
sudo docker container create --name temp --mount src=nodered,dst=/tmp/data busybox
sudo docker cp /home/user/config/node-red/. temp:/tmp/data
sudo docker rm temp
rm -r /home/user/config/node-red

Moving data into hass volume first copy the hass config files into /home/user/config:

sudo docker volume create hass
sudo docker container create --name temp --mount src=hass,dst=/tmp/config busybox
sudo docker cp /home/user/config/. temp:/tmp/config
sudo docker rm temp
rm -r /home/user/config

At this point I shut down the RPi running hass.io and swapped the z-stick to the NUC. Start Node RED and Home Assistant:

sudo docker run --init -d --net=host --name="home-assistant" --restart always --device=/dev/ttyACM0 -e "TZ=America/New_York" --mount src=hass,dst=/config homeassistant/home-assistant:stable
sudo docker run -d -p 1880:1880 -u root --name="nodered" --restart always -e "TZ=America/New_York" --mount src=nodered,dst=/data nodered/node-red
exit

Should be running! In my case it retained pretty much everything. The last step is to create a long term token for NR to use. Make sure node-red-contrib-home-assistant-websocket is installed in NR. Log in to Home Assistant, click on your name, scroll to the bottom “Long-Lived Access Tokens” and click “create token”. I named mine Node-RED. Copy that token into Node-RED. I clicked on one of the HA nodes, where it says “server” click on the pencil. Copy the token in there and uncheck “hass.io.” Update the URL for Home Assistant to ip.of.nuc:8123.

Hopefully there are no errors, but let me know and I will fix them.

Jon