sbidy / pywizlight

A python connector for WiZ devices
MIT License
456 stars 77 forks source link

Kelvin range too limiting #4

Closed danVnest closed 4 years ago

danVnest commented 4 years ago

The WiZ G95 and WiZ C35 lights colour temperature ranges from 2000 to 4500. I've successfully tested both with echo '{"method":"setPilot","params":{"temp":2000}}' | nc -u -w 1 192.168.30.10 38899.

Can you adjust the _set_colortemp method in bulb.py to be less restrictive? From my testing with these lights, anything less than 1000 kelvin, or more than 12000 kelvin results in an "Invalid params" response. Thankfully the light seems to have its own check - if you command 1000 kelvin, it will default to 2000 (and 12000 defaults to 4500).

Hopefully the above is true for all other WiZ lights.

Perhaps use:

def _set_colortemp(self, kelvin: int):
  """Set the color temperature for the white led in the bulb."""
  if kelvin < 1000:
    kelvin = 1000
  elif kelvin > 12000:
    kelvin = 12000
  self.pilot_params["temp"] = kelvin
danVnest commented 4 years ago

Addressed in pull request #7

sbidy commented 4 years ago

added in 0.3.3 - thanks!