Hi,
I had issues getting the code in this thread to work (even with the new random user created).
I kept getting '400 Bad Request' errors.
Eventually I got it to work by adding a couple of extra headers:
Host: [Bridge IP Address]
Content-Type: text/htmlIt seems that the latest bridge firmware may be stricter on what you must send.
---------------------------
For a TOGGLE, you could send a GET to /api/
[UserID]/lights/
[LightNumber]It will return the current settings for that light in JSON format
Parse that to see if
on is true or false
Then send a PUT command with the opposite.
Last edited by GJC33 on October 21, 2020 10:16.