Supereg / homebridge-http-lightbulb

Powerful http lightbulb for Homebridge: https://github.com/homebridge/homebridge
ISC License
23 stars 7 forks source link

Allow replacements related to the power status #5

Closed lumaxis closed 4 years ago

lumaxis commented 4 years ago

Also triggered by my usage of the Elgato Key Light, I wanted to add some more flexibility around using e.g. brightness and color temp. replacement values in the onUrl and offUrl bodies and allow to use the current power state as a replacement when setting any of these other config values.

This is necessary because the Key Light always requires all the values to be sent in the PUT request's body, otherwise they are reset:


{ 
  "numberOfLights":1,
  "lights": [{
    "on":1,
    "brightness":39,
    "temperature":159
  }]
}
Supereg commented 4 years ago

Is this really necessary? The plugin currently expects you to enter a designed url for turn on and off? You could just manually enter "on":1 for the onUrl and "on":0 for the offUrl?

Supereg commented 4 years ago

Got no problem with merging this, just though this wasn't necessary in the first place, which is basically the reason why the feature is currently not there.

lumaxis commented 4 years ago

You could just manually enter "on":1 for the onUrl and "on":0 for the offUrl?

That's definitely what I'm already doing today. I think I got confused by the weird behavior of the API that happens when the brightness value is not a string and the automatic power update that happens when changing the brightness of a lamp.

Similar to https://github.com/Supereg/homebridge-http-lightbulb/pull/4#issuecomment-606642558, this turns out to not actually be necessary.