rgomezjnr / wizcon

Control Philips WiZ Connected smart light bulbs
https://pypi.org/project/wizcon/
MIT License
39 stars 7 forks source link

Choose a custom color #4

Closed djacobson closed 3 years ago

djacobson commented 3 years ago

Just a question about custom colors...

I see choosing them does not appear to be implemented but, is it implemented in pywizlight either? Experimenting with the color gradient chooser in the WiZ app, the colors don't appear to be "really", in that the app has predefined "color names" for pretty much every position on the gradient (i.e.: Dark Red, Navy Blue, Harlequin, etc.)... so, when one adds a "custom color", is that just giving it a predefined scene_id maybe? ...or maybe those are just color nick-names Philips hard-coded in their iOS app? Just wondering if those colors might be setable by the scene_id parameter after added (if the scene_id param could go above 32)... ?

djacobson commented 3 years ago

Or maybe the best approach would be to add an RGB parameter to wizcon? i.e.: await light.turn_on(PilotBuilder(rgb = (0, 128, 255)))

rgomezjnr commented 3 years ago

Hello again. pywizlight does support custom RGB colors. I'll add it to wizcon, it should be simple.

rgomezjnr commented 3 years ago

I added the -rgb argument in version 0.3.0.

pip install wizcon --upgrade

usage: wizcon [-h] [-si {1-32}] [-b {0-255}] [-rgb {0-255} {0-255} {0-255}] [-v] IP {ON,OFF,SWITCH}

-rgb {0-255} {0-255} {0-255}, --rgb {0-255} {0-255} {0-255} Set RGB color of smart bulb

Set smart bulb color to blue: wizcon -rgb 0 0 255 192.168.1.100 ON

If it's working well for you, can you please tell me your Philips WiZ bulb model, firmware version, and model ID so I can it to the supported bulbs list?

djacobson commented 3 years ago

Oh awesome!! Will post my bulb info asap.

djacobson commented 3 years ago

It works beautifully! I'm testing this with a fun script that sets the lamp color to a gradient hue based on the outside temperature every 10 mins or so. :)

Here's my bulb info: A Phillips Full Color WiZ bulb Model: A21, Colors Current FW Version (is this updateable?): 1.24.0 Model ID: B23078

djacobson commented 3 years ago

Testing the RGB parameter with my bulb above, it's kind of interesting. It seems as though the bulb does not display as many minor color changes and hues but, the predefined scene colors are much more noticeable. It's like Phillips figured out what colors the bulb was best at displaying and assigned those to scene IDs.

If you're interested, I could share my bash script with you. It might make a good test for wizcon and setting various rgb colors? I'd certainly consider moving it to Python but, originally it was just two sys cmds; 1) get the weather temp, 2) call wizcon.

rgomezjnr commented 3 years ago

Glad it's working for you. I'm not sure the firmware is updateable, I don't see any way of doing so in the WiZ app. Sure share your temp bash script, I'm curious.

djacobson commented 3 years ago

My hacked-together script uploaded (weather_bulb.txt -> change extension to .sh). You can kinda see what I'm trying to do... Scenes vs RGB colors are an interesting comparison in the actual bulb settings. I have this running on a crontab every 10 mins or so.

weather_bulb.txt

rgomezjnr commented 3 years ago

Interesting script, thanks for sharing. I'll close the issue now, lmk if you have any additional feedback.

djacobson commented 3 years ago

Just a follow-up on this topic. I found this very interesting link listing Hue's bulb colors that have been tested... https://www.reddit.com/r/googlehome/wiki/hue_colors#wiki_hue_colors ...and https://www.enigmaticdevices.com/philips-hue-lights-popular-xy-color-values/

Colors are pretty complicated with Hue bulbs. I have modified my script to use more obvious color on the temperature gradient that are obvious at almost any brightness IMHP. The above article attempts to control colors at a much more hi-fi level than my simple example. weather_bulb.txt

rgomezjnr commented 2 years ago

Thanks for sharing. I'm not sure if the Wiz bulbs have the same color support as the Hue bulbs. I've seen in the product pages of Hue bulbs advertise support for 16 million colors, while on Wiz bulbs it just says millions of colors. Still those are nice color charts you linked that should serve well as quick references.

djacobson commented 2 years ago

I get confused sometimes because there are the older Phillips Hue 'smart' bulbs, that require the Hue bridge, and then there are the Hue 'smart' bulbs "WiZ connected"... wifi bulbs that do not require a Hue bridge (which I've been primarily experimenting with). Makes me wonder if they are separate markets? ...or the company is expecting more of a future in wifi-only products, etc. Scratching my head... :) I would add that my WiZ bulbs have been very reliable and I have not seen them drop off my wifi, unlike some other devices. I did have an issue with the WiZ smart plug though.

pierre-guillot commented 2 years ago

Ho to wizcon team. Thank you so much for this beautiful python script. I installed this on my Raspberry Py and use it with my Domoticz server. Use just one C37 Wiz Bulb and wizcon can perfectly change every scene number without problem. But color seems to not work with every rgb code. Tested some rgb based on @djacobson link :

rgomezjnr commented 2 years ago

Hello @pierre-guillot thanks for your input.

I think there is something wrong with colors in pywizlight which is the library that wizcon uses for controlling Wiz bulbs. I know they have recently made a number of changes to handling colors.

Here is my experience from testing with pywizlight 0.3.4, then updating to pywizlight 0.4.16:

Black RGB(0,0,0) did nothing, no color change

Chartreuse (128,255,0) seems ok to me, color is mellow lime green.

(213,0,53) looked more like hot pink magenta.

Crimson (220,20,60) looked more like pink, was expecting closer to red.

Black RGB(0,0,0) went to bright harsh white, like Cool white scene.

Chartreuse (128,255,0) produced much lighter whitish-green. Seemed more accurate before in pywizlight 0.3.4.

(213,0,53) now very white washed, very little pink or red color. Seemed more accurate before in pywizlight 0.3.4.

Crimson (220,20,60) was nearly the same as (213,0,53), no noticeable difference. Way worse now than in pywizlight 0.3.4.


wizcon 0.3.0 pywizlight 0.3.4 -> 0.4.16 Bulb: Model Model ID Firmware A19 (RGB) 1.24.0 23007


There is currently an open issue which may be related to this behavior: Three channel RGB not displaying correctly. The developer of pywizlight @sbidy said this would be corrected in the next release.

pierre-guillot commented 2 years ago

Good news thank you for your replay! I'll waiting the new version of pywizlight and test again. Ask me if you want more test or informations :) regards