
TCW210-TH-R1.16- November 2022
Page 26
monitorNcontrol
OID
Name
Access
Description
Syntax
x.4.3.5.0
configurationSaved
read-write
Configuration save status SAVED/UNSAVED
INTEGER { unsaved(0),
saved(1) }
x.4.3.6.0
restartDevice
read-write
Restart Device
INTEGER { cancel(0),
restart(1) }
x.4.3.7.0
temperatureUnit
read-only
Unit of the all temperature values
INTEGER { celcius(0),
fahrenheit(1) }
x.4.3.8.0
hardwareErr
read-only
Hardware Error
INTEGER { noErr(0),
owErr(1), hwErr(2) }
8.2.
HTTP API
8.2.1.
HTTP Post
TCW210-TH can execute HTTP/HTTPS Post to upload XML/JSON file to a dedicated server.
This functionality is very useful if the controller is behind the router without public IP address or
the user don’t have access to router configuration. The server should have a public IP address.
The typical monitoring application is shown in the picture below:
HTTP/HTTPS post can be sent periodically or periodically plus on an alarm condition.
To test HTTP/HTTPS Post follow the steps below:
•
Save following code like post.php:
<?php
define("FILENAME", 'status.xml');
define("FOLDER", '');
define("SEPARATOR", '');
define("STR_SUCCESS", 'set FIN');
define("STR_ERROR", 'error');
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$datePrefix = date('YmdHis', strtotime('now'));
$pathname = FOLDER.SEPARATOR.$datePrefix.'_'.FILENAME;
$postdata = file_get_contents("php://input");
$handle = fopen($pathname, 'w+');
$content = var_export($postdata, true);
fwrite($handle, substr($content, 1, strlen($content)-2));
fclose($handle);
echo (($handle === false) ? STR_ERROR : STR_SUCCESS)."\r\n";
}
else {
echo "The PHP script is working!";
}
?>
Summary of Contents for TCW210-TH
Page 1: ......
Page 43: ...TCW210 TH R1 16 November 2022 Page 42 Appendix A Fig 1...