Music Mode with Python library

Hello Guys,

First thread here :slight_smile: nice to meet you.

I was working on a project to have music mode on my PC. I am working with the python yeelight library and I use it to send the settings to the lamp when the music changes.

I have 2 bulbs and that is the problem, there is a little delay cause it first send a packet to one lamp and then send a packet to the other.

I have not really understand how UDP broadcast works with this lamp and if I can use it via the library. At the same time I have seen that with the new firmware musicmode is possible in a group! Anybody knows how it actually work?

I am not a programmer or whatsoever, I am just a geek who wants to make his hands dirty with code :slight_smile:

All the group features are using following logic (for each bulb in group; send command; done). Under WiFi network, you can’t guarantee 100% sync except using beacon mechanism which is not connection-oriented. However, put the command in beacon message is very tricky and private, that means you can’t work with other WiFi devices. So for your case, the answer is: there is no solution, the delay can’t be eliminated. (you are also talking about UDP broadcast, yes, it can make the situation a little better, but our 3rd party protocol is not build upon this mechanism and I also don’t know others who do)

Hi. I don’t have a lot of networking knowledge and so I do not know if this will work or not. But here it goes.

You could try creating two threads using the threading or _thread python module. I am not sure if it would allow two requests to be sent simultaneously, but I don’t see why not.