1
0

debugging hooks and events

This commit is contained in:
2022-01-20 00:26:57 +01:00
parent e4703dafc8
commit 10f2a1087a
9 changed files with 66 additions and 58 deletions

View File

@ -189,10 +189,7 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
{
if (is_array($device->$key))
{
if (!empty($device->$key["value"]))
{
$oldValue = $device->$key["value"];
}
$oldValue = $device->$key["value"];
}else
{
$oldValue = $device->$key;
@ -202,6 +199,7 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
$device->{$key} = array("value" => null);
$device->$key["functions"] = array();
}
echo $key . 'oldvalue = ' . $oldValue . " value = " . $value . EOL;
if ($oldValue !== $value)
{
$device->$key["value"] = $value;
@ -209,13 +207,14 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
//$changed[$fn]["value"] = $value;
logger(INFO, sprintf(_("Device %s property %s, %s"), $fn, $propertyTree . $key, bool2string($value)));
$mohaDB->logProperty($parentDevice, $propertyTree . $key, $value, $oldValue);
}
if (!empty($device->$key["functions"]))
{
logger(DEBUG,_("executing notifications functions"));
foreach($device->$key["functions"] as $function)
print_r($device->$key);
if (!empty($device->$key["functions"]))
{
$function($device, $key, $value);
logger(DEBUG,_("executing notifications functions"));
foreach($device->$key["functions"] as $function)
{
$function($device, $key, $value);
}
}
}
//}