Maker API with RGB secondary command

Anyone know by chance how to issue a setColor command with the maker api? I'm able to send the colors like "red", "blue" etc as the primary command. But for setColor command (see below the commands available) I don't know how to send it info like #FF00FF for the RGB color. I can use HSL but that's three commands instead of one.

Thanks in advance for the REST end point info if you know the format. I'm looking for something like this:

You can send HSL in one command...

I'm also interested in the Hex if it's possible. I never found a way. So I use some javascript to convert Hex to HSL and send that instead :smile:

1 Like

ok, so it's a POST (not just a simple url through a chrome browser) with that json, thanks! I will try it out with postman and then add it to the flutter app.

Hmmm, I seem to not be using Postman correctly to post this json. I'll keep looking through the maker api documentation, but I don't see any example of sending this. I do see this example of sending multiple secondary commands to a setCode:

But is there some way to do that for HSL also? I tried just putting "setColor/3,99,50" but that fails.

My postman fails with this repsonse:

@bravenel, I get an error in the logs:

Is this maybe something wrong with my Hubduino code? I wouldn't think so, but just making sure that's out there in case this is my fault. I did just write the neopixel driver for that.

This was my URL in chrome:[hue:4,saturation:100,level:100]?access_token=123412341234

Oh, what I posted above is wrong.

hue, et al, should be "hue", et al

Added color map for setColor command in Maker API, and URLdecode for secondary params. To use the color map, this is the format: {"hue":88,"saturation":50,"level":90} "

1 Like

sorry! I'm REALLY slow today. I tried this with and without : or , but neither work:["hue":88,"saturation":50,"level":90]?access_token=12341234


Curly brackets vs square brackets?

1 Like

Yes, it must be curly braces. This is json object.


Ok, sorry! I've never passed a json list like this in chrome URL (Normally I use postman to test REST and then flutter dart to json encode the body). This worked!{"hue":3,"saturation":99,"level":80}?access_token=123412344

Note that chrome did the url encoding for me, which was nice.

Thank YOU for your patience!

1 Like

Is there any way to setColor with RGB by the way?

There’s no way to just send a colour name ?

Not with Maker API.

Maker API only accepts hue/saturation/level.

You can send a limited set of colors. It just seems like sending the rgb value wouldn't be any harder than parsing the hsl info?

Below you see the commands that are supported, but you also see that the color hex value is already part of the object as well. Was wondering if that was something we could "set".

[{"name":"rgbSwitch1","label":"Color Sign (rgbSwitch1)","type":"Child RGB Switch","id":"322","date":"2020-06-22T22:01:40+0000","model":null,"manufacturer":null,"capabilities":["Switch","SwitchLevel","ColorControl","Sensor","Actuator","Light"],"attributes":{"RGB":null,"dataType":"ENUM","values":["on","off"],"color":"#7a8580","colorName":null,"hue":null,"level":"94","saturation":null,"switch":"on"},"commands":[{"command":"blue"},{"command":"cyan"},{"command":"daylight"},{"command":"green"},{"command":"magenta"},{"command":"off"},{"command":"off"},{"command":"on"},{"command":"on"},{"command":"orange"},{"command":"purple"},{"command":"red"},{"command":"setColor"},{"command":"setHue"},{"command":"setLevel"},{"command":"setSaturation"},{"command":"softwhite"},{"command":"warmwhite"},{"command":"white"},{"command":"yellow"}]}]

A hex option would definitely be convenient.


This option will be in the next release. It will allow a parameter to setColor in the form 0x15fe21 {"hex":"15fe21"}, like this example:{"hex":"15fe21"}?access_token=xxxx

The hex digits may be upper or lower case, and are assumed to be the RGB values for the color.


The device page shows hue as being a number of 0-100. But hue in HSL colors is 0-360.

How are people converting from 0-360 to 0-100?

edit: nevermind. I just wrote a conversion. Not sure why I had a brain fart there and didn't think of the solution that was obvious!

1 Like

Is it as simple as dividing the HSL hue by 360 and multiplying by 100?

1 Like

That’s what I’ve done. And the resulting color matches the expected color. Well as good as Sengled can match :rofl:

1 Like