Add Scene Toggling to the HTTP API

I’d love to see scene toggling added to the HTTP API so 3rd party app developers will have an easier time of it. Right now, I have to to go to each one and request special functionality only for LIFX lights.

  1. It gives a standard method of doing this for other developers using the HTTP API. Then they wouldn’t have to grab all lights in the Scene by ID and then sending those IDs in a /lights/states request with a default power of “off”.
  2. It makes scenes able to be turned off. That way you don’t have to separately configure groups that turn off lights in a scene.

I might have different opinions on how to toggle scenes, but my personal setup has it so if all lights in a scene are not 100% equivilent (power, hue, saturation, kelvin, brightness), then change to that scene; otherwise, turn off all lights in the scene.

There is a quirk with this setup where the scene might have a value off-by-one (positive or negative) from what the light reports back. So far, I’ve only had this issue when comparing HTTP and LAN API values.

2 Likes

I’d have thought this would be in for sure. Definitely necessary IMO so scenes don’t have to be needlessly re-created on various front-ends.

1 Like

I think you can achieve most of what you need here using the current API. You can switch off all lights in a scene in various ways:

  • PUT /v1/scenes/scene_id:UUID/activate with {"overrides": {"power": "off"}}.
  • PUT /v1/lights/scene_id:UUID/state with {"power": "off"}.

Also, once you know the lights are set to the states in a particular scene, you can toggle them all on/off by POST /v1/lights/scene_id:UUID/toggle.

1 Like

Hi @nick! I got a chance to test this out tonight and yes, all three of those methods do function as you stated.

Because this is in the HTTP API, I am now wondering why can’t Alexa turn off scenes. For instance, I can’t say Alexa, turn off Someone’s at the Door because scenes in Alexa only have the ability to be turned on. Is this something that can be enabled in the LIFX Skill for Alexa?

Hi Kevin,

Glad that all works! As far as we’re aware, the current version of Alexa doesn’t support switching off scenes. If that changes with later versions, we’ll look into enabling this.

Ah I see. So it’s not LIFX, but the scene itself huh?

I can turn off scenes with the Logitech Harmony skill: “Alexa, turn off Entertainment Center”. I didn’t create this skill either, it is something Logitech provides as a way of turning off the currently enabled viewing mode. Those are also scenes as well.

It says:

Entertainment Center
Harmony Activity: Turn Off Entertainment Center	

I can also say “Alexa, turn off Netflix”, and she’ll turn off the viewing mode called Roku with the Netflix app open.

Net Flicks
Harmony Roku Channel: Netflix