How to control Philips hue light from Blynk app?

Hello everyone,

I assumed I would find examples of how to control Philips Hue lights directly from the blynk app, but unfortunately I haven’t. There is a reference to Philips Hue in the docs section about webhooks, but nothing specific… I’ve also found some topics abut homebrigde with references to Philips Hue, but that seems to be tailored to supporting hardware which Homekit doenst support yet and I’m an android user.

Has anyone hooked up their Philips Hue lights to their blynk server and care to share a short how to?

Thanks in advance.

This might interest you.

I’ve seen that topic, but I dont have any need for homekit support. So I was hoping there is a more direct way to interact with my lights? Philips has provided a RESTful api, is that usable?

Possible, check out Blynk’s Webhook widget.

Oke so I found the URL for one of my lights and I am able to turn it on and off and set the brightness using the CLIP API Debugger (provided interface by Philips), with the message body {“on”:true, “bri”:100}.

But I cant get it to work in the webhook widget… Set the output to V0 (not sure why it needs an output), URL same as in the CLIP API Debuger, content type as json and body as {“on”:true, “bri”: /V1/} where V1 is linked to a slider.

I also want the true/false to be set by a button, but not sure how to…

Don’t bother with body or PUT they are not needed, just use GET.

Work out the standard url for a browser and confirm it works.

Ignoring the on / off for now.

If V1 is the slider and V2 is your webhook widget in the url it will need to end /pin/ (literally /pin/ not something like V2, D1 etc).

In the slider:

Blynk.virtualWrite(V2, integer2send2lamp);

I think I do need PUT, can’t find anything about GET and setting the light state… Also I can’t set the brightness directly using a URL.

Also I want to control the light from the app, not a physical slider so I guess the virtualWrite bit is not applicable?

I have never found an API call that doesn’t work with GET on the Blynk Webhook widget.

If you mean the Blynk app then it would be the Blynk slider.

You just need to work out the url for the json format.
I send json of 6 variables via a url and Webhook.

For the url’s we use that require json the end of url would look like this based on what you said about the CLIP API Debugger:

&json= {"on":true, "bri": /pin/}

The API works with GET, but I assumed that is used to fetch data? And PUT is used to push data?

And yes I would like to control all my automation from one place (ie Blynk) so I’d like to turn on certain lights and dim them with buttons and sliders in the app, not from a hardware device.

I’m not sure how to figure out the URL for the json format?
I used as the url in the debugger and {“on”:true, “bri”:100} as body, this is unfortunately where my current knowledge ends…

No Blynk threw away the rule book away on PUT and GET. GET with Blynk will do BOTH.

The slider is in the app not a physical slider.
Set webhook as GET with no body and try this url{"on":true,"bri":100}

You can just sync the webhook in Blynk_connected() to test it.
If it works we can then code up the slider to do it.

The webhook thinks the URL is formatted wrong… and if I try this in chrome I get the following error:

[{“error”:{“type”:3,“address”:"/lights/2/state&json=%7B%22on%22:true,%22bri%22:255%7D",“description”:“resource, /lights/2/state&json=%7B%22on%22:true,%22bri%22:255%7D, not available”}}]

Try again, there was an extra backslash.

I typed it myself due to the very long and cryptic username, still no luck…

Don’t try typing, use cut and paste.

Paste the message now from Chrome and presumably webhook accepts the format.

Actually that should say Blynk, Binance,Thingspeak and EmonCMS etc don’t need a PUT and will work in a browser. That’s becuase they all use tokens and the API for your light might not be clever enough to work with a browser.

That still leaves me kinda lost…
I got it all nice and working with the CLIP API Debugger and their example, but transferring that to the webhook is a mystery… Has no one wanted to control their hue lights directly from the Blynk app?

Feedback for this.

Might have to consider PUT and BODY but try above first.

What message from chrome and where do you want me to paste it? in the browser or in my app in the webhook?