I have recently purchased a MiLight wifi controller for my LED strip. It works fine, and I can control my RGB LED strip with the MiLight app.
What I am trying to do, is control it from my raspberry pi. When the app 'controls' the LED strip, it sends a hex code to the WiFi controller via UDP. I managed to find some of the hex codes using the 'Packet Capture' app on my phone.
Then, using 'Packet Sender' or 'UDP sender' on my phone, I can send these hex codes to the wifi controller and it changes the colour,brightness etc. accordingly:
However, I want to send these hex code requests via UDP using PHP and I am having no luck. Whatever I do, nothing happens. Is there a proper way of sending hex codes?
Here's what I've tried (the hex code I have tried to send is 22 00):
Code: Select all
<?php
echo "test";
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); //Create the socket
$msg = "22 00";
$len = strlen($msg);
socket_sendto($sock, $msg, $len, 0, '192.168.0.18', 8899);
socket_close($sock);
echo "test2";
?>