Blinking HUE lights (new feature for your projects)
Hello everyone,
If you're kind of like me, you'll never be satisfied with the basic implementations of your systems.
So today, I've decided to explore the Philips HUE official API.
I know that bOS has already implemented HUE control, but I wanted to use some cool features that are kind of hidden on normal apps: blinking lights!
The purpose of this implementation, is using Philips HUE blinking lights for multi purposes, like blinking when someone rings the door, etc.
You can rely on IFTTT to do that, using the WebHooks, but if you're like me, prefer to keep the most on local network and don't depend on external services.
In this example, what you'll get:
- Access Philips HUE API to create a username key
- Extract the username key
- Create a HTTP device on bOS
- Create a command to send the blinking command to Philips HUE hub
Suggestions: access your Philips HUE app, disable DHCP, and place a fixed IP address on your network so you can point to the correct IP address every time.
Step 1:
- Access the Philips HUE IP address
https://hub_address/debug/clip.html
- Create a username key
URL: /api
Message Body: {"devicetype":"comfortclick#dev"}
Click on the hub link button (the top round button on the hub with Philips written on it)
Click on POST
- Extract the username:
Copy the given username to a safe place, you'll need it for every command.
On my implementation, I want to blink all the lights on a specific light group, so I'll fetch the group number.
Step 2:
- Get the group ID's
URL: https://hub_address/api/your_username/groups
Message Body: leave the message body empty
Click on GET
In my case, the light group I want is ID 1
- Test the communication
URL: https://hub_address/api/your_username/groups/1/action
Message Body: {"alert": "select"}
Click on PUT
If it blinks once, perfect. Now you're ready to move to bOS.
There's two available commands for blinking: just once, or several. Depending on what you want, you'll have to change the Message Body for the correct code:
{"alert": "select"} will cause a short blink
{"alert": "lselect"} will cause several seconds of blinking
If you need to blink several times, you'll need to use {"alert": "lselect"} on the Message Body.
Step 3:
- Create HTTP device on BOS
Enable the HTTP device
Host URL: https://hub_address/api/your_username/groups/1/action
Create a Command, call it "Blink HUE"
Change the command method type to PUT
On Put Data, insert: {"alert": "lselect"}
That's it! Use the command as you want on your project.
On my case, I have the hue blinking when someone rings at my door.
If you want to explore other possibilites, please read the Philips HUE API, available for free. You can do the same on single lights, etc.
I'll post the example on the Examples Page of Comfortclick.
Btw, don't forget to at least say thanks! Most of us here, are either professionals or simple home users. I notice that most of the times someone posts something interesting, no one really cares. So don't just use the examples and don't pretend that you don't care. A simple "Thanks" is more than enough. Don't forget that every example posted here is not paid, it mostly depends on the time and patience of some members.
Happy easter.
Best regards
Customer support service by UserEcho
Hi Ricardo,
As usual, just perfectly well done and documented !
Happy Easter and stay safe,
Fabien
Thanks Fabien!
Btw, you can skip the step of getting a username, if you already have the HUE configured on bOS. That's because you can use the username already provided on the HUE node configuration, under the label "Username".
Happy Easter, keep safe too.
Ricardo
Hi!
I didn't know Philips had an API. i'm defenitely gonna have a look. Thanks!!
Best regards.
Hi Noel,
Yes, Philips HUE has an official free API, and it's pretty forward to use.
I was looking for this blinking option, and found out on IFTTT a recipe that does that. But I didn't wanted to rely on IFTTT, but rather rely on my local equipment directly, so I've searched for the HUE API, and found the option of blinking once or several (during 15x).
And as I understand that bOS sometimes can't fulfill the full spectrum of some of the available API's, I've deviced to put my hands on. A didn't found any blinking option on the official Philips HUE app, so using the API was the best option.
Best regards
Hello,
again, amazing work Ricardo! Very interesting integration and very well documented! The example is already live on our web page so even more people can download it and test it out for themselves!
Happy holidays and stay safe!
Nice feature exposed here Ricardo. Thanks a lot.
Thanks Laurentiu :)
Best regards