Use Amazon Echo to Control Wireless Power Outlets

This is part 3 for my guide on how to control cheap wireless power outlets using a Amazon Echo and a Raspberry Pi. Part 1 covered Siri and HomeKit. Part 2 covered the Google Home which I plan on improving since ha-bridge works with Google Home. This tutorial assumes you already setup the outlets.

Currently the Amazon Echo 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)
  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. If you get an error message  like: “ Address already in use“, then you need to change your port for ha-bridge.
    sudo java -jar -Dserver.port=8080 ha-bridge-3.5.1.jar
  7. If you are running apache, follow these steps if you want to change it and run ha-bridge on port 80
  8. In a web browser, go to your pi’s ip address. If you are using a custom port, be sure to change change :80. You should now see the ha-bridge gui interface
  9. 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
  10. Be sure to use your outlet codes and add the device
  11. Click on My Echo to open up your amazon echo configuration page.
  12. Click on Smart Home then Discover devices. Your echo will search for the ha-bridge and should discover your device
  13. You should now be able to tell Alexa 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.

Description=HA Bridge

ExecStart=/usr/bin/java -jar -Dserver.port=80 /home/pi/habridge/ha-bridge-3.5.1.jar


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

Also published on Medium.

6 thoughts on “Use Amazon Echo to Control Wireless Power Outlets

  1. i still haven’t gotten my 315Mhz outlets to work with codesend etc… but this tutorial worked perfectly with the weird solution i currently have in place.
    thanks Tim!

  2. Hi Tim

    We may have a need to control a specific Ceiling Fan (with Lamp) – which itself has a IR remote controller to switch / adjust speed and lamp ON/OFF control.

    Logitech Harmony Hub has IR and is compatible with Echo – do u think the Logitech Harmony can learn fan IR remote codes ?


    1. Are you able to capture the rf codes from the ceiling fan remote? If so, you should be able to set the harmony remote to ha-bridge. Currently I have the light button on my harmony remote controlling my lamps.

      1. Hi Tim

        The fan is a Infrared controlled appliance.

        Is the Harmony remote you mentioned same as a Harmony Hub ?

        Please advise.

Leave a Reply

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