sbidy / pywizlight

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

How to use effects? #37

Closed henryruhs closed 3 years ago

henryruhs commented 3 years ago

@sbidy Is there a way to use effects like breath/pulsate or spectrum?

sbidy commented 3 years ago

await light.turn_on(PilotBuilder(scene = 4)) with from pywizlight.scenes import SCENES

henryruhs commented 3 years ago

Sorry, but I don't want to turn on/off scenes that have to be defined via the app - I would like to create an effect programmatically via code instructions as I have to pass the color aswell.

sbidy commented 3 years ago

ah, so you can use the "normal" PilotBuilder to create different light setups. I'm currently reversing. the FW of one bulb and found some more useful UDP features like changing the fade-in and fade-out.

henryruhs commented 3 years ago

Great! Could you introduce some shorthand methods to control this?

sbidy commented 3 years ago

Mh, you can do something like this:

async def police_effect():
    bulb = wizlight("192.168.178.95")
    await bulb.turn_on(PilotBuilder(rgb=(255, 0, 0)))
    time.sleep(1)
    await bulb.turn_on(PilotBuilder(rgb=(0, 0, 255)))
    time.sleep(1)
    await bulb.turn_on(PilotBuilder(rgb=(255, 0, 0)))
    time.sleep(1)
    await bulb.turn_on(PilotBuilder(rgb=(0, 0, 255)))
    time.sleep(1)

But you have to change the fade-in and fade-out value to 0 in the WiZ app. Because it is not possible to set these via UDP API.

henryruhs commented 3 years ago

I am waiting for this being implemented as a shortcut method, thanks...

def pulsate((r, g, b), delay)
sbidy commented 3 years ago

Unfortunately this will not come into the lib. The transition speed is not supported by the UDP API and must be configured via the WiZ app. We can only manipulate the color but not the speed of "state changes" see the discussion in #40.

Maybe there is something coming up in the future.