SetState stopped working...maintenance? (SOLVED)

I’ve been using setstate for a while and it seemed to be working for a while and now it’s saying the requests are OK however it’s not actually changing the bulbs.

Strangely enough the brightness changes correctly… just not the colors.

It looks almost like maintanance is being done as I’m seeing new things in the list bulbs inside the product object.

Here is the output from my program… it should make sense:

Wed 7th Oct 16:37:51: Setting scene from URL to day
Wed 7th Oct 16:37:51: ----> Setting group:Hall,group:Living Room,group:East Side,group:Nats Bedroom to day in 3 secs time

Bulbs: group:Hall,group:Living Room,group:East Side,group:Nats Bedroom
Kelvin: 4700
Brightness: 45 %

Wed 7th Oct 16:37:51: --++> setColor was sent to “group:Hall,group:Living Room,group:East Side,group:Nats Bedroom” with options hue: saturation: brightness: 0.45 kelvin: 4700 power: in a duration of 3 seconds
https://api.lifx.com/v1/lights/group:Hall,group:Living%20Room,group:East%20Side,group:Nats%20Bedroom/state
array(4) { [“kelvin”]=> string(4) “4700” [“brightness”]=> float(0.45) [“duration”]=> string(1) “3” [“power”]=> NULL }

Array
(
    [results] => Array
        (
            [0] => Array
                (
                    [id] => d073d500d495
                    [label] => Centre
                    [status] => ok
                )

            [1] => Array
                (
                    [id] => d073d500da2c
                    [label] => Right
                    [status] => ok
                )

            [2] => Array
                (
                    [id] => d073d500da3d
                    [label] => Left
                    [status] => ok
                )

            [3] => Array
                (
                    [id] => d073d500dde6
                    [label] => Bedroom
                    [status] => ok
                )

            [4] => Array
                (
                    [id] => d073d50142d4
                    [label] => Hall North
                    [status] => ok
                )

            [5] => Array
                (
                    [id] => d073d5014445
                    [label] => Hall South
                    [status] => ok
                )

            [6] => Array
                (
                    [id] => d073d502a483
                    [label] => Bathroom
                    [status] => ok
                )

            [7] => Array
                (
                    [id] => d073d502e517
                    [label] => Nats Room
                    [status] => ok
                )

            [8] => Array
                (
                    [id] => d073d502ee56
                    [label] => Kitchen
                    [status] => ok
                )

            [9] => Array
                (
                    [id] => d073d502f277
                    [label] => Laundry
                    [status] => ok
                )

        )

)

Brightness seems to be effected buy no color is applied to any of the blubs

The issue was the way I was calling Kelvin and brightness… you need to put them in the color object with a space and not as two seperate objects… ie kelvin and brightness. The report you get back from lifx server is that everything is okay… when it’s not.

Yes!! I had the same issue when I changed my modified version of your kodi plugin and changing to states, move to a space and it was fixed. The current method I used is messy so will change to a concatenate of values.

It’s just another LIFX inconsistency :stuck_out_tongue: There are quite a few of them… GUYS!!! lol

Agreed. When the list response is
“color”: {
“hue”: 250.0,
“saturation”: 0.5,
“kelvin”: 3500
},
You would think setting colour would also be the same but no, it is
{“color”:“hue:250 saturation:0.5 kelvin:3500”}

Mind you the colour reference in the online help just describes them and states that you have as many of the options you want however does not say use spaces so you use the returned example and get it wrong.
This needs to be correctly documented or changed.

My main issue was that I was getting a response 200:OK from the server… So I assumed it was working… but the lights wern’t changing at all.

1 Like

I forgot to say I was getting an error, the error was telling me that the color field (why use US spelling, it is wrong but anyway) was incorrect so at least I had that, it must have been so frustrating for you :frowning:

There was a historical reason for needing to cut down the number of possible in an API call hence using a color string, but now that’s no longer the case so we can definitely add that capability back in.

I’m thinking that color will be able to take either the existing colour specifier or a hash. How’s that feel?

1 Like

I’ve been wanting to error on unrecognised parameters but there’s a couple issues that we need solve, especially whether or not it’s actually safe to add it to v1 of the API or we need to wait until v2, but we understand it’s an issue and we would like to fix it :smile:

1 Like

The issue I had was when I created two separate objects… one called color which had the kelvin in it and another called brightness in it… It said it was OK but then didn’t change…

meaning {“color”:" kelvin:3500"} {“brightness”:" 0.5"} was invalid (API error code was 200 OK)… but I interpreted that the API docs said that would be fine, yet it failed.

My fix was to combine the two so you had {“color”:" kelvin:3500 brightness:0.5"}

That would fail. It needs to be {“color”:“kelvin:3500”,“brightness”:“0.5”} The colour parameter can contain brightness and that is overridden by the brightness value for the state as a separate item. So your method moved the brightness into the color selection
This would also work, {“color”:“kelvin:3500 brightness:0.5”,“brightness”:“0.7”} in this case it would work but the brightness would be 0.7 not 0.5

brightness - optional, 0.0 – 1.0, overrides any brightness value from color (if any)

That’s my point… it wouldn’t work. I tried doing them separately and it made no change at all. Once I combined it into the color variable it seemed to work fine.

We’ve added a change to the API where extraneous arguments will cause a warning, where it will be returned in the warning list of a response. See http://api.developer.lifx.com/v1/docs/errors#warnings for more details.

1 Like