Yeelight API - set_music method

Hello Yeelight fans and staff,

I am making a C# application, similiar to the music flow service in the Yeelight app. I listen to the soundcard in my PC, analyse and group the frequencies so I can differentiate between low, middle and high tones. With that data I want to control my lights from my desktop. Everything is working fine, I can discover, connect and control the lights.

The problem is, I want to control my lights as accurate to the sounds as possible, which is why I need to enable music mode (as the Yeelights only accept around 60 requests per minute in normal circumstances). The developer documentation specifies I have to run the following command: ‘{“id”:1,“method”:“set_music”,“params”:[1, “My desktops local IP", 1982]}’, but this execution fails. I am actually not sure what port to use. How do I figure out the port my lights are communicating with on my PC?

I am using roddone’s C# YeelightAPI framework. (https://github.com/roddone/YeelightAPI), but I’m not sure if that framework fully supports the music mode protocol, as the Yeelight developer documentation states that the TCP connection must exist firstly (which it does), but after that it the documentation specifies it should create a new connection. I am assuming this is to switch over from the multicast address to a direct addres. How would I go about doing that if that is necessary?

Thank you for reading and I hope you all have a great day.

I use 55443

Can you explain how you set up the server? Is it UDP or TCP? As far as i know now you have to set one up yourself and connect the yeelight to that so it no longer listens to the multicast as long as the connection stays up and music mode is enabled

From today (version 1.9), YeelightAPI fully supports music mode :wink:
Please give it a try and open issues on github if you encounter problems.