sbidy / pywizlight

A python connector for WiZ devices
MIT License
438 stars 68 forks source link

bulb synchronisation (popcorn effect) #87

Open gregkster opened 2 years ago

gregkster commented 2 years ago

I am planning to put 10 bulbs in one room and 20 into another room and I would like them to turn on/off at the same time without popcorn effect. The Wiz Connected app mentions groups, but I see nothing about groups in pywizlight. Are scenes the same as groups ? I see a pre-defined list in scenes.py which makes me think they are not the same.

Is there support for groups or broadcast/multicast ?

Is the protocol documentation available ? For example, if sendUDPMessage() could include a delay that would help. The first packet could say "turn on in 100ms", the re-transmits could include a smaller delay like "90ms, 80ms....". As long as the bulb gets at least one and assuming jitter is small they would all come on together. Although "jitter is small" is probably a bad assumption on wifi. Really, these bulbs should just have an NTP client. Is that too much to ask :)

sbidy commented 2 years ago

So the integration doesn't support groups or other enhanced features from the bulb/app. You should create your own rapper around the turn on action. But to be honest, the WiZ bulbs are not that reliable for that use case.

bdraco commented 2 years ago

It doesn't look like there is an api available for the UDP local api to control groups.

eibanez commented 2 years ago

@vodovozovge does the API support multicasting?

vodovozovge commented 2 years ago

nope, and groups themselves are quite artificial. Basically, when the user controls group from the app, the messages are sent to each individual device.

eibanez commented 2 years ago

Thanks!

PonchoPowers commented 2 years ago

It is worth mentioning here I guess that you can broadcast setpilot requests to the light bulbs, while it won't work per room if you all the light bulbs to be turned on or off at the same time this will work, although one light bulb will most likely always be slightly delayed, as this is UDP the broadcast might not make it to all light bulbs so sending the broadcast in bursts of 5 datagrams at a time helps ensure all the light bulbs respond, no need to wait for a response either because if the 5th datagram doesn't do it the light bulb has likely stopped responding to requests.