Moving Home Assistant in Docker to new hardware - issues and (some) solutions

This is to chronicle the issues I have had in moving my home assistant instance from my old computer to an old server i set up. I hoped it would be as simple as copying my old persistent dir/files and restarting Docker containers, but not quite. However, it only took a few hours to get to something that’s usable, so it’s certainly easier than the last few times (e.g. when I switched from RPi2 to RPi3 with HASS v. 0.38, or back when i switched from venv to Docker and RPi to NUC-like computer)!

I’ll update with solutions as I find them, but you should feel more than welcome to chime in if you have any (also if the solutions I’ve found are less than ideal). Hopefully this can serve as a troubleshooting guide of sorts, if anyone else tries this and runs into similar issues.

My install was in Docker, running Home Assistant 0.109.3. Of potential interest, I am also running the following Docker containers (all updated to tag=latest on 2020-05-03):

  • acockburn/appdaemon
  • linuxserver/letsencrypt
  • linuxserver/duckdns
  • marthoc/deconz
  • trafex/alpine-mosquitto
  • mariadb

I am also using the Android and iOS apps/integrations, as well as the integrations listed below.

I started by setting up the new server with the static local IP of the old, and the did an rsync with -aH flags (instead of scp, to retain ownership and permissions) of all my docker containers persistent directories form the old computer to new server.

Below is a list of the issues I found, and the solutions. I’ll update this post as needed:

  1. First issue was MariaDB [Solved], where HASS couldn’t connect. But simply deleting the MariaDB persistent docker directory, and restarting the container fixed that.

  2. Second issue was that all the Long Lived Access Tokens disappeared [Solved/Mostly solved]. An annoyance, but I re-created new ones, and put them in the relevant places (mostly in my secrets.yaml and a few other config files). It would be nice if I could retain them though (did I do something stupid since they weren’t?).

  3. Next is the phone apps.

    3a. The iOS App [SOLVED] couldn’t connect, so I tried resetting the app/connection (in the app). When trying to set it up again, it keept giving “Error: Can't build API URL” when I try to edit the connection. After restarting both HASS and the app, I tried the app. It found my (external DuckDNS) HASS address, but when logging in, I got the error “Error: Response status code was unacceptable: 401”. I am connected to the external address (DuckDNS address) via browser at the same time and that works fine. However, manually entering the local IP during setup works. Well, mostly. It automatically added my local IP as “external URL” in the app, but I could manually change this afterwards, so now both local and DuckDNS address works.

    3b. For the Android App [SOLVED], I have both the official app and the “HA Client” (I’d prefer using the official, but the HAClient is just sooo much faster. Shame it doesn’t support many of the custom cards I’m using, though). I also had issues, and ended up removing the integration from the HASS UI config, and set up again. For the HAClient, it worked from there, for the official app, I needed to force close (well, I rebooted the phone, but should be the same) for it to accept. Fairly painless.

  4. Next issue was AppDaemon [SOLVED, but why?]. I changed my long lived access token in “secrets.yaml”, which is referenced in appdaemon.yaml, and left everything else as is. But AppDaemon couldn’t connect to HASS. It could connect to Mosquitto, and deliver its birth payload. For this one, I can’t really be of much help. From yesterday around 22:00 through today at 10:13 the logs kept showing “WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds”. Then suddenly 5 seconds after the last “warning”, it connected. I have absolutely no idea why, since I wasn’t messing with anything related to AppDaemon at that time. So sorry, no help here if you run into issues.

  5. Final issue found so far, integrations [NOT SOLVED]. I can see my integrations via HASS UI config, but only if I’m connecting via local IP! If I’m connecting via. my DuckDNS address, it just shows Nothing configured yet: Seems like you don't have any integrations configured yet. Click on the button below to add your first integration!. If I do click that, it will show Please wait while the integration is being installed. But it will do this forever, while I (simultaneously) can see them when browsing to my local HASS IP.

So any ideas, especially on #5 would be welcomed! Any notes on anything else would also be fine, and I’ll update this as needed.

For a sense of completion, here’s a list of integrations used, that I didn’t change in any way (so far they seem to work fine with after moving, no work required):

  • Google Cast
  • Certificate Expiry
  • deCONZ
  • Font Awesome
  • HACS
  • IFTTT
  • Home Assistant iOS
  • Life360
  • MQTT
  • OwnTracks
  • Shopping list
  • SONOS
  • Belkin WeMo
  • Z-wave
  • Home Connect