I am using single state to turn my light on, set the color, and time.
With the below api, sometimes the light comes on and sometimes it doesn’t. In addition, when it does come on the brightness will only be at 1%.
Is there a issue with the Lifx server for the state api route?
Note: I did not want my light number to be exposed on the net, so I changed it to foobar-light on this posting.
var url =
`https://api.lifx.com/v1/lights/foobar-light/state`;
var request_data = {
"color": 'hue:191 saturation:1.0 brightness:1.0',
"power": "on",
"duration": 14400
};
request_data = JSON.stringify(request_data);
var request = _buildRequest('PUT', url, request_data);
return fetch(request)
.then(toJSON)
.then((e) => {
console.log(e);
})
.catch((e) => {
console.log('normal alert ' + e);
});
}
{ results: [ { id: ‘foobar-light’, label: ‘LIFX-FOO’, status: ‘ok’ } ] }