debugging hooks\ncleaning code
This commit is contained in:
@ -80,7 +80,6 @@ function addDevice(& $device, $fn, $jsonDevice )
|
||||
|
||||
//indexing device
|
||||
$indexDevices[$device["device"]->ieeeAddress] = & $device["device"];
|
||||
//print_r($device);
|
||||
}
|
||||
|
||||
function searchPropertyKey($fn, &$device, $object, $listPropertiesKeys)
|
||||
@ -96,7 +95,6 @@ function searchPropertyKey($fn, &$device, $object, $listPropertiesKeys)
|
||||
if ( isset($value->property))
|
||||
{
|
||||
$string = $value->property;
|
||||
//echo "property ===> " . $value->property . EOL;
|
||||
$device->{$string}["value"] = null;
|
||||
$device->$string["functions"] = array();
|
||||
}
|
||||
@ -134,7 +132,7 @@ function changeDevice($topic, $fn, &$device, $payloadArray)
|
||||
|
||||
function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $propertyTree="")
|
||||
{
|
||||
global $changed, $mohaDB;
|
||||
global $changed, $mohaDB, $testMode;
|
||||
$deviceType = (gettype($device) == "object"); // = true if object
|
||||
//echo "devicetype = "; var_dump($deviceType); echo EOL;
|
||||
//print_r($payloadArray);
|
||||
@ -185,8 +183,6 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
|
||||
|
||||
}else
|
||||
{
|
||||
//echo "db_functions".EOL;
|
||||
//($device);
|
||||
if (empty($device->$key) or $value != null)
|
||||
{
|
||||
if (property_exists($device, $key))
|
||||
@ -209,25 +205,19 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
|
||||
$changed[$fn]["key"] = $key;
|
||||
$changed[$fn]["value"] = $value;
|
||||
logger(INFO, sprintf(_("Device %s property %s, value changed to %s"), $fn, $propertyTree . $key, $value));
|
||||
//print_r($device);
|
||||
|
||||
//$mohaDB->logProperty($parentDevice, $propertyTree . $key, $value, $oldValue); TODO re-activate
|
||||
//echo "oldvalue => " . print_r($oldValue, true) . EOL;
|
||||
/*if (empty($oldValue))
|
||||
if ($testMode === false)
|
||||
{
|
||||
echo "Initializing " . $key;
|
||||
$mohaDB->logProperty($parentDevice, $propertyTree . $key, $value, $oldValue);
|
||||
}else
|
||||
{
|
||||
echo "changed " . $key . " value " . $oldValue;;
|
||||
logger(INFO, _("Test mode on: not storing in DB "));
|
||||
}
|
||||
echo " to " . $value . EOL;*/
|
||||
}
|
||||
if (!empty($device->$key["functions"]))
|
||||
{
|
||||
logger(DEBUG,_("executing notifications functions"));
|
||||
foreach($device->$key["functions"] as $function)
|
||||
{
|
||||
//print_r($function);
|
||||
$function($device, $key, $value);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user