diff -r 942af738157c -r e50a5003c7ac www/getdevices.php --- a/www/getdevices.php Tue Apr 23 19:50:05 2024 +0200 +++ b/www/getdevices.php Tue Apr 23 20:45:29 2024 +0200 @@ -56,6 +56,26 @@ if (isset($_POST['update'])) { + $cmd = "DEVICE PUT " . $_POST['uuid'] . "\r\n"; + $cmd .= "TYPE," . $_POST['type'] . "\r\n"; + $cmd .= "DIRECTION," . $_POST['direction'] . "\r\n"; + $cmd .= "VALUE," . $_POST['value'] . "\r\n"; // Only for outputs + $cmd .= "OFFSET," . $_POST['offset'] . "\r\n"; // Only analog + $cmd .= "PRESENT," . $_POST['present'] . "\r\n"; + $cmd .= "ADDRESS," . $_POST['address'] . "\r\n"; // Not for auto detected + $cmd .= "SUBDEVICE," . $_POST['subdevice'] . "\r\n"; // Not for auto detected + $cmd .= "GPIOPIN," . $_POST['gpiopin'] . "\r\n"; + $cmd .= "DESCRIPTION," . $_POST['description'] . "\r\n"; + $cmd .= "COMMENT," . $_POST['comment'] . "\r\n"; + $cmd .= "."; + $answer = send_cmd($cmd); + $arr = explode("\r\n", $answer); + if (! startsWith($arr[0], "219")) { + $response['error'] = true; + $response['msg'] = $arr[0]; + } + exit(json_encode($response)); + } else if (isset($_POST['add'])) { $answer = send_cmd("DEVICE ADD " . $_POST['type']);