sbidy / wiz_light

A WiZ Light integration for Home Assistant
MIT License
341 stars 68 forks source link

Mimic the Wiz App #90

Closed brettonw closed 3 years ago

brettonw commented 3 years ago

In Home Assistant, the default RGB and HS color models assume that full RGB settings are white light, but the Wiz bulbs actually have separate cold and warm white LEDs that are used to make the lamp full brightness. These bulbs are powered using the C and W settings of the wiz light.

The wiz app uses two different behaviors depending on the saturation: Above 50% the RGB bulbs are fully on, and the CW bulbs ramp down to nothing. Below 50% the CW bulbs are all on, and the RGB bulbs ramp down to nothing. Full white is just the CW bulbs on. This provides a pretty complete coverage of the RGB to white color range.

Homekit through Home Assistant appears to only use the Hue Saturation (HS) model for their interface, which means setting the bulbs to any variation of white or something based on color temperature doesn't work as expected, and the bulbs are very dim.

This change intercepts RGB and HS-based color setting for the wiz bulb and creates a hybrid RGB-CW based Pilot to mimic the behavior of the wiz app. It also includes a RGB-CW to HS converter so that HomeKit and Home Assistant can query the current bulb color and correctly put it back on the color wheel.