Toggle Lights and Switches with an Amazon Echo Button

0
5207

Facebooktwittergoogle_plusredditpinterestlinkedinmail

I’ve been looking for a while for a button that I can use to integrate into my home automation. I was excited when Amazon announced the Echo Button, only to be disappointed to hear that it can’t toggle a light or a switch. They can be programmed to only turn something on or only turn something off. I’ve figured out a workaround to get it to toggle devices.

They recently had a price drop, so I figured I would just order them just to see if I could get any use out of them in other ways. My first thought after opening them is that they are larger than I had hoped for. However, after discovering that Amazon’s intention wasn’t just to use it as a way to trigger routines, but also play games, their size makes a little more sense. The best part is that I was actually able to figure out a fairly easy way(assuming you’re using Home Assistant), to toggle something using the Button.

Here’s what you would need:

You will need to setup the Echo and the Buttons. I’m not going to go into any detail on how to do that since there are tons of resources on it, and it’s pretty straightforward. If you do need help with it for some reason, post in the comments. The Buttons are pretty much telling Alexa you want to set them up, and she walks you through it.

Next, we need to setup Home Assistant(HASS). First, you need to setup the Emulated Hue Component. This component emulates Philips Hue devices, which can then be added to the Echo. Below is the yaml code I used. The IP addresses are just the IP of your HASS computer. The other settings are explained fairly well in the documentation link for this component. The most important is to have ‘script’ in the exposed_domains list and the ‘off_maps_to_on_domains:’ section.

emulated_hue:
  host_ip: 192.168.45.104
  listen_port: 80
  advertise_ip: 192.168.45.104
  off_maps_to_on_domains:
    - script
  expose_by_default: true
  exposed_domains:
    - light
    - switch
    - script
  entities: 
    script.restart_ha:
      hidden: true

Now, setup the script that will be called when the Button is pressed. The script just toggles a device. In this case, I am toggling my fireplace (because that’s still my favorite project). Of course, you will need to change the ‘alias’, ‘service’, and the line below ‘entity_id’.

toggle_fireplace:
  alias: Toggle Fireplace
  sequence:
    service: switch.toggle
    entity_id:
      - switch.fireplace

Save the config and restart Home Assistant. Then go into your Alexa app. Tap Devices -> Plus button at the top right -> Add Device. Tap Philips Hue, and then “Philips Hue V1 bridge”. It will take just under a minute to search for the devices and it should find that script that you setup. Just follow the steps to finish adding it. After that, the script will show up in Alexa as a bulb that you can turn on or off. And whether you turn it off or on, it will just run that script in HASS.

Finally, we setup the Routine for the Button.

  1. In the Alexa app, tap the menu button at the top left, and then ‘Routines’.
  2. Tap the + button at the top right to create a routine.
  3. Tap ‘When this happens’ and select “Echo Button” and then press your Echo Button and tap “Add”.
  4. Then tap Add action -> Smart Home -> Control Device.
  5. Find the ‘Toggle’ script (In my example, it would show up as ‘Toggle Fireplace’).
  6. Tap ‘Power’ and then ‘Next’ and ‘Save’.

That’s it. When you press the button, your device will turn off if it is on, and it will turn on if it is off. If you need help or have any questions, just leave a comment.

 

* This article was originally published here


LEAVE A REPLY

Please enter your comment!
Please enter your name here