1
0

debugging

This commit is contained in:
2022-01-17 00:18:50 +01:00
parent cd20e973cd
commit 4fb5504cdc
18 changed files with 379 additions and 269 deletions

View File

@ -2,28 +2,25 @@
class availability
{
public $hookname = "availability";
public $initialized = true;
// by default all devices are listening for availability
function __construct()
{
global $devices;
$this->iterate($devices);
$this->iterate();
}
private function iterate(& $device)
private function iterate()
{
foreach ($device as $key => $value)
global $indexDevices;
foreach ($indexDevices as $value)
{
if (gettype($value) == "array")
{
$this->iterate($value);
}elseif (is_a($value, "device"))
{
$value->availability["functions"][] = array($this,"callback");
}
$value->availability["functions"][] = array($this,"callback");
}
}
// callback fonction. Is called with these 3 parameters
// $device -> calling device
// $property -> parameter passed by mqtt