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:
- 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”
} - The motion sensor times out
PUT “https://api.lifx.com/v1/lights/all/state”
{
“power”: “off”,
“duration”: 10
} - 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