Skip to content

Homebridge on Windows 10

oznu edited this page Oct 1, 2020 · 43 revisions

This guide provides step-by-step instructions to show you how to install Homebridge on Windows 10 as a service so it will automatically start on boot.

Prerequisites

Before you get started, make sure you have the following ready:

  • A computer running an update-to-date version of Windows 10 (this guide is based on 1903).
  • An account with Administrator Privileges.

Install Homebridge

Step 1: Install Node.js

Download the LTS version of Node.js (v12.18.4) from https://nodejs.org/en/download/ and run the installer with all the default options selected.

Open a new Node.js Command Prompt window as administrator, then check that Node.js and NPM have installed correctly by running the following commands:

# test node.js is working
node -v

# test npm is working
npm -v

nodejs-admin-prompt

Step 2: Install Homebridge

From the administrator Node.js command prompt, run the following command to install Homebridge and Homebridge Config UI X:

npm install -g --unsafe-perm homebridge homebridge-config-ui-x

Step 3: Setup Homebridge as a Service

To install Homebridge as a service we use the hb-service command provided by the Homebridge Config UI X plugin:

hb-service install

hb-service-install

If you see a Windows Firewall warning, make sure you grant Node.js permissions to access your private network.

Manage and Configure Homebridge

With the Homebridge Config UI X plugin

The Homebridge Config UI X will allow you to install, remove and update plugins, and modify the Homebridge config.json.

To access the UI go to http://localhost:8581 in your browser.

The default username is admin with password admin.

Review the Configuration Reference at the bottom of this guide.

Using the command line

To view your pairing QR code, you'll need to view the logs which are stored in the $HOME\.homebridge\homebridge.log file. You can view the from a Node.js command prompt with this command:

hb-service logs

To edit your config.json file you can open the $HOME\.homebridge\config.json file in a code editor of your choosing (VS Code is a good option with syntax checking).

Do not edit the config.json file using the a word processor that does text formatting as this will corrupt the file.

After making any changes to your config.json you need to restart Homebridge using by stopping and starting the service in Task Manager. You can also run this command from a Node.js command prompt:

hb-service stop
hb-service start

How To Uninstall Homebridge

Delete the service run the following command from a Node.js administrator command prompt:

hb-service uninstall

Remove Homebridge and Homebridge Config UI X:

npm uninstall -g homebridge homebridge-config-ui-x

You can optionally delete all Homebridge data stored in $HOME\.homebridge and uninstall Node.js.

Multiple Instances

Some users like to run multiple instances of Homebridge.

The hb-service command makes this easy to do via the --service-name flag.

See the hb-service documentation for instructions.

Additional Utilities

Some plugins may require you to have git installed, or the windows-build-tools to compile native modules.

git

While installing certain plugins you may encounter the spawn git ENOENT or ENOGIT error. To resolve this issue you need to install the git utility. You can download the installer from https://git-scm.com/downloads.

windows-build-tools

The windows-build-tools allow Homebridge plugins to compile native code for your platform. While increasingly rare, some plugins will require this. To install the windows-build-tools open a Node.js command prompt as an Administrator and run:

npm install --global windows-build-tools

This command can take a very long time to run. Be patient.

Configuration Reference

This table contains important information about your setup. You can use the information provided here as a reference when configuring or troubleshooting your environment after setting up Homebridge using the instructions below.

File Location / Command
Config File Path %HOMEPATH%\.homebridge\config.json
Storage Path %HOMEPATH%\.homebridge
Restart Command hb-service restart
Stop Command hb-service stop
Start Command hb-service start
View Logs Command hb-sericce logs
Clone this wiki locally