I just want to switch an HTTP Device via a URL. What is the expected answer from the device?
Background: The device is switching but the status of the element in the webinterface does not really change,
it gets greyed ...

When I call the URL
to switch it on or off. My webssh.php skript answers with a simple "on" or "off", which comes from a bash script called ...
Code: Select all
<?php
/* get parameters stored in URL command*/
$cmd=$_GET["cmd"];
$host=$_GET["host"];
$parm1=$_GET["par1"];
$parm2=$_GET["par2"];
$parm3=$_GET["par3"];
$parm4=$_GET["par4"];
if ($host != "") {
/*$resp = shell_exec("ssh $host $cmd $parm1 $parm2 $parm3 2>&1");*/
$resp = shell_exec("/Heimautomation/webssh $host $cmd $parm1 $parm2 $parm3 $parm4 2>&1");
$say = $resp;
} else {
$resp = shell_exec("/Heimautomation/$cmd $parm1 $parm2 $parm3 $parm4 2>&1");
$say = $resp;
}
?>
<html>
<head>
<title>MTK WebSSH Interface</title>
</head>
<body>
<?php print($say); ?>
<form>
</form>
</body>
</html>
Code: Select all
if (typeof(response.data) === "string") {
var _data = response.data.trim();
if (deviceType === "switchBinary" || deviceType === "sensorBinary") {
if (_data === "1" || _data === "on" || _data === "true") {
data = "on";
} else if (_data === "0" || _data === "off" || _data === "false") {
data = "off";
}
}
Any hint what might be wrong?
kind regards
MTK