SmartHome Automation with HomeBridge

This is how I joined Alexa and Siri (Apple HomeKit) together with HomeBridge to control my Non-HomeKit supported, WiFi-enabled home devices.

I had been looking at various solutions to automate different aspects of my home and while there are many, not one “off the shelf” solution would control all of the various devices in my house, especially if they were not HomeKit/Google certified.  (Manufacturers have to go through extra steps/expense to make their device certified).

This was a problem because I had several WiFi devices that could potentially be automated (Garage door opener, ceiling fan on RF remote, Ring, Nest, UniFi Network) and various lights and outlets.

I also want to make sure people turn the lights off when they leave the house (ie: occupancy detector based on iPhone MAC address, so when not detected on network, it’s assumed they’re not home so turn off that person’s bedroom light/fan)

I use iOS devices so my comments will be oriented mainly around Apple HomeKit.

Home Hub / Bridge

You need a hub to control all your devices and relay commands from your Alexa/iOS/Android devices.

Apple’s HomePod is a hub, and AppleTV (4th gen or later) can be as well.  But that only works for HomeKit certified devices.

There are some free/open source options that were promising and I wound up selecting HomeBridge.

HomeBridge links your devices under one roof, so to speak.  There are hundreds of plugins available for HomeBridge, even some I didn’t think to use.

You can install HomeBridge on a variety of platforms, Windows, MacOS, Synology (Docker), Linux and RaspberryPi.

I’m running HomeBridge on Ubuntu Linux within a virtual machine on my Synology NAS (for a variety of reasons), configured for 1GB RAM and 2 CPU cores.
Most of the time it sits at 10% to 15% CPU load, and just under 50% memory utilization. No issues there.
I won’t get into how to install HomeBridge as there are plenty of resources online, this is mainly a writeup to discuss compatibility and how HomeBridge works well for me.

Smart Devices

These are all the devices I’ve setup with HomeBridge so far

TP-Link Kasa – Switches (2 and 3-way), smart plugs, smart light bulbs.  The devices have great reviews, and they’re inexpensive compared to other brands.  The TP-Link HomeBridge plugin supports several of their switches, outlets and lightbulbs.

Useful Tip: I bought a 3-way switch kit, comes with a pair of switches for the upstairs and downstairs switches that control the stairway lights.  You only need one switch to be “smart” to control it with HomeKit – the other “dumb” switch can remain if you want to save on costs.  But if you want them to match, get the kit.

HS200 Wiring
Wiring guide for HS200 single pole switch.

You also need to have a neutral wire present in each gangbox where you plan to install these switches.  This is because the switch needs constant power in order to maintain WiFi connectivity.

 

 

 

 

 

Bond Bridge – I have a Harbor Breeze Hydra ceiling fan that comes with an RF remote to control the light and fan speeds, but it’s not WiFi. 🙁

Bond BridgeThe Bond Bridge can learn the RF commands of your remote and will appear in your HomeKit app with a slider for fan speed, and a button for toggling the light.
It will even control fireplaces equipped with a remote, and motorized shades.   But in this case, I got it for the Hydra fan and it works very well.  I couldn’t find any references online for anyone that’s tried Bond with a Hydra fan so I’m happy it worked out.

 

 

Ring DoorbellRing – I added the Ring Doorbell plugin and it works as expected.  Using HomeKit automation you can signal your lights to come on when the doorbell is rang, (handy at night).

 

 

 

Chamberlain Garage Door OpenermyQ – Using HomeBridge plugin to add my garage door opener to HomeKit (“Open garage door”, “Close garage door”, “Is the garage door open”)

 

 

 

 

Amazon Alexa

Alexa – using a Dot, Show, FireTV or pretty much any Alexa device, you can use the Alexa plugin and now control your smart home devices.  And with a Show, you can see who’s at the door when they press the Ring doorbell button.
Note: I find using Alexa is more convenient than Siri with regard to voice commands because Alexa is always listening so you can fluidly say “Alexa turn on the bedroom light” whereas with Siri, you have to say “Hey Siri”…wait for her to respond…“turn on the bedroom light”

 

Nest ThermostatNest Thermostat – using Nest Plugin, add thermostat control and display to HomeKit. (“Set hallway thermostat to 70 degrees”)

 

 

 

 

Orbit B-Hyve Model #57915 – Added a 4-zone controller so I could remotely turn on/off the drip lines to check for leaks/adjust position of emitters.  Very handy, so I don’t have to keep going back & forth to the garage on the other side of the house to start/stop the water.  This works very well in Homebridge.  Shows each zone that I can toggle on/off manually.  (Note: Limitation of Apple HomeKit restricts you to 5 or 10 minute manual watering.  Probably to prevent wasting water in case you turn it on by accident and you’re not at home.)  If you need to make major changes you just open the Orbit B-Hyve app.

PurpleAir – show AQI in the HomeKit display

Messenger Plugin – email me when AQI drops below “Good” air quality

UniFi Occupancy Sensor Plugin – Presence monitor watches our UniFi equipped network for our mobile devices.  If no one is home, make sure specific lights are turned off and garage door is closed.  UniFi Controller required, using UDM Pro in this case.  Should also work with Cloud Key controllers.

UniFi Protect Plugin – Add your UniFi cameras to HomeKit display.  Can also be used as a motion trigger to automate other devices.

PiHole Plugin – turn PiHole filtering on and off from HomeKit.

LG ThinQ Plugin – Adds Washer/Dryer/Refrigerator status to HomeKit (must be a ThinQ-enabled appliance)

Pending: Put in an HS200 single pole switch, wire it to power only and use it as a remote trigger via HomeKit to activate a whole house fan on the 2nd story for High Speed (there is a low speed but who really uses low speed anyway for a WHF?)

I was going to use a Shelly 2.5 double relay to control a whole house fan, it’s rated for 10A on each relay but I have a two speed whole house fan and would need to bench test the Shelly to see if it will operate the relays so only one is activated at a time as to not burn out the motor by accidentally activating both high and low speed windings simultaneously.  You can setup HomeKit automation to turn one relay off when the other turns on but that seems sketchy.  Plus, the Shelly 2.5 has a switch override input, so if it’s running on High speed and someone uses the remote control to kick it over to Low speed, HomeKit won’t know, therefore automation trigger won’t fire.   Might just stick to high speed only on the HS200.

Update: Shelly 2.5 installed, works great so far.  Was able to setup an I/O trigger on the web interface of the Shelly so when one relay turns on, the other turns off.  I also linked it to an HS200 switch downstairs (not connected to anything) so I can control the house fan (high speed relay) from a switch near the front door.

12/16/2021 Update: When using an HS200 for remote automation, edit the config JSON to change the polling rate to a smaller number.  Otherwise you could be waiting 10 to 15 seconds before your light, fan (or whatever) turns on.  This is because Homebridge polls each switch for it’s status at the rate specified.  I lowered mine to 3 seconds without any adverse effects.  If your device(s) go offline however, you’ll get a lot of log entries every 3 seconds that it can’t connect to the device.

Enter the pollingInterval line as shown below.

 {
            “name”: “TplinkSmarthome”,
            “addCustomCharacteristics”: true,
            “discoveryPort”: 9999,
            “pollingInterval”: 3,
            “deviceTypes”: [
                “plug”,
                “bulb”
            ],

On the Shelly 2.5, Output 1 is Relay 0,  Output 2 is Relay 1.  You’ll need to set I/O URL’s on each relay to turn the other off in the event it gets turned on it will shut the other relay off.  You won’t have to rely on using HomeKit automation either in the result of a communication failure over WiFi, it’s handled internally by the Shelly relay instead.

So when Output 1 is turned on, you set this URL:
http://localhost/relay/1?turn=off

When Output 2 is turned on, you set this URL:
http://localhost/relay/0?turn=off

Doing so prevents both High and Low windings of the fan to be energized at the same time.  This change in status is also reflected back to HomeKit, I use Homebridge Http Switch plugin to control.  The Shelly plugin does not work across VLANs, because all my “Smart Devices” reside on their own VLAN I had to find another means of communicating with the Shelly.

In the config you’ll add an accessory for Low and High speed.  In my case for example, Low Speed is Relay 0.  High Speed is Relay 1.  This is the config for relay 0.  For Relay 1, just change /relay/0 to /relay/1 in all three URL’s.

{

    "accessory": "HTTP-SWITCH",

    "name": "WHF Low",

    "switchType": "stateful",

    "onUrl": {

        "url": "http://x.x.x.x/relay/0?turn=on",

        "method": "GET",

        "auth": {

            "username": "yourUsername",

            "password": "yourPassword"

        }

    },

    "offUrl": {

        "url": "http://x.x.x.x/relay/0?turn=off",

        "method": "GET",

        "auth": {

            "username": "yourUsername",

            "password": "yourPassword"

        }

    },

    "statusUrl": {

        "url": "http://x.x.x.x/relay/0",

        "method": "GET",

        "auth": {

            "username": "yourUsername",

            "password": "yourPassword"

        }

    },

    "statusPattern": "\"ison\":true",

    "pullInterval": 1000

}

Fun Things to Do

Alexa

  • Create an Alexa routine “Alexa, it’s time for bed” for the nursery – which will turn off the lights & TV, turn on the night light and ceiling fan, say “Good night (insert baby name here)” and play relaxing lullabies from Amazon Music.  All from one command.
  • Change the “Wake Word” in Alexa settings to “Computer” and be more Trekkie.   “Computer, show me who’s at the front door”

Create HomeKit Automation

  • When the thermostat turns on the A/C, activate specific ceiling fans in the house, turn off whole house fan
  • Turn on the porch light if the UniFi or Ring camera detects motion
  • Turn off TV at 1am (for you fall-asleep-while-watching-TV folks)

Create HomeKit Scenes

  • Movie Scene – Turn off all the lights, set a table lamp to 10% brightness
  • Bright Scene – Turn on all downstairs lights (create a zone called Downstairs and add every light to it)

Pranks

  • Turn on random lights when you’re away from home to startle your family.  I’m not responsible if you get in trouble with your significant other. 😉
    You probably shouldn’t do it anyway if members of your household are easily rattled…or if your house is known-haunted.

Rooms and Zones

By creating “Rooms” to locate your smart devices under, you can have several lights/lamps in the Living Room; ie: table lamp, ceiling light, floor lamps, etc.  By placing them in the “Living Room” room, you can say “Turn on all living room lights” instead of turning on each one individually.

Same with Zones, by having an Upstairs, Downstairs, Outside zone, you can place specific items in those zones to control such as “Turn off downstairs lights” and all lights that are in the downstairs zone, regardless of which room they are in, will be turned off.

Links

The following links are provided to use at your own risk, I used them for researching various plugins and what would work for me but they are 3rd party links and are offered as-is.
Google is your friend when researching automation plugins with HomeBridge.

homebridge.io

HomeBridge Wiki [https://github.com/homebridge/homebridge/wiki]

HomeBridge Plugins (verified) [https://github.com/homebridge/homebridge/wiki/Verified-Plugins]

137+ Best Homebridge Plugin Software Projects [https://opensourcelibs.com/libs/homebridge-plugin]

KasaSmart [https://www.kasasmart.com/us]

Bond Home [https://bondhome.io/]

Screenshots

Disclaimer: As an Amazon Associate, I earn from qualifying purchases when you visit the links on this page (which are directly linked to Amazon product pages).

Be the first to comment

Leave a Reply