Google Home to Control Wireless Power Outlets

This is version 2 for my guide on how to control cheap wireless power outlets using a Google Home and a Raspberry Pi. This guide is a much better method than my first attempt using IFTT. This tutorial assumes you already setup the outlets.

Related Tutorials

Currently the Google Home does not support controlling devices within your network if they are not a supported device. Luckily for us a great open source project called ha-bridge solves this issue.  Ha-bridge works by emulating the Philips Hue api to other home automation gateways such as an Amazon Echo or Google Home. It can handle basic commands such as “On”, “Off” and “brightness”. It’s pretty amazing how they were able to reverse engineer the hue api. Ha-bridge is primarily written in Java and has a web interface.

  1. If you haven’t already be sure to follow my guide on setting up the cheap wireless power outlets to work with a raspberry pi.
  2. Login to your raspberry pi terminal and create a directory for ha-bridge
    mkdir habridge && cd habridge/
  3. Download jar file for ha-bridge (Latest release)
    wget https://github.com/bwssytems/ha-bridge/releases/download/v3.5.1/ha-bridge-3.5.1.jar
  4. Install java and wait….
    sudo apt-get update && sudo apt-get install oracle-java8-jdk
  5. Run the jar executable
    sudo java -jar -Dserver.port=80 ha-bridge-3.5.1.jar
  6. Port 80 is required for the Home to discover ha-bridge, so if you get an error message  like: “java.net.BindException: Address already in use“, then you need to change whatever is using port 80 to something else. If you are running apache, follow these steps.
  7. In a web browser, go to your pi’s ip address. http://192.168.1.11:80. You should now see the ha-bridge gui interface
  8. Click on Manual Add and follow the example below. When choosing Execute Script/Program, the program path needs to in the On Url/Off Url input
  9. Be sure to use your outlet codes and add the device
  10. You should now be able to test turning the outlets on/off from the gui interface.
  11. If the outlets work, open up the Google Home app on your mobile device. Go to Home Control and click the plus icon. Choose Philips Hue and wait for it to discover your Raspberry Pi running ha-bridge.
  12. You should now be able to tell your Home to turn on or off the lamps.

If you would like to have ha-bridge start automatically, follow my guide to setup Systemctl. Below is my service config to start ha-bridge.

[Unit]
Description=HA Bridge

Wants=network.target
After=syslog.target network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/java -jar -Dserver.port=80 /home/pi/habridge/ha-bridge-3.5.1.jar
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

Please let me know in the comments below if you have any questions or feedback.


Thanks for reading. Make sure you follow me on Twitter to stay up to date on the progress of my side projects T.LYWeather Extension, and Link Shortener Extension. If you are interested in the tech I use daily, check out my uses page.  

19 thoughts to “Google Home to Control Wireless Power Outlets”

  1. This guide is actually pretty cool!! I was looking for an alternate since I didnt like the idea of having a published google doc with my rf codes. I tried this out on my setup which already has a hue bridge as well as a raspberry pi for the RF outlet lamps. I only had to relink my hue bridge in my google home app and all the lamps in the HA bridge service show up as well. This allows all lamps in a room (whether there on the Philips hue or on the habridge) to be switched off with a single command. Thanks so much!

      1. The only issue I’m facing is if there is more than one RF controlled light in the room. Sometimes only one of those or none will come on. I suspect it might be the rPI/RF chip that gets too many commands from habridge at the same time so it may not had a chance to send a previous command out.

          1. Do you add the sleep between commands into HA bridge? Something like ‘/var/www/html/rfoutlet/codesend349500 && sleep 1’?

  2. I tried adding the sleep command. That didnt work for me. It would either turn on one of the lights or none. I was thinking that maybe it would be easier to modify the codesend.cpp to take multiple arguments for the RF codes and add a sleep internally between issuing commands.

  3. Unfortunately this method no longer works since in the Google home app update, Phillips Hue will not connect to a local hub anymore, it makes you sign in to an account.

  4. Any update on getting this to work since December 2017? I decided to give this a go since it seemed really cool but didn’t realize its no longer working. Just unable to have habridge able to link with google assistant since the changes… The google sheets method seems possible but I don’t think I’m able to have IFTTT trigger multiple updates at once so I don’t believe I’m able to lump 3 lights together in a single call.

      1. Sorry about the late reply…
        Same issue the user “SAM EMORY” mentioned, “Unfortunately this method no longer works since in the Google home app update, Phillips Hue will not connect to a local hub anymore, it makes you sign in to an account.”

        As a result if I try to use HAbridge and connect to the phillips hue app it either doesn’t detect the device (tells me I need to press the button on the actual phillips hue hardware, that I obviously don’t have in this setup) or if I manually connect it via IP, it tries to force an update on me (which I obviously can’t do since again I don’t have a real Hue Hbridge).

        I think I wouldn’t have this issue if I had an older version of the phillips hue app but not completely sure.

          1. Any NEW info on “Sam”, “Ken” AND MY problem? I too have just tried to set up the Google Home and it wants me to sign into MyHue.com account (which I set up) when I try to add the bridge. But as Ken & Sam state, it doesn’t detect the legit Hue bridge and therefore we’re stuck.

            ALSO, I have an Alexa set-up (I posted yesterday, but that issue was resolved), can I run the SAME HA-Bridge (set-up on port 8080 in my case) to function with EITHER Google Home and/or Alexa??? Of course this only matters IF I get the Google Home to work without the physical Hue bridge. T.I.A. — MDS

          2. Unfortunately, I have never used IFTT. I set up an acct and tried to follow your steps, but the UI appears to have changed since to posted the tutorial, i.e. I don’t see the option under Google Drive to “Add a row to spreadsheet” The only option I get when I select Google Drive is “Upload file URL”.

            What are the chances of updating the IFTT-Google Home tutorial with the current UI of IFTT???

Leave a Reply

Your email address will not be published. Required fields are marked *