Can HA know last Hue Scene used?

Been crawling through threads trying to determine this one… is there a way HA can “know” the last scene applied to a room? I know it’s saved as-state during restarts but I’m wondering if there’s a way to directly query the last scene (from the Hub) that a room used? Reason being sometimes my wife will use the Hue App to alter a scene in the living room and HA is “unaware” of the change (brightness however, it does keep in sync with,) ie:

EDIT: In this case, the last scene I selected was Concentrate but the actual scene in play may be Read, etc that my wife set. In the above screenshot, the last scene I selected via HA was Concentrate but Relax is currently active (note the color of the bulb icons.)

I don’t think you can.

Solution: hide the Hue app on your wife’s phone and get her to use the homeassistant interface to change the scene. (keep the Hue app just in case). :wink:

1 Like

Created a HueDev account to access API documentation (it’s free) and apparently you can find out which scenes are being used by which lights through the REST API:

URL /api//scenes
Method GET

Which returns (version 1.11 or apiversion>1.11):

{
	"4e1c6b20e-on-0": {
		"name": "Kathy on 1449133269486",
		"lights": ["2", "3"],
		"owner": "ffffffffe0341b1b376a2389376a2389",
		"recycle": true,
		"locked": false,
		"appdata": {},
		"picture": "",
		"lastupdated": "2015-12-03T08:57:13",
		"version": 1
	},
	"3T2SvsxvwteNNys": {
		"name": "Cozy dinner",
		"lights": ["1", "2"],
		"owner": "ffffffffe0341b1b376a2389376a2389",
		"recycle": true,
		"locked": false,
		"appdata": {
			"version": 1,
			"data": "myAppData"
		},
		"picture": "",
		"lastupdated": "2015-12-03T10:09:22",
		"version": 2
	}
}

or the Legacy scenes (version 1 or apiversion<1.11) returns:

{

    "s661001": {
        "name": "My Scene 1",
        "lights": [
            "1",
            "2",
            "3"
        ],
        "active": true
    },
    "s1234": {
        "name": "My Scene 2",
        "lights": [
            "1",
            "2",
            "3"
        ],
        "active": true
    }

}

Now to figure out how to use this information to map the returned data to existing lights :slight_smile:

1 Like

This might be the answer but will require a bit of heavy-lifting to extrapolate which lights are which to map them to scenes (I think…)

Still working out the details… Maybe I should file a PR for feature request so this is built into HA…

1 Like

Hi guys ! Any update with the new hue api ?