Skip to content

Commit

Permalink
Emon CMS 9.1 | 2015.11.02
Browse files Browse the repository at this point in the history
Fix kwh on emoncms update.
  • Loading branch information
chaveiro committed Nov 2, 2015
1 parent b2e6707 commit b5923e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions Modules/input/input_model.php
Expand Up @@ -15,14 +15,11 @@
class Input
{
private $mysqli;
private $feed;
private $redis;

public function __construct($mysqli,$redis,$feed)
{
$this->mysqli = $mysqli;
$this->feed = $feed;

$this->redis = $redis;
}

Expand Down
9 changes: 4 additions & 5 deletions Modules/process/process_processlist.php
Expand Up @@ -281,10 +281,9 @@ public function power_to_kwh($feedid, $time_now, $value)
// only update if last datapoint was less than 2 hour old
// this is to reduce the effect of monitor down time on creating
// often large kwh readings.
if ($last_time && (time()-$last_time)<7200)
{
$time_elapsed = ($time_now - $last_time);
if ($time_elapsed>0 && $time_elapsed<7200) { // 2hrs
// kWh calculation
$time_elapsed = ($time_now - $last_time);
$kwh_inc = ($time_elapsed * $value) / 3600000.0;
$new_kwh = $last_kwh + $kwh_inc;
} else {
Expand Down Expand Up @@ -494,8 +493,8 @@ public function histogram($feedid, $time_now, $value)
$last_time = $lastvalue['time'];

// kWh calculation
if ((time()-$last_time)<7200) {
$time_elapsed = ($time_now - $last_time);
$time_elapsed = ($time_now - $last_time);
if ($time_elapsed>0 && $time_elapsed<7200) { // 2hrs
$kwh_inc = ($time_elapsed * $value) / 3600000;
} else {
$kwh_inc = 0;
Expand Down
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -20,7 +20,7 @@
require "route.php";
require "locale.php";

$emoncms_version = ($feed_settings['redisbuffer']['enabled'] ? "low-write " : "") . "9.1 | 2015.10.30";
$emoncms_version = ($feed_settings['redisbuffer']['enabled'] ? "low-write " : "") . "9.1 | 2015.11.02";

$path = get_application_path();
require "Lib/EmonLogger.php";
Expand Down

0 comments on commit b5923e4

Please sign in to comment.