récupération après crash
This commit is contained in:
@@ -7,34 +7,31 @@ class availability extends hook
|
||||
// by default all devices are listening for availability
|
||||
protected $devicelist = array();
|
||||
|
||||
function init()
|
||||
{
|
||||
global $indexDevices;
|
||||
$this->iterate();
|
||||
}
|
||||
|
||||
protected function iterate()
|
||||
{
|
||||
global $indexDevices;
|
||||
foreach ($indexDevices as $ieeeAddress => $value)
|
||||
{
|
||||
$deviceList[] = array( $ieeeAddress => "availability");
|
||||
if (!key_exists("availability", $value->properties))
|
||||
{
|
||||
$value->properties["availability"] = "";
|
||||
}
|
||||
}
|
||||
$this->installHooksFunction($indexDevices);
|
||||
}
|
||||
|
||||
function installHooks(&$indexDevices)
|
||||
{
|
||||
static $indexDevicesSize;
|
||||
$tmp = count($indexDevices);
|
||||
if ($tmp != $indexDevicesSize)
|
||||
{
|
||||
$this->iterate();
|
||||
$indexDevicesSize = $tmp;
|
||||
}
|
||||
$this->installHooksFunction($indexDevices);
|
||||
return false;
|
||||
}
|
||||
|
||||
function installHook(&$device)
|
||||
{
|
||||
global $indexDevices;
|
||||
$this->devicelist = array($device["device"]->ieeeAddress => "availability");
|
||||
$this->installHooksFunction($indexDevices);
|
||||
}
|
||||
// callback fonction. Is called with these 3 parameters
|
||||
// $device -> calling device
|
||||
// $property -> parameter passed by mqtt
|
||||
@@ -48,7 +45,7 @@ class availability extends hook
|
||||
{
|
||||
//echo "==========>>>>>> Availability $value" . EOL;
|
||||
//if (!empty($device->availability))
|
||||
//{[ Torrent911.com]
|
||||
//{
|
||||
$log = ALERT;
|
||||
//}else
|
||||
//{
|
||||
|
||||
Reference in New Issue
Block a user