LIFX Developer Zone

API can get status info, but changing state always times out

I am using a third party software and just making simple httpPut and Get calls to change the power state of a light

When I make the call directly to ‘https://api.lifx.com/v1/lights/left:Lamp%20Left’ I am returned a JSON with all of my light information, and it all looks accurate. However when I try to call ‘https://api.lifx.com/v1/lights/label:Lamp%20Left/state’ I get a response saying that the status of each of my lights is timed_out

Any ideas what could cause the lights to show connected but not recieve a call to set the power to on?

This is also my first post and delve into the LIFX API so bear with me if I didnt use the proper terminology.

Here is an example result from the call for state change
{
“results”: [
{
“id”: “d073d53c3e78”,
“status”: “timed_out”,
“label”: “Lamp Left”
}
]
}

And an example result from the call to get info
}
[
{
“id”: “d073d53c3e79”,
“uuid”: “023613ce-e816-4a92-9794-9fabf8cf068e”,
“label”: “Lamp Left”,
“connected”: true,
“power”: “off”,
“color”: {
“hue”: 0,
“saturation”: 0,
“kelvin”: 3500
},
“brightness”: 1,
“effect”: “OFF”,
“group”: {
“id”: “5a824dcf1ec0e6ef73737901bf3f9163”,
“name”: “Bedroom”
},
“location”: {
“id”: “c49a34f9b8634494d739fbd5c021aa6d”,
“name”: “Home”
},
“product”: {
“name”: “LIFX Mini”,
“identifier”: “lifx_mini2”,
“company”: “LIFX”,
“capabilities”: {
“has_color”: true,
“has_variable_color_temp”: true,
“has_ir”: false,
“has_chain”: false,
“has_matrix”: false,
“has_multizone”: false,
“min_kelvin”: 2500,
“max_kelvin”: 9000
}
},
“last_seen”: “2019-12-31T18:40:33Z”,
“seconds_since_seen”: 0
}
]

I greatly appreciate any help!

I was passing the params dictionary with single quotes instead of double quotes, who knew it would be so picky

Hi,

JSON doesn’t allow single quotes.

https://www.json.org/json-en.html

1 Like