While trying to extend my smart home based upon Apple HomeKit, I also found several devices that couldn’t be implemented instantly like Amazon’s Blink for Home-cameras. Questioning this (obviously omitting HomeKit-support), I searched for well-known solutions fueling a Smart Home-installation and stumbled upon Home Assistant which I deployed in my Raspberry Pi 3B+ without problems. Supporting about 1885 integrations at the time of writing, Home Assistant is a beast when it comes to polishing your Smart Home-brainpower. Albeit the installation on the Raspberry was okay, it took quite some time so I looked if this scenario could also been covered by my main NAS, which is a Synology DS-920+.
Short answer: It could as Home Assistant is supporting two modes of official deployment: The installed version on a lightweight-distribution like DietPi on my Raspberry or the containerized version via Docker. Thus, installing it on the Synology with the Docker-environment already present shouldn’t be a problem. My first try of pulling the container directly from the GUI didn’t succeed for whatever reason (despite being able to pull it), so I tried to adopt the official Docker way by using Synology’s ability of executing specific scripts. The final result was that I was able to deploy Home Assistant while being able to see the container in Docker’s GUI afterwards. Join my journey to let me show how this can be accomplished in nearly no time!
In the scenario given, Docker is already installed on the Synology using the Package Center. In case it isn’t, you may do so by visiting the app and clicking on „Install“. Once this has happened, Docker should be installed on your Synology’s standard Volume 1 and the app should appear in the app-overview. Should you encounter troubles when trying to install the Docker-app, please have a look at the official Hardware Compatibility List of Synology-devices supporting Docker.
Now we need to create a specific folder for Home Assistant-specific data which is handled by the Docker-instance. Here, I have already created a share named, for example, Docker where I tend to create specific folders for each Docker-ized application. The folder here is — surprisingly – named „homeassistant“ and after having created it, we are ready to go to deal with the initial installation routine.
In your Synology DSM, head to the Control Panel and visit the Task Scheduler. Here, create a new scheduled Task which should run an user-defined script. Once you click on the latter, a new window will appear where we need to adjust some settings which will finally lead to pulling the latest Docker-version of Home Assistant.
The task field type here is just named „Home Assistant“ but you can also give it a more fitting name like „Home Assistant Installation Script“ in case you want to.
Uncheck the „Enabled“-option in this window and head to the „Schedule“-pane. Here, select „Run on the following date“ and then select „Do not repeat“.
Having a look on the Task Settings, you may check „Send run details by email“ and enter your mail address in case you want this info deployed by E-Mail and the E-Mail-settings in your Synology are configured before.
As for the user-defined script, please enter
docker run -d --name=home_assistant \-p 8123:8123 \-e TZ=Europe/Berlin \-v /volume1/docker/homeassistant:/config \--net=host \--restart always \homeassistant/home-assistant
and alter the path to match your specific needs, changing this to the folder you have previously created. The share is „docker“ here, the folder „homeassistant” – and the /config-folder of Home Assistant’s Docker-container will therefore be mapped into this folder.
The parameter „net=host“ takes care of using host networking on the Synology instead of the bridge-mode. With this enabled, you will be able to control Home Assistant-devices with Apple’s „Home“-app, otherwise this won’t work and devices placed therein won’t be discovered. Additionally you should take care of the „TZ“-parameter to suit your specific timezone – a list of timezones can be found here.
Short note: If you are thinking about using either Home Assistant or an alternative like ioBroker (thanks to Volker for this argument!), you may use this tutorial as well. To go with the latter (and taking care of the correct paths before), the command to insert for running a Docker-ized version of ioBroker would be:
docker run -d --name=iobroker \-p 8081:8081 \-e TZ=Europe/Berlin \-v /volume1/docker/iobroker:/opt/iobroker \--net=host \--restart always \buanet/iobroker
Please bear in mind that the URL following this step will then change to http://<IP-of-your-Synology>:8081!
Running the script
After you have clicked on „OK“ in the last step and met all necessary prerequisites, a warning will appear which needs to be acknowledged and you will return to the Task Scheduler again.
Now check your freshly-created script, hit the „Run“-button and confirm that you are really wanting to run this script by clicking on „Yes“.
Depending on your Synology-model and your Internet connection, the installation should take some seconds to minutes and once you visit http://<IP-of-your-Synology>:8123 an initial welcome screen of your freshly Docker-ized Home Assistant should appear. Looking at the Docker-app itself, the running container we have just fetched is visible and can be handled like any other container straight from Synology’s GUI.
You may now choose a name, an username and a password which you will need to access your Home Assistant-instance.
Then, choose a name for your home and hit „Detect“ to let your browser’s geolocation-feature match your nearest position which should match the place where your Synology is installed. Choose the unit-system (whether metric or imperial) and head to the next screen.
Here, you may decide if you want to share snippets of anonymous usage statistics or not.
The next screen finishes the initial installation and, depending on your home environment, Home Assistant should already have discovered certain services and/or hardware you may configure afterwards.
The dashboard is quite clean in the beginning but with customizing the freshly-installed Home Assistant-instance in your home, this is surely about to change quite soon!
To update a container, open the specific-Docker package and download the latest image from the „Registry“-tab, here named „homeassistant-home-assistant:latest“. Once the download is complete, go to the „Container“-tab and stop the running container of your Docker-ized Home Assistant-installation. Next, select the container and, using the Action drop-down menu, select „Reset“ afterwards. The container will be removed from the list and recreated using the image you just downloaded. If your configuration files are stored on your Synology-NAS like shown in this tutorial, they will be recognized and the container should run as expected with your latest configuration.
Give it a try and fire up the container – after a short loading time, Home Assistant should be available in the latest version running your previously used configuration!
We successfully managed to deploy an instance of Home Assistant based on Docker on our Synology to extend and broaden our smart home experience. Without bloundering over possible installation problems by just fetching the Docker-image via the GUI, we managed to fetch it via Synology’s scripting feature while sticking to the official way of deployment. Despite already running on a Raspberry Pi in a proper way, using the performance of our Synology drastically speeded up the installation routine and the responsiveness in the browser while – thanks to hosted networking – discovering Apple HomeKit-based devices works flawlessly.