finished rdc_temperature_int_ext.php\ncontinued events.php (recurrence)
This commit is contained in:
18
class/db.php
18
class/db.php
@ -39,16 +39,22 @@ class db extends mysqli
|
||||
{
|
||||
global $mohaDB, $properties2log, $testMode;
|
||||
$precision = 0;
|
||||
$oldValue = $device->properties[$property]["lastValueLogged"];
|
||||
|
||||
//echo "############## logProperty ################\nproperty => " . $propertyTree .EOL;
|
||||
//echo "logging in database";
|
||||
//var_dump($device);
|
||||
$ieeeAddress = $device->ieeeAddress;
|
||||
//print_r($ieeeAddress);
|
||||
$query = "INSERT INTO logs (device, property, value) VALUES('" . $this->protect($ieeeAddress) . "', '" . $this->protect($property) . "', '" . $this->protect(bool2string($value)) . "')";
|
||||
//echo $query . EOL;
|
||||
if (is_numeric($value) and !empty($properties2log[$property]))
|
||||
{
|
||||
if (!array_key_exists("lastValueLogged", $device->properties[$property]))
|
||||
{
|
||||
$oldvalue = -1;
|
||||
}else
|
||||
{
|
||||
$oldValue = $device->properties[$property]["lastValueLogged"];
|
||||
}
|
||||
// calculate a min/max value for storing data
|
||||
$r = $properties2log[$property];
|
||||
if (is_callable($r))
|
||||
@ -59,10 +65,9 @@ class db extends mysqli
|
||||
$minMax = $r;
|
||||
}
|
||||
logger(DEBUG, _("minMax = " . $minMax), __FILE__ . ":" . __LINE__);
|
||||
var_dump($value) . EOL;
|
||||
var_dump($minMax) . EOL;
|
||||
var_dump($oldValue) . EOL;
|
||||
if ( !is_numeric($oldValue)) $oldValue = 0;
|
||||
//var_dump($value) . EOL;
|
||||
//var_dump($minMax) . EOL;
|
||||
//var_dump($oldValue) . EOL;
|
||||
//echo "minMax = " .$minMax . EOL;
|
||||
//echo "oldValue = " . $oldValue . EOL;
|
||||
//echo "Value = " . $value . EOL;
|
||||
@ -77,6 +82,7 @@ class db extends mysqli
|
||||
logger(INFO, _("Test mode on: not storing in DB "), __FILE__ . ":" . __LINE__);
|
||||
}else
|
||||
{
|
||||
$query = "INSERT INTO logs (device, property, value) VALUES('" . $this->protect($ieeeAddress) . "', '" . $this->protect($property) . "', '" . $this->protect(bool2string($value)) . "')";
|
||||
if(!$this->result = $this->query($query))
|
||||
{
|
||||
logger(ERROR, _("mysql query errror: ") . $this->error, __FILE__ . ":" . __LINE__);
|
||||
|
@ -70,13 +70,13 @@ class event
|
||||
public $function;
|
||||
public $device;
|
||||
public $published;
|
||||
public $dateTimeEvent; // datetime : next occurence for recurrent event
|
||||
public $dateTimeEvent; // recurrent event: datetime
|
||||
public $startDatetime;
|
||||
public $stopDatetime;
|
||||
public $recurrenceInterval; // interval : for recurrent event
|
||||
public $recurrence; // recurrent event: interval or date to add
|
||||
public $exceptionInterval; // array of object ranges
|
||||
public $method; // cf: constants.php (IDLE, AUTO, MANUAL)
|
||||
public $isInterval; // 0 => recurence by date 1 => by interval
|
||||
public $isInterval = false; // 0 => recurence by date 1 => by interval
|
||||
}
|
||||
|
||||
class watch
|
||||
|
Reference in New Issue
Block a user