sbidy / pywizlight

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

Comment: Determining Bulb Kind #77

Closed nmoschkin closed 2 years ago

nmoschkin commented 3 years ago

In the previous versions of the firmware, there used to be an integer array returned with getSystemConfig called 'drvConf'.

Using those two numbers I figured out that it was possible to get the 'type' of the bulb pretty consistently with some experimentation.

In the latest version they took drvConf away, bot those two numbers are instead now found in getModelConfig, the values 'wcr' and 'nowc' are actually the two numbers from drvConf.

So, I've come up with a list so far, and I'd appreciate any feedback you have on this matter.

{ (wcr, nowc) or drvConf: [1,2], "Bulb Kind" }

{ (37, 1), "Philips Color & Tunable-White BR30" }, { (50, 1), "Philips Color & Tunable-White BR30" }, { (33, 1), "Philips Color & Tunable-White A19" }, { (60, 1), "Philips Color & Tunable-White A19" }, { (20, 2), "Philips Color & Tunable-White A21" }, { (40, 1), "Philips Color & Tunable-White E14 Candelabra" }

I have about 20 different bulbs in my house. But I would love to know if these match up with what you have?

sbidy commented 3 years ago

I'm not aware of detection of the bulb type by this property. This seems to be new and it can be a possible detection value.

Overall the bulb type (feature set) can be detected by the bulb name (TW = Tuneable White, DW = Dimmable etc.). The detection via this two parameters are static and a lookup table must be maintained for that. I try to avoid such a static part in the lib.

nmoschkin commented 3 years ago

Yes. Basically the only bit of new information that is provided is the size/shape of the bulb. A21/A19 or BR30, E14, etc...

nmoschkin commented 3 years ago

... should be noted I have a .NET version of this library. Originally, in the beginning, I translated some of your code, but I have since organized it all in a very .NET way.

https://github.com/nmoschkin/WizLib

bdraco commented 2 years ago
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.209.158: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":1000,"pwmRange":[5,100],"wcr":20,"nowc":1,"cctRange":[2700,2700,2700,2700],"renderFactor":[255,0,255,255,0,0,0,0,0,0]}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.212.173: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":200,"pwmRange":[1,100],"wcr":20,"nowc":2,"cctRange":[2700,2700,2700,2700],"renderFactor":[255,0,255,255,0,0,0,0,0,0]}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.214.72: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":1000,"pwmRange":[3,100],"wcr":30,"nowc":1,"cctRange":[2200,2700,4800,6500],"renderFactor":[171,255,75,255,43,85,0,0,0,0]}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.211.79: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":1000,"pwmRange":[3,100],"wcr":30,"nowc":1,"cctRange":[2200,2700,4800,6500],"renderFactor":[171,255,75,255,43,85,0,0,0,0]}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.210.189: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":200,"pwmRange":[1,100],"wcr":20,"nowc":2,"cctRange":[2700,2700,2700,2700],"renderFactor":[255,0,255,255,0,0,0,0,0,0]}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.211.11: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":1000,"pwmRange":[3,100],"wcr":30,"nowc":1,"cctRange":[2200,2700,4800,6500],"renderFactor":[171,255,75,255,43,85,0,0,0,0]}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.211.110: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":1000,"pwmRange":[3,100],"wcr":30,"nowc":1,"cctRange":[2200,2700,4800,6500],"renderFactor":[171,255,75,255,43,85,0,0,0,0]}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.211.70: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":1000,"pwmRange":[5,100],"wcr":20,"nowc":1,"cctRange":[2700,2700,2700,2700],"renderFactor":[255,0,255,255,0,0,0,0,0,0]}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.209.13: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":1000,"pwmRange":[5,100],"wcr":20,"nowc":1,"cctRange":[2700,2700,2700,2700],"renderFactor":[255,0,255,255,0,0,0,0,0,0]}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.212.68: << b'{"method":"getModelConfig","env":"pro","result":{"ps":0,"pwmFreq":2000,"pwmRange":[5,100],"wcr":80,"nowc":2,"cctRange":[2700,2700,6500,6500],"renderFactor":[255,0,255,255,0,0,0,81,245,178],"drvIface":0}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.209.213: << b'{"method":"getModelConfig","env":"pro","result":{"ps":0,"pwmFreq":2000,"pwmRange":[5,100],"wcr":80,"nowc":2,"cctRange":[2700,2700,6500,6500],"renderFactor":[255,0,255,255,0,0,0,81,245,178],"drvIface":0}}'
2022-02-08 16:47:13 DEBUG (MainThread) [pywizlight.bulb] 192.168.211.24: << b'{"method":"getModelConfig","env":"pro","result":{"ps":2,"pwmFreq":1000,"pwmRange":[0,100],"wcr":20,"nowc":1,"cctRange":[2700,2700,2700,2700],"renderFactor":[255,0,255,255,0,0,0,0,0,0],"wizc1":{"mode":[0,0,0,0,0,0,0]},"wizc2":{"mode":[0,0,0,0,0,0,0]}}}'
bdraco commented 2 years ago

This would be good to implement into the bulb type so we can improve how discovery is displayed in Home Assistant

bdraco commented 2 years ago

2022-02-08 20:07:10 DEBUG (MainThread) [pywizlight.bulb] 192.168.213.171: << b'{"method":"getModelConfig","env":"pro","result":{"ps":1,"pwmFreq":2000,"pwmRange":[0,100],"wcr":20,"nowc":1,"cctRange":[2700,2700,6500,6500],"renderFactor":[255,0,255,255,0,0,0,0,0,0],"hasAdjMinDim":0,"hasTapSensor":0,"pm":0,"fanSpeed":0}}'

https://www.costco.com/wiz-lutec-connected-smart-led-updown-outdoor-wall-light.product.100760871.html

WiZ Lutec Connected Smart LED Up/Down Outdoor Wall Light

This also identifies as a 20,1

bdraco commented 2 years ago

So wcr is White to Color Ratio, and nowc is number of white channels.