diff -r 244de612c572 -r b73490398368 www-thermferm/index.php --- a/www-thermferm/index.php Sat Aug 02 22:33:15 2014 +0200 +++ b/www-thermferm/index.php Sun Aug 03 22:49:33 2014 +0200 @@ -35,8 +35,21 @@ * Handle the post events */ if (isset($_POST['mode']) && isset($_POST['UUID'])) { - send_cmd('UNIT '.$_POST['UUID']); - send_cmd('MODE '.$_POST['mode']); + $sock = open_socket(); + if ($sock != false) { + socket_write($sock, 'UNIT PUT '.$_POST['UUID'], 4096); + usleep(20000); + socket_write($sock, 'MODE,'.$_POST['mode'], 4096); + usleep(20000); + socket_write($sock, '.', 4096); + /* Absorb response */ + while (1) { + $line = socket_read($sock, 4096); + if ($line === '') + break; + } + socket_close($sock); + } unset($_POST['UUID']); unset($_POST['mode']); }