Forward commands from PHP to LightwaveRF
I write this little forwarder recently so that other bits of software in our house/network could send commands to our LightwaveRF kit without needing to be registered on the hub, effectively giving local speed access to all software integrations.
I’ve got a little web server running on a Pi, that machine is registered with the lightwaverf hub (it runs my Logitech Harmony integrations). That server can then be used to forward commands like this:
<html> <head> <title>MMD PI Lightwave Control</title> </head> <body> <h2>RPI Lightwave Command forwarder</h2> <?php $lw_command = $_GET['command']; $server_ip ='192.168.0.10'; $server_port = '9760'; $message = '666,!'.$lw_command; $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_sendto($socket, $message, strlen($message), 0, $server_ip, $server_port); ?> <strong>Sent command: </strong> <?= $message ?> </body> </html>
Now other bits of software on web pages or native clients can simply call urls such as
(room 3 device 3 turn on)