LIFX Developer Zone

HTTP API scene duration broken?


#1

I am using LIFX Z strips (non-HomeKit) with Home Assistant, using cURL to change scenes so that I can control the cross-fade duration. This setup has been working for months. My LIFX devices are running the latest firmware.

For maybe the last couple of weeks my LIFX scene changes have been instantaneous instead of obeying their set 10-second duration.

Using Postman:

PUT /v1/scenes/scene_id:<SCENEUUID>/activate HTTP/1.1
Host: api.lifx.com
Authorization: Bearer <APITOKEN>
Content-Type: application/json
Cache-Control: no-cache

{
  "duration": "10"
}

…results in an instant change instead of the smooth 10 seconds cross-fade it previously did.

The same happens using a double instead of a string, for instance using cURL and a 5.5 seconds:

curl -X PUT -H "Authorization: Bearer <APITOKEN>" -H "Content-Type: application/json" -d '{"duration":5.5}' "https://api.lifx.com/v1/scenes/scene_id:<SCENEUUID>/activate"

Trying to debug this situation using the Web API forms at https://api.developer.lifx.com/docs/activate-scene with a valid token and scene UUID results in “400 Bad Request”:

{
    "error": "selector is invalid",
    "errors": [
        {
            "field": "selector",
            "message": [
                "is invalid"
            ]
        }
    ]
}

However, using the LIFX iOS app at least gives a smoother default transition.

:face_with_thermometer: Am I doing something wrong or has the HTTP API changed somewhat?


#2

I think the HTTP API changed recently because I also saw changes in boolean fields starting maybe a couple weeks ago (they are now case-sensitive). I suspect there was a change in the HTTP API backend that was meant to be unnoticeable, but whatever it was, it seems to have broken some things.


#3

Hi renemarc,

I’ve tried to repro this but am unable to: duration works as expected for me, in either int, float or string forms. Could you email the details of the scene you’re trying to activate to support@lifx.co and I can check out what’s going on?

The “selector is invalid” response you got on https://api.developer.lifx.com/docs/activate-scene was a bug on the documentation page, thanks for uncovering that.

Nick


#4

A late follow-up, but a few days later this effect transition issue has resolved itself. Magic? :star2: Cross-fade transitions have been behaving properly ever since. :grinning: