Trying to get my head wrapped around using the API and can’t get this to work. Just trying to change a Hue light’s color and brightness using an API call.
curl -k -X PUT --header "Content-Type: text/plain" \
--header "Accept: application/json" -d "155,100,20" \
Is this possible and I’m not doing it right or is this not a valid way to do that?
Of course it is possible to change the Hue light state via their API (see https://developers.meethue.com/develop/hue-api/lights-api/#set-light-state). The data in your example is not a valid JSON. A valid body should look like this:
May I ask you one question? Why do you want to submit the request manually? Why not make use of the Hue binding?
It’s mostly curiosity but I do have a couple of ideas for automating a few things that would need to send commands from another system. Just theory at the moment.
Where did you get those values for the json info? The link you provide needs a dev account.
I copied the JSON from the link. And yes, you will need an account over there.
I’d rather do the changes via the openhab api rather than the Hue api. This will let me have similar methods for hue lights, zwave devices or other devices if I add other bindings later on.
Oh, yes of course. I should have read your initial post more carefully. Sry to point you into a wrong direction. Maybe you should change the title of this topic to make clear that you want to use the OH2 API …
So the right place to look is here. I guess you have to change
POST and remove the trailing
/state from the URL.