added notify command to webserver
This commit is contained in:
@@ -72,12 +72,7 @@ function askWebServer($read)
|
||||
{
|
||||
if(!empty($topic))
|
||||
{
|
||||
$var = $var[$topic];
|
||||
$path = explode("/", $argList["fn"]);
|
||||
foreach($path as $tmp)
|
||||
{
|
||||
$var = $var[$tmp];
|
||||
}
|
||||
$var = getDevice($topic, $argList["fn"]);
|
||||
}else
|
||||
{
|
||||
$str = _("topic is not defining: add &topic=\nThese topics are availables: ");
|
||||
@@ -103,6 +98,15 @@ function askWebServer($read)
|
||||
}
|
||||
fwrite($spawn, $response);
|
||||
break;
|
||||
case "notify":
|
||||
if (!array_key_exists("topic", $argList) or !array_key_exists("fn", $argList) or !array_key_exists("property", $argList) or !array_key_exists("condition", $argList) or !array_key_exists("value", $argList))
|
||||
{
|
||||
fwrite($spawn, _("Error: With 'notify' command, you need 4 parameters: topic, fn, property, condition, value"));
|
||||
}else
|
||||
{
|
||||
$monitored[] = new watch($argList["topic"], $argList["fn"], $argList["property"], $argList["condition"], $argList["value"]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
logger(DEBUG, _("unknown command"), __FILE__ . ":" . __LINE__);
|
||||
fwrite($spawn, _("unknown command"));
|
||||
|
||||
Reference in New Issue
Block a user