Ezlo HTTP API Set RGB Color How?

I want to be able to send HTTP commands from an app to my Ezlo Plus hub to change the colours of an RGBW bulb.

However I cannot find any documentation or examples.

My best guess for what the command might be isn’t working and I get the below error back in the browser:

https://Ezlo-IP:17000/v1/method/hub.item.value.set?_id=60e47f4e120bab11f9d77f5e&value_rgb=#ff0000

or

https://Ezlo-IP:17000/v1/method/hub.item.value.set?_id=60e47f4e120bab11f9d77f5e&value_rgb=ff0000

I get this error:

{“error”:{“code”:-32602,“data”:“rpc.params.wrong_field”,“message”:“Wrong field of object”,“reason”:“Unexpected Json format for value type ‘rgb’: null”},“id”:“60e89ee6120bab12443706bb”,“result”:{}}

Sure I have the correct item _id number for the device.

Looking in the Online API Tool for the bulb I see this when I set it to Red in the Vera app:

image

Anyone know how to do this ?

Thanks

Hello!

We are going to give it a look and let you know.

Regards.

1 Like

Hello @Oleh can you or someone on your team help us with this request?

Thank you!

Oleg is already aware.

I just wondered if anyone in the forum knew how to do this.

Thanks.

I think I know how to do it for the WebSocket, because it’s all JSON. If I had to guess for HTTP, though, I’d first try:

https://Ezlo-IP:17000/v1/method/hub.item.value.set?_id=60e47f4e120bab11f9d77f5e&value=%7b%22red%22%3a255%2c%22green%22%3a0%2c%22blue%22%3a0%2c%22cwhite%22%3a0%2c%22wwhite%22%3a0%7d

The value parameter is the URL-encoded JSON string {"red":255,"green":0,"blue":0,"cwhite":0,"wwhite":0}

1 Like

Hi

Just tried that and the browser returns this:

{“error”:{“code”:-32602,“data”:“rpc.params.wrong_field”,“message”:“Wrong field of object”,“reason”:“Unexpected Json format for value type ‘rgb’: "{\"red\":255,\"green\":0,\"blue\":0,\"cwhite\":0,\"wwhite\":0}"”},“id”:“60e8c6e7120bab124281ffac”,“result”:{}}

Well, it was worth a shot. Maybe they’ll update the documentation.

You can see the value object format like that in the API Tool before you expand it:

image

All though the colours are in a different order. I just tried them in that same order in the URL but still the same.

https://Ezlo-IP:17000/v1/method/hub.item.value.set?_id=60e47f4e120bab11f9d77f5e&value={"blue":0,"cwhite":0,"green":0,"red":255,"wwhite":0}

I also tried with both “&value=” and “&value_rgb=”

I would expect that; the order of keys doesn’t usually matter in objects (although you never know how the API might be parsing the data). There are a number of items like this in the API docs that need to be further documented. There’s just too much that’s left to “discovery”, and experience has also shown that if it’s not documented, in the absence of specification there will be variances in functionality/interpretation over time as well. That list of items and values should explicitly describe the structure (for both HTTP and WebSocket APIs), acceptable range of values, and the meaning of values in the range. It’s got default values, which is good. Needs the rest.

Another question in this call is the meaning of cwhite and wwhite. By default, I’d assume that they mean the same thing that they did on Vera (wwhite is 2000K-5500K range scaled 0-255, and cwhite is 5500-9000K range scaled 0-255), but (a) nobody who hasn’t developed for Vera would know that, and (b) who knows if that’s even a correct assumption.

Indeed we are just left guessing and not knowing.

From that link you just posted:

image

I did have a poke around that documentation site earlier, but could not find the answer to this question.

@cw-kid,
here you can find description for RGB value type
https://api.ezlo.com/devices/item_value_types/index.html
I will share several examples here.

Thanks

I saw that page before but it doesn’t help me.

Thanks

I will share several examples here asap.

1 Like

Hi cw-kid,

you should use the POST request with /v1/request. The /v1/method GET is too limited for commands like this.

Cheers Rene

I hope not.

Let me try it in Postman app then with Post.

Why don’t they make this easier ? Grrr !

I don’t know how to do this type of request in Postman with Post.

I can get values back from devices like temperature sensors or a switches ON / OFF state using POST.

But I am not sure how to format the JSON payload for this RGB SET request.

It probably wants to be something that looks more like this:

But I don’t know what the correct JSON data format should be ?

NOTE - In the first screen shot on the left hand side you can see all those other Requests that SET things. They are all GET single one line HTTP commands.

For Ezlo HTTP API, this is a working POST request but its for retrieving a value from a device, in this case a temperature sensor value. Rene you were the one who showed us how to do this.

I still haven’t seen a simple one line HTTP command to get a devices value ???

On Vera HTTP API (Luup Requests) you can just use a GET command:

http://Vera-IP/port_3480/data_request?id=variableget&DeviceNum=678&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature

I just got it working with POST in Postman app using this JSON data, my bulb changed from blue to red !

URL =

https://192.168.0.11:17000/v1/method

JSON Data =

{"method": "hub.item.value.set" , "id" : "_ID_" , "params" : {"_id" : "60e47f4e120bab11f9d77f5e" , "value" : {"red":255,"green":0,"blue":0,"cwhite":0,"wwhite":0}}}

Its a start at least, but I really need to be able to just send a single HTTP command (GET) in to the Ezlo hub.

But maybe this needs to be POST which sucks.

@bill_v

Can I send out a POST command from Home Remote dashboard app? I think all the ones you helped me with before were just GET.

Thanks

It works on Vera firmware controllers with a single GET HTTP command.

I can change the R,G,B colour on a Fibaro RGBW mobile with this command:

http://VERA-IP:3480/data_request?id=action&output_format=json&DeviceNum=176&serviceId=urn:micasaverde-com:serviceId:Color1&action=SetColorRGB&newColorRGBTarget=255,0,0

But seems the new Ezlo HTTP API no longer allows for this potentially.

Yes. You can send a POST request with a Home Remote plugin. It’s not much different than the GET. Just change “http.get” to “http.post” & be sure to include your Content (data) as the 2nd argument to the function. You can read more about it here: