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

@ -88,6 +88,7 @@ function addDevice($topic, $fn, $jsonDevice, $group=false )
{
$device["device"]->type = $jsonDevice["type"];
$device["device"]->ieeeAddress = $jsonDevice["ieee_address"];
$hooks["availability"]->installHook($device);
if ( !empty($jsonDevice["power_source"] ))
{
$device["device"]->powerSource = $jsonDevice["power_source"];
@ -126,7 +127,7 @@ function searchPropertyKey($fn, &$device, $inputObject, $listPropertiesKeys)
$device->properties[$string]["functions"] = array();
if(array_key_exists("access", $inputObject))
{
if ($inputObject["access"] && 2)
if ($inputObject["access"] & 2)
{
$device->properties[$string]["method"] = IDLE;
}
@ -231,7 +232,7 @@ function iterateDevice($topic, $fn, &$parentDevice, &$properties, $payloadArray,
$properties[$key]["functions"] = array();
if (array_key_exists("access", $properties[$key]))
{
if ($properties[$key]["access]"] && 2)
if ($properties[$key]["access]"] & 2)
{
$properties[$key]["method"] = IDLE;
}
@ -265,21 +266,17 @@ function getDevicesValues($topic)
{
if ($value["access"] & 4)
{
logger(DEBUG, _("Getting values of property: " . $property), __FILE__ . ":" . __LINE__ );
$device->payload[$property] = "";
$flag = true;
$device->get();
break;
}
}
}
//logger(DEBUG, print_r($device->payload, true), __FILE__ . ":" . __LINE__ );
if ($flag === true)
{
$device->get();
}
}else
{
}else
{
logger(DEBUG, _("no properties to get for device: " . $device->friendlyName ), __FILE__ . ":" . __LINE__ );
}
}
}
}
@ -295,6 +292,15 @@ function changeValue(&$property, $value, &$parentDevice, $propertyTree, $key)
{
logger(INFO, sprintf(_("Logging Device property %s, %s"), $propertyTree . $key, bool2string($value)), __FILE__ . ":" . __LINE__);
$mohaDB->logProperty($parentDevice, $key, $value);
/*
if (!empty($propertiesLoggers))
{
foreach($propertiesLoggers as $logger)
{
$logger->callBack($parentDevice, $key, $value);
}
}
*/
logger(DEBUG, sprintf(_("old value was %s, new is %s" ), bool2string($property["value"]), bool2string($value)), __FILE__ . ":" . __LINE__);
}
$property["value"] = $value;