- added dashboard\n- some debugging
This commit is contained in:
@ -2,16 +2,20 @@
|
||||
|
||||
logger(DEBUG,_("Including db_functions.php"), __FILE__ . ":" . __LINE__);
|
||||
|
||||
// to save or not to save the DB, that is the question ...
|
||||
//to save or not to save the DB, that is the question ...
|
||||
function storeDB($db, $filepath)
|
||||
{
|
||||
$data = serialize($db);
|
||||
file_put_contents($filepath, $data);
|
||||
return file_put_contents($filepath, $data);
|
||||
}
|
||||
|
||||
function loadDB(& $db, $filepath)
|
||||
{
|
||||
$data = file_get_contents($filepath);
|
||||
if ($data === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$db = unserialize($data);
|
||||
}
|
||||
|
||||
@ -230,9 +234,36 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
|
||||
}
|
||||
}
|
||||
|
||||
function getDevicesValues()
|
||||
function getDevicesValues($topic)
|
||||
{
|
||||
//TODO
|
||||
global $indexDevices, $topics;
|
||||
logger(DEBUG, _("getDevicesValues function" ));
|
||||
foreach($indexDevices as $device)
|
||||
{
|
||||
if ($device->topic == $topic)
|
||||
{
|
||||
logger(DEBUG, "device: " . $device->friendlyName);
|
||||
$payload = "{";
|
||||
$flag = false;
|
||||
$properties = array_slice($device, 12);
|
||||
logger(DEBUG, print_r($properties, true));
|
||||
foreach($properties as $property)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
$payload = ",";
|
||||
}else {
|
||||
$flag = true;
|
||||
}
|
||||
$payload .= $property . ':""';
|
||||
}
|
||||
$device->payload = $payload . "}";
|
||||
logger(DEBUG, $device->payload);
|
||||
$device->get();
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user