Color changing bulbs?

Thanks - I’ve looked at those (appreciate the links), but my question is How do I send a correctly formatted string using the API tool? so I can test…

(Nothing in the documentation that I can find, shows how to send a JSON string via the API tool - perhaps I’m missing something?)

I think you have to literally use the mentioned json (except I missed the first {). This should work if you enter the right device id:

{
        "method": "hub.item.value.set",
        "id": "12345",
        "params": {
            "items":{
                "<uid of bulb>": {
                    "value": {
                        "wwhite":10,
                        "cwhite":10,
                        "red":10.
                        "green":10,
                        "blue":10,
                        "amber":10,
                        "cyan":10,
                        "purple":10,
                        "indexed":10
                    }
                }    
            }
        }
    }

oh, and maybe only enter the color which are valid for your bulb.

Thanks - it’s not the API I’m referring to, but rather the web-based API Tool (Ezlo API Tool). I use it to test the API calls before I code them and use the web sockets API.

The web tool only has a single line where you can enter a value string. So essentially, I need to paste in only:

{
“wwhite”:10,
“cwhite”:10,
“red”:10.
“green”:10,
“blue”:10
}

in a single line field.

I think you might have been suggesting to use the “Custom” command in the API tool? If so, instead of hub.item.value.set, select custom and paste in the raw JSON.

This works to set the bulb color:

{
“method”: “hub.item.value.set”,
“id”: “ID”,
“params”: {
“_id”: “63e6b977077e901241ff6392”,
“value”: {“red”:183,“green”:10,“blue”:234,“cwhite”:0,“wwhite”:0}
}
}

It doesn’t address how to enter a JSON string in the value field, but it’s a workaround for testing.

Thanks.

The web-based API tool is pretty weird here. The json format depends on the device type, but the UI doesn’t let you select a type. Still, the type is inferred, as the error you show says 'Unexpected Json format for value type ‘rgb’. I can better understand why you’re raising the question in the first place.

The only think I can think of is trying the value.set api on a normal on/off light, by using a boolean value. Maybe if you can get that simple input work, you can work out the right string for rgb.

Thanks. I’ve tried every permutation I can think of. I’ve “stringified” the JSON string, added escaped quotes, etc., etc., Nothing seems to work.

The other value types (int, boolean. etc.) all work as expected and I can use those to easily turn devices on / off, etc.

Fortunately the Custom command exists. I’ll use it for now.