You can achieve your result with my simple option, but the scene won’t appear as “active” once its set (because the switch will turn off).
If you want the switch to reflect the current state of the Z strip (and turn it off, if you turn the switch off), you’ll need a more complex configuration like this:
{
"accessory": "HTTP-SWITCH",
"name": "Bias Lighting",
"switchType": "stateful",
"onUrl": {
"url": "https://api.lifx.com/v1/scenes/scene_id:<scene uuid>/activate",
"method": "PUT",
"strictSSL": true,
"headers": {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
},
"offUrl": {
"url": "https://api.lifx.com/v1/lights/:selector/state",
"method": "PUT",
"strictSSL": true,
"body": "{\"power\": \"off\"}",
"headers": {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
},
"statusUrl": {
"url": "https://api.lifx.com/v1/lights/:selector",
"method": "GET",
"strictSSL": true,
"headers": {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
},
"statusPattern": "\"power\": \"on\"",
"statusCache": 2000
}
Note that I haven’t actually tested this, but it should work. You’ll need to replace :selector
with the actual values from your setup.
You can review Selectors · LIFX HTTP Remote Control API to see how to build a selector. The simplest option is id: d3b2f2d97452
(where d3b2f2d97452
is the serial of your Z strip).
However, if you want to get fancy, you could use scene_id:<scene_id>
as the selector for the offUrl
so that the switch turns off all the bulbs that are in the scene. For the statusUrl
, pick a single bulb and use the id:d3...
selector, otherwise Homebridge will get confused with multiple power statuses.
I’ve added a 2 second cache for the status of the bulb so that HomeKit doesn’t hammer the LIFX HTTP API. This means that the status will be up to 2 seconds out of date.