Saturday, February 25, 2017

Home Assistant + Amazon Dash + Multiple Lights

So it's been a while...my bad.


I've been up to a lot of different Smart Home work here and there and wanted to share one that was driving me a bit crazy because I couldn't find a quick answer online, using Home Assistant, an Amazon Dash button, and turning on multiple lights with one API call.

The scenario I was working on was turning on a couple lights in a room for someone who wouldn't have access to my smart home hub because they're cavemen and don't have smart phones....I know. It seemed like a good scenario to bring in a dash button. Ok, fine, it was just an excuse for me to see how well the dash buttons would work.

This post isn't a walk-through for using Dasher or setting up Home Assistant, in fact I'm going to assume you've already got these things setup. If you do have questions feel free to ask them.

I am running Home Assistant (HA) at home running on a Raspberry Pi 3, and of course the Play-Doh Dash Button. I have HA setup with my lights just fine and they also have an easy REST API that we can utilize for this. Woot!



The main issue was I couldn't find anything saying how to turn on multiple lights (aka a group) with a single API call so I started using Postman to do some testing and luckily it didn't take long.

Here's the simple example of turning on multiple lights with a single call:

The key area is the: "body": {"entity_id": "light.light_1, light.light_2, light.light_3"}

The examples that I saw online were only showing one light but you're able to string them together to turn on multiple lights. BOOM! Problem solved.

References for the curious:


No comments:

Post a Comment