LIFX Motion Sensor

Hello all!

I have had a LIFX lightbulb for about a year now and I love it! However, there aren’t really any good motion sensors that work with LIFX and so I set out to build my own. I am using the Particle Photon and the LIFX HTTP API. I wanted to add a feature to my motion contraption so that when it times out (I am motionless for an extended period of time) it does not turn my light off instantly. Rather, it will fade off over a period of 10 seconds. If I move, my light will instantly return to full brightness. From a code perspective, this is what happens:

  1. I walk in the room, my motion sensor detects motion
    PUT “https://api.lifx.com/v1/lights/all/state
    {
    “power”: “on”,
    “color”: “kelvin:3000 brightness:1”
    }
  2. The motion sensor times out
    PUT “https://api.lifx.com/v1/lights/all/state
    {
    “power”: “off”,
    “duration”: 10
    }
  3. I move again to make my light return to full brightness
    PUT “https://api.lifx.com/v1/lights/all/state
    {
    “power”: “on”,
    “color”: “kelvin:3000 brightness:1”
    }

At step 3 is where I encounter problems. When I move again, my light just continues to fade off until I am left in a very dark room. I have checked to make sure that the request is sent. Better yet, I still receive an OK status from the LIFX API. When I remove the color parameter from the “on” request, everything works fine. It’s almost like if I have the color parameter, the request will not interreupt the fade effect. However, if I don’t have the color parameter the request will interrupt the fade effect. Anybody know of any bugs or am I missing something?

Thanks,
Brigham

We’ve been able to replicate this here. I agree, that this is not the expected behavior. We will be investigating why this happens and will add further information to this thread when we have it.

Okay so we looked into the issue, and found an obscure bug in the system that caches the state of the bulbs to speed up API requests. Unfortunately this cache was causing a conflict and preventing the action from working correctly.

We have deployed an update to the API and it seems to be fixed from our point of view, could you please confirm that it now works as expected for you?

2 Likes

Yes, everything is back to normal on my end as well. Thank you for your quick fix :slightly_smiling:.