finishing debugging presence detection
This commit is contained in:
@ -139,10 +139,18 @@ function apiServer($read)
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, PropertiesDashboard($argList));
|
||||
break;
|
||||
case "deleteDevice":
|
||||
case "deletedevice":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, deleteDevice($argList));
|
||||
break;
|
||||
case "present":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn,presence($argList));
|
||||
break;
|
||||
case "ispresent":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, whoIsPresent($argList));
|
||||
break;
|
||||
case "test":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, test($argList));
|
||||
|
@ -135,6 +135,7 @@ function displayMethod($device, $propertyName)
|
||||
$html = '<input type="button" id="' . $device->topic ."/" . $device->friendlyName . "/" . $propertyName . "/" . '" method="' . AUTO . "\" onmouseup=\"setPropertyMethod('" . $device->topic . "', '" . $device->friendlyName . "', '" . AUTO . "', '" . $propertyName . "')\">";
|
||||
$html = '<input type="button" id="' . $device->topic ."/" . $device->friendlyName . "/" . $propertyName . "/" . '" method="' . MANUAL . "\" onmouseup=\"setPropertyMethod('" . $device->topic . "', '" . $device->friendlyName . "', '" . MANUAL . "', '" . $propertyName . "')\">";
|
||||
}
|
||||
|
||||
function mkHTML($device, $propertyName, $choice)
|
||||
{
|
||||
$html = "";
|
||||
@ -265,6 +266,7 @@ function displayProperty($device, $key, $value, $response)
|
||||
|
||||
function iterateProperty($device, $property, $value, &$response, $tab="")
|
||||
{
|
||||
$method = array(1 => "IDLE", "AUTO", "MANUEL");
|
||||
$tab .= " ";
|
||||
if (is_array($value) or is_object($value))
|
||||
{
|
||||
@ -284,7 +286,8 @@ function iterateProperty($device, $property, $value, &$response, $tab="")
|
||||
}
|
||||
}else
|
||||
{
|
||||
$response .= bool2string($value) . "<br>\n";//. displayChoice($device, $property); //value($property, $value, "");
|
||||
if ($property == "method") $value = $method[$value]; //display name of method rather than a number
|
||||
$response .= bool2string($value) . "<br>\n"; //. displayChoice($device, $property); //value($property, $value, "");
|
||||
}
|
||||
}
|
||||
|
||||
@ -567,6 +570,34 @@ function apiDisplayByType($argList)
|
||||
}
|
||||
*/
|
||||
|
||||
function whoIsPresent($argList)
|
||||
{
|
||||
if (array_key_exists("nom", $argList))
|
||||
{
|
||||
$nom = $argList["nom"];
|
||||
$r = isPresent($nom);
|
||||
if ($r)
|
||||
{
|
||||
$r = $nom . _(" est présent") . EOLH;
|
||||
logger(DEBUG, _(" est présent") , __FILE__ . ":" . __LINE__);
|
||||
}elseif(!$r)
|
||||
{
|
||||
$r = $nom . _(" est absent") . EOLH;
|
||||
logger(DEBUG, _("Testing doors") , __FILE__ . ":" . __LINE__);
|
||||
}else
|
||||
{
|
||||
$r = $nom . _(" n'existe pas dans la base de données") . EOLH;
|
||||
logger(DEBUG, _("Testing doors") , __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
$r = isPresent(false, true);
|
||||
$r = "Sont présent: " . EOLH . $r . EOLH;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
global $hooks;
|
||||
@ -578,12 +609,13 @@ function test()
|
||||
$portes = $hooks["alerte_intrusion"]->testPortes();
|
||||
if (!empty($portes))
|
||||
{
|
||||
$msg = _("Opened doors:") . EOLH;
|
||||
foreach($portes as $value)
|
||||
{
|
||||
$msg .= $value . _(" is open") . EOL;
|
||||
$msg .= $value . EOL;
|
||||
}
|
||||
}
|
||||
return nl2br($msg);
|
||||
return $msg;
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user