Maker API setColor

Trying to use the Maker API for setColor. Is this implemented for Zigbee RGBW Lamps?

Error:
dev:7862019-08-04 10:37:59.848 errorgroovy.lang.MissingPropertyException: No such property: hue for class: java.lang.String (setColor) app:2542019-08-04 10:37:59.798 debug[configure, off, off, on, on, refresh, setColor, setColorTemperature, setHue, setLevel, setSaturation, startLevelChange, stopLevelChange] app:2542019-08-04 10:37:59.791 debug[hue:31,saturation:100,level:100] app:2542019-08-04 10:37:59.789 debugsetColor app:2542019-08-04 10:37:59.785 debugfindDevice called app:2542019-08-04 10:37:59.783 debugsendDeviceCommandSecondary called

Set color takes a map, here it's being called with a string...

Yup... which doesn't translate to a URL Query string. So how can this be used through Maker API?

What would be nice and I don't even mind doing it would be some usage docs on Maker API with some basic examples for things such as setColor :slight_smile:

Did you ever get an answer to this @jeubanks ?

Nope. Still waiting.

1 Like

You should be able to via setHue and setSaturation.. it’s 2 commands instead of 1 but it will get you there

And setLevel. That's how I'm doing it today, so it isn't a critical issue. Just kind of annoying - 3 commands instead of 1.

1 Like

Will someone please answer the original question. Can a color light be set with a single command or does it require 3 separate commands?

I’m using 3 commands. Don’t think it is possible in a single command yet.

Yes. It used to take 3, now it can be done with 1 ( because @bravenel is the greatest and added the capability) - see below.

" 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}"

Example I have been using on my one and only color bulb to set color to red when the alarm is on: {"hue":99,"saturation":100,"level":25}

2 Likes

Nice - I missed that completely. That simplifies a bunch of my sequences!

@bravenel hello Bruce I tried several time to use the api maker to send a command to a color bulb, this is what I used:
“http://192.168.2.xx/apps/api/621/devices/190/setColor/{“hue”:88,”saturation”:99,”level”:35}?access_token=abc…”
And this is from the log:
2022-08-17 11:16:41.341 am errorgroovy.json.JsonException: expecting '}' or ',' but got current char '“' with an int value of 8220 The current character read is '“' with an int value of 8220 expecting '}' or ',' but got current char '“' with an int value of 8220 line number 1 index number 1 {“hue”:88,”saturation”:99,”level”:35} .^ on line 467 (method sendDeviceCommandSecondary)

Could you please tell me where I’m going wrong, I have also tried the {“hex”:”DECAFE”} and get the same error

Thanks in advance Dan

That looks like a broken quote(s). When you copy/paste strings on some systems (I think Macs in particular), they want to convert the straight quotes (ASCII 34) to a fancier typographically attractive version (8220) for pretty documents, but that's not good for JSON and most programming languages. Don't use Word or anything other than a plain text editor to hold text, and know that if you copy text from posts here that look like this {"hue":88,"saturation":50,"level":90} instead of this {"hue":88,"saturation":50,"level":90} (notice the monospaced type face) it will likely be broken.

Try using this (your URL fragment with quotes fixed, formatted to preserve quotes):

http://192.168.2.xx/apps/api/621/devices/190/setColor/{"hue":88,"saturation":99,"level":35}?access_token=abc…
1 Like

@toggledbits, thank you so much, that worked excellent. I tried both and got the results back, I would never thought the fancy quotes till you pointed that out, I was using iPad with note pad never again. :smile:

2 Likes