1
0

récupération après crash

This commit is contained in:
2022-12-05 12:23:43 +01:00
parent 559039b5e3
commit a27db71327
22 changed files with 300 additions and 147 deletions

View File

@@ -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
//{