1
0
This commit is contained in:
2022-05-29 01:55:22 +02:00
parent 68fb0579ce
commit cde4d728cf
7 changed files with 79 additions and 63 deletions

View File

@ -275,12 +275,16 @@ function getDevicesValues($topic)
function changeValue(&$property, $value, &$parentDevice, $propertyTree, $key)
{
global $mohaDB;
global $mohaDB, $properties2log;
//$changed[$fn]["key"] = $key;
//$changed[$fn]["value"] = $value;
logger(INFO, sprintf(_("Logging Device property %s, %s"), $propertyTree . $key, bool2string($value)), __FILE__ . ":" . __LINE__);
$mohaDB->logProperty($parentDevice, $key, $value, $property["value"]);
logger(DEBUG, sprintf(_("old value was %s, new is %s" ), bool2string($property["value"]), bool2string($value)), __FILE__ . ":" . __LINE__);
if (array_key_exists($key, $properties2log))
{
logger(INFO, sprintf(_("Logging Device property %s, %s"), $propertyTree . $key, bool2string($value)), __FILE__ . ":" . __LINE__);
$mohaDB->logProperty($parentDevice, $key, $value, $property["value"]);
logger(DEBUG, sprintf(_("old value was %s, new is %s" ), bool2string($property["value"]), bool2string($value)), __FILE__ . ":" . __LINE__);
}
$property["value"] = $value;
if (!empty($property["functions"]))
{
@ -289,7 +293,15 @@ function changeValue(&$property, $value, &$parentDevice, $propertyTree, $key)
{
try
{
$function($parentDevice, $key, $value);
logger(INFO, print_r($function, true), __FILE__ . ":" . __LINE__);
if ( $function[0]->active === true )
{
$function($parentDevice, $key, $value);
}else
{
logger(INFO, $function . _(" is disabled"), __FILE__ . ":" . __LINE__ );
}
}catch (Exception $e)
{
$s = 'Exception reçue : ' . $e->getMessage();