Getting all my smart home devices on HomeKit is great! But my main issue is that when I began looking for a voice-assistant Apple’s HomePod didn’t exist—and now that they do I’m already deep into the Alexa ecosystem with one in every room! This meant I needed to expose my Homebridge devices to Alexa.

Some Homebridge devices expose themselves natively to Alexa, such as the Gledopto LED Controllers, which I wrote about here, but some is not all… and I’m aiming for the seamless smart home experience!

After a quick Google, I found a Homebridge plugin that aimed to solve this issue! The installation guide for this used to be fairly complex and involved reinstalling Homebridge with an Alexa build. Luckily the setup for this is now much simpler!

Homebridge Setup

The setup for this plugin is extremely simple and, unlike most plugins, the homebridge-alexa plugin doesn’t create any devices in the HomeKit app. If you haven’t already got Homebridge setup, check out my setup guide here. To install homebridge-alexa, type the below command:

sudo npm install -g homebridge-alexa

Once installed you’ll need to create an account at https://www.homebridge.ca/. This account will be used to link the Homebridge Plugin and your Alexa account.

Note: The password you choose for this will be written in plain text in your config.json.

After creating your account you can now begin configuring the Homebridge plugin. The syntax is straightforward and only requires a few parameters to setup.

If you do require some additional customisation you can find a full list of the plugin’s parameters here: https://www.npmjs.com/package/homebridge-alexa#optional-parameters, the below code will be fine for most scenarios:

"platforms": [ { "platform": "Alexa", "name": "Alexa", "username": "username", "password": "P4ssw0rd", "pin": "031-45-154", "refresh": 900 } ]

If you have multiple instances of Homebridge running, you will only need to do this on one instance. The plugin will automatically expose the other Homebridge devices to Alexa.

For this plugin to function correctly it requires you to run Homebridge in insecure mode, to do this start Homebridge using the following command:

homebridge -I

If you use systemd to automatically start your Homebridge plugin on boot you will need to add this flag to the systemd file located at /etc/default/homebridge I’ve included the full code and instructions for this at the bottom of this post.

Setting up the Alexa Skill

After saving your config.json, open the Alexa app. Using the burger menu open the ‘Skills & Games’ section and search for the Homebridge skill.

Once you’ve found the skill you’ll want to install it. When enabling the skill you will be prompted to log in, use the same credentials that you used to sign up for homebridge.ca. After this you will be asked to Discover Devices, this will take around 20 seconds and will add all of your Homebridge devices to Alexa.

The ability to add these non-HomeKit non-Alexa devices to both systems using Homebridge means that I can happily stay in my odd collaboration between Apple HomeKit and Amazon Alexa.

Overall it works perfectly, and am extremely happy with this plugin. If you have any questions about this setup drop a comment below and I’d be more than happy to answer them!

systemd Setup

As mentioned above, if you’re using systemd with Homebridge you’ll need to add the -I (insecure) flag to your code. This file is located at /etc/default/homebridge and you’ll need to adjust it to look like the below:

# Defaults / Configuration options for homebridge # The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others) HOMEBRIDGE_OPTS=-I -U /var/homebridge # If you uncomment the following line, homebridge will log more # You can display this via systemd's journalctl: journalctl -f -u homebridge # DEBUG=*

After updating this file you will need to reload and start the systemctl system. To do this type the below commands:

sudo systemctl stop homebridge sudo systemctl daemon-reload sudo systemctl start homebridge

We don’t run ads on Tech Trail. So if you’ve found this or any of our other posts useful, then why not buy us a coffee!