sbidy / pywizlight

A python connector for WiZ devices
MIT License
463 stars 79 forks source link

Fade support #15

Closed mots closed 3 years ago

mots commented 4 years ago

The bulbs themselves support fade-in and out: https://taolight.helpshift.com/a/wiz/?s=using-wiz-fine-tuning&f=fade-in-fade-out-changing-how-long-it-takes-for-lights-to-turn-on-off-when-used-with-the-app-or-the-wizmote&l=en

It would be nice if we added support for this and exposed it in the Home Assistant integration!

sbidy commented 4 years ago

I'm not sure if this is an feature of the bulb itself (like the scenes). Maybe this is an feature of the app. I'll consider a function for this "fadding" added to code in the next version. But not with an high priority.

mots commented 4 years ago

I'm pretty sure this is a setting on the lamp itself, a little different from how transitions work in HA.

When I set a fade-in time, turning the light on in HA also fades it in.

I think ideally, we'd figure out how the app sets that setting on the lamp and then implement HA transitions by:

  1. reading the current setting into a a variable
  2. setting the setting to the transition time requested by HA
  3. turning the lamp on
  4. setting the setting back to whatever we read out in 1.

Does that make sense?

sbidy commented 4 years ago

Maybe 😉 .... I'll try to create a test function for that ... there is a speed parameter in the UDP but it is not used for the transition (on->off or off->on). Maybe something like this def fadeIn(transition_time, final_state) but this must be async and non blocking.

CalcProgrammer1 commented 4 years ago

Do you know if there is a way to disable the fading between colors when you send a color change? I want to use the lights with a music visualizer and the fading makes fast changes sluggish. It seems the bulb can handle the refresh rate of updates but the slow fade is annoying.

sbidy commented 4 years ago

Not via UDP. This interface does not provide a parameter for that. But in the official app you can set this for each bulb in the settings section.

CalcProgrammer1 commented 4 years ago

I don't see an option to change the fade between colors, only the on and off fade.

On Thu, Nov 5, 2020, 12:30 AM Stephan Traub notifications@github.com wrote:

Not via UDP. This interface does not provide a parameter for that. But in the official app you can set this for each bulb in the settings section.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sbidy/pywizlight/issues/15#issuecomment-722172467, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIAY7FW37ATXHEV734ZEUDSOJBAXANCNFSM4SPG4KRQ .

sbidy commented 3 years ago

So I have to do a sniffing on the bulb network traffic to figure out how and what is transmitting to the bulb from the app. Maybe there is a additional REST-API for configuration and fw-updates.

This will be ToDo on my "Christmas Holidays at Home" 😉 🎄 🎅

ChrisLizon commented 3 years ago

@sbidy I did a quick test with my non-internet connected bulb. I cannot change the fading settings. On Fade-in and On-fade out settings in the app do not take effect on the bulb. WireShark doesn't show anything happening via the network communication.

The other bulb I am testing with is able to access the internet and will accept the fade-in and fade-out settings. It looks like it's done via the TLS connection that I can't get into at the moment. It also seems that while the app has no issues using UDP, it favors TCP to the cloud, and the cloud to the bulb, even for on/off and color changes. Ignore that bit I was sniffing the wrong network segment.

Once I set the fade-in and fade-out to 5.0s in the app, it will fade in and fade out in response to the UDP commands issued via Home Assistant.

sbidy commented 3 years ago

TL;DR: Change the fade time does only work with the native app.

@ChrisLizon thanks for digging into that too 😄 That is also what I expect to see in the trace from the bulb. So there is no UDP feature to change the fade behavior of the bulb. In the app there is a setting for that. So the workaround can be to set this in the app and use the HA integration for the other controlling stuff.

Maybe there is a possibility to "hack" the devices for reverse engineering the FW to look for certificates or "unknown" other features. But for that I have to brick one of these devices to get hands on to the ESP. Maybe some one has done this already.

I will close this issue here with currently no solution.

gitagogaming commented 1 year ago

has anyone been successful with adjusting the fade in/ fade out of a bulb?