Help with UDP Connect to Yeelight Smart Light

Hello all!

I have a question about using Game Maker Studio to connect to the Yeelight WLAN connected smart lights.

For reference, here's the developer page for Yeelights: https://www.yeelight.com/en_US/developer
And here is the reference manual for their communication standards: https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf

Here is my code for the server object:
Creation:
Code:
///Setup UDP Server
server = network_create_server_raw(network_socket_udp,43210,100);
send_buffer = buffer_create(1024,buffer_fixed,1);
Destroy:
Code:
///Releasing Memory
network_destroy(server);
buffer_delete(send_buffer);
Networking:
Code:
///Server Networking
var buffer = async_load[? "buffer"];
buffer_seek(buffer, buffer_seek_start,0);
var txt = buffer_read(buffer,buffer_text);
show_message(string(txt))
Key Pressed <Space>
Code:
///Send Search Request
buffer_seek(send_buffer, buffer_seek_start,0);
buffer_write(send_buffer, buffer_text,'M-SEARCH * HTTP/1.1\r\n
HOST: 239.255.255.250:1982\r\n
MAN: "ssdp:discover"\r\n
ST: wifi_bulb')

network_send_udp_raw(server,"239.255.255.250",1982,send_buffer,buffer_tell(send_buffer));
Ostensibly, when I send the search request using the Spacebar, the light should send a response buffer to the server (per the Operaction Specs PDF) that starts with "HTTP/1.1 200 OK". But, I am getting no response. I'm thinking my limited knowledge of UDP networking might mean I'm setting the server up incorrectly, but I'm having difficulty finding resources to help with this.

Before you ask, I have enabled developer mode on the light and verified my computer CAN control the light as the windows example worked just fine.

Thanks for your help :)
 
Last edited:

FrostyCat

Redemption Seeker
\r\n won't work if you're on GMS 1.4 (I'm guessing that because your string is single-quote delimited). You would have to work around it by adding chr(13)+chr(10) instead.
 
Top