homebridge-wiz-lan icon indicating copy to clipboard operation
homebridge-wiz-lan copied to clipboard

Notes on controlling the WIZ RGBCW bulbs directly through the Homebridge Terminal.

Open MoTechnicalities opened this issue 3 years ago • 1 comments

I will post notes here as I experiment. If I find that I'm wrong on a point or discover something new, I will update.

The Wiz bulbs can be controlled directly from the HomeBridge Terminal mode using simple echo command lines directed at your own bulb's specific mac, ip address, and port 38899 as shown below. Example: echo '{"method":"setPilot","env":"pro","params":{"mac":"a8ba50ac5cc1","src":"","state":true,"r":130,"g":200,"b":140,"c":77,"w":125}}' | nc -u 192.168.1.192 38899

The above echo command line can be altered using proper values shown below.

The bulbs ON/OFF state is set by a Boolean value: true or false. Examples: "state":true or "state":false

Each individual LED has a range of 0 to 255. However, at least one of the individual LED values must be set to a value of 1. When a value is set the bulb remembers its last rgbcw value settings during changes of the "state": value. Examples:

Purple: "r":128,"g":0,"b":128,"c":0,"w":0 Red at minimum brightness: "r":1,"g":0,"b":0,"c":0,"w":0 Cool White at Maximum brightness: "r":0,"g":0,"b":0,"c":255,"w":0 Warm White at 50% brightness: "r":0,"g":0,"b":0,"c":0,"w":128 Invalid setting: "r":0,"g":0,"b":0,"c":0,"w":0 because you cannot set all rgbcw values to zero.

The Wiz bulbs also utilize a "dimming": value from 10 to 100, with the dimmest possible setting being 10. Changing the "dimming": to a value less than 100 does not alter previously set rgbcw values. Never-the-less, it reduces power to the LED group to dim the perceived effect. Note: the "dimming": value is best used for controlling the perceived brightness of the Wiz bulb's special effects. Special effects can be controlled by setting a value for "sceneId": ranging from 1 to 32, then combining it with a "dimming": value 10 to 100. Examples: Cozy at full intensity: "sceneId":6,"dimming":100. Party at half intensity: "sceneId":4,"dimming":50. Note: "sceneId":14 is Nightlight mode and does not recognize any dimming value.

WIZ BULB RULES:

  • To use normal LED functions, send the necessary primary rgbcw values (as shown in available online RGB color charts) to establish the desired perceived color, and send a desired "dimming":100 value. Do not send a "sceneId":. If sent together with rgbcw values, then a "sceneId": setting will take precedence.
  • To use Wiz bulb scenes, send the desired "sceneId":, and send a desired intensity using a "dimming": value. Dimming values do not apply to Nightlight mode.
  • Turn the bulb ON/OFF by sending the appropriate "state": value, and the bulb will remember the last rgbcw or scene values when you issue a "state":true command.

SPECIAL AND INTERESTING CONCERNS FOR HOMEKIT The bulb can manually be set to all possible values using the above method, however the plugin is limited by HomeKit's inability to use the bulbs settings to the full potential. Currently the plugin uses the Wiz bulb "dimming": value 10 to 100 to normalized with HomeKit brightness levels of 1 to 100.

RGB color charts place the color purple at (128,0,128). By this reasoning however, if one where to use a combination of rgbcw and dimming values then the proper setting for a Wiz bulb should NOT be "dimming":100,"r":128,"g":0,"b":128,"c":0,"w":0. Rather it would be "dimming":55,"r":255,"g":0,"b":255,"c":0,"w":0. The value 55 being in the middle of the dimming range of 10 to 100, but giving us the opportunity to raise the dimming value! Or if done the other way, 128 being in the middle of the LED brightness range 1 to 255, but with no way to make the purple brighter unless we adjust the LED value! The plugin in its current state does not accurately articulate these types of complex LED value vs. dimming value variables.

IMPROVING THE PLUGIN

A HomeKit accessory OFF request needs to set a “state”:false.

A HomeKit brightness 0 request also needs to set a “state”:false.

A color request needs to set a color using rgbcw index values, but needs to adjust the LED values for maximum possible LED intensity. Example: The index for Purple (128, 0, 128) should set the bulbs r,g,b,c,w to 255,0,255,0,0 to allow for proper dimming intensity adjustments. The index for Hazel (201, 199, 137) should set the bulbs r,g,b,c,w to 254,251,173,0,0 to allow for proper dimming intensity adjustments. The formula for making these adjustments will be discussed next.

Last updated 2/13/2022. More to come...

MoTechnicalities avatar Feb 12 '22 21:02 MoTechnicalities

@kpsuperplane

More Discovery: Bulb Model: 27263 (according to WiZ App) Temperature Range: 2200K - 6500K

The plugin is out of sync and currently does not properly match between HomeKit and the WiZ bulb's dynamics. The following discoveries were made by placing Homebridge into Debug Mode and switching back and forth between the WiZ App's and Home App's color and temperature pickers, then comparing results with the Homebridge log. I have seen the log return a temp value as high as 7043!

To match the Bulb Model: 27263 to HomeKit the following is required:

The Bulb has 5 Light Emitting Diodes: Red, Green, Blue, Cool White, and White. When using the HomeKit Home App color picker, the plugin must do the following:

For HomeKit's Home App Color picker, the plugin must:

  • Set the bulb's "sceneId":0
  • Set and Keep the Cool White Light Emitting Diode to a setting of [0].
  • Normalize and Keep at least one of the Red, Green, or Blue Light Emitting Diodes at [255].
  • Use the White Light Emitting Diode for Saturation with the Min/Max integer range [0 ... 140]. Full HomeKit color saturation corresponds to a bulb setting of "r":255,"g":255,"b":255,"c":0,"w":140. This despite the max intensity of the bulb's White LED being [255]!
  • Adjust or normalize brightness levels using the bulb's dimming [10 ... 100] and not LED levels.

For HomeKit's Home App Temperature picker, the plugin must:

  • Set and Keep the Red, Green, and Blue Light Emitting Diode at [0].
  • Set and Keep "sceneId":0
  • Adjust and normalize between HomeKit's Temperature range to keep the bulb's "temp": in the range 2200 ... 6500.
  • Adjust and normalize brightness levels using the bulb's dimming [10 ... 100]. Do not adjust RGBCW LED levels.

Important and reasonable perameters: If the bulb is turned OFF using the Home App Brightness bar (brightness: 0) then the bulb should be set to "state":false,"dimming":100. If the bulb is turned OFF with the click of an icon or automation, only the "state" should be changed to false. The bulb will remember the dimming when the "state" is returned to true. Or if the light is turned on using the Home App Brightness bar it will be properly adjusted to the desired dimming.

MoTechnicalities avatar Jul 27 '22 20:07 MoTechnicalities