Homebridge on Synology

oznu edited this page Oct 29, 2018 · 26 revisions

A third-party Synology Package is available that simplifies the process of getting Homebridge up and running in a Docker container on DSM. See oznu/homebridge-syno-spk for more details and installation instructions.

How to setup Homebridge & Docker on a Synology NAS

This guide will show you how to run the oznu/homebridge docker image on a Synology NAS running DSM 6.

Requirements

Installing Docker on Synology DSM

You can install the Docker app using the Synology DSM Package Center.

1. Download Docker Image

Open the Docker app on your Synology DSM, go to the Registry section and then search for and download the oznu/homebridge image.

Download oznu/homebridge docker image

Make sure you select the latest tag:

Select latest tag

2. Create Container

Launch a new container using the oznu/homebridge image.

Create container

Name your container appropriately and then click Advanced Settings:

General settings

Check the box to Enable auto-restart. This is recommended if you want your container to automatically restart after your Synology DSM reboots or if Homebridge crashes.

Advanced Settings

Click the Volume tab and then Add Folder.

Volumes

Create a new empty folder to store your Homebridge configuration in. This will allow you to update, delete and recreate the Homebridge container without loosing any plugins or configuration.

In case you need to reset your configuration, just empty the contents of this folder and restart the container.

Create folder

Set the Mount path to be /homebridge.

Volume mount

Click the Network tab and check the box to Use the same network as Docker host. This will allow the Homebridge to be discoverable by iOS and HomeKit on your local network.

Network settings

Click the Environment tab and add a new environment variable named DSM_HOSTNAME. The value of the DSM_HOSTNAME environment variable should exactly match the server name as shown under Synology DSM Control Panel -> Info Center -> Server name, it should contain no spaces or special characters.

Environment variables

Click OK to save your advanced settings and then click Apply to start the oznu/homebridge container.

Summary

3. Installing Plugins

Plugins are defined in the package.json file which will have been created in the Homebridge configuration folder defined in the above steps. There are a few different ways you can install plugins:

  1. Using the command line
  2. Manually updating the package.json file

Method 1: Command Line

Installing plugins via the command line is the easiest method to get the latest version of a plugin. To start a command line session with for your oznu/homebridge container click the Details tab:

Container created

Click the Terminal tab and then Create > Launch with command.

Create terminal

Enter the command sh. To keep the container size small bash is not installed.

sh command

Click on the new sh command option to spawn a prompt. You can now run the commands to install plugins.

To install a plugin, for example, homebridge-platform-wemo run this command:

npm install homebridge-platform-wemo

To remove a plugin:

npm uninstall homebridge-platform-wemo

After installing a plugin you need to restart the container to activate it. You can do this from the Overview tab. Adding and removing plugins using this method will automatically update the package.json file.

sh command

Method 2: Manually edit the package.json file

You can also install and remove plugins by editing your package.json file. To do this open and amend the file using a text editor of your choice.

The package.json file can be found in the Homebridge configuration folder we created in the above steps after you launch the container at least once.

file system

If you choose to install plugins using this method make sure your JSON is formatted correctly. A missing or extra comma will prevent any plugins being installed.

Some editors like TextEdit on OSX will try and replace the " with non standard quotes which will cause issues - to avoid this use a plain text editor like Atom or Visual Studio Community.

You can use jsonlint.com to verify your package.json is syntactically correct.

To make sure the latest version of any plugin is installed use a *.

{
  "dependencies": {
    "homebridge-platform-wemo": "*",
    "homebridge-dummy": "*"
  }
}

You can delete plugins by removing them from the package.json file.

After editing the package.json file restart the Homebridge container to apply the changes.

4. Customising config.json

Most Homebridge plugins require you to add additional configuration in the Homebridge config.json file which will have been created in the Homebridge configuration folder defined in the above steps.

You can open and edit the config.json in a text editor of your choice.

Some editors like TextEdit on OSX will try and replace the " with non standard quotes which will cause issues - to avoid this use a plain text editor like Atom or Visual Studio Community.

You can use jsonlint.com to verify your config.json is syntactically correct.

After editing the config.json file restart the Homebridge container to apply the changes.

Viewing Homebridge Logs

You can view the Homebridge logs using the Log tab.

view logs

Connect iOS / HomeKit

You should now be able to see the Homebridge as a new HomeKit accessory in the Apple iOS Home App. You can pair the device using the default pin. You can change the pin by editing the config.json file.

Default Pairing Pin: 031-45-154

When using iOS 11 you will need to select Don't have a Code or Can't Scan and then under the Manual Code heading select the Enter code... link.

Home app add accessory

Updating Homebridge

To update to the latest version of Homebridge and the oznu/homebridge container:

  1. Download the latest version of Homebridge
  2. On the Container tab stop the existing Homebridge container
  3. Edit the existing container and change it's name to homebridge-old
  4. Select homebridge-old then click Settings then Duplicate settings
  5. Name the container homebridge
  6. Start the homebridge container
  7. Delete the homebridge-old container
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.