diff --git a/opt/inverter/inverter.php b/opt/inverter/inverter.php index 84b9900..5cbffab 100644 --- a/opt/inverter/inverter.php +++ b/opt/inverter/inverter.php @@ -67,12 +67,12 @@ while (!$bStop && !System_Daemon::isDying()) { if ($bAwake && !$bSleep) { /* Schedule next sleep time */ - if (!$bAlarm) { + /*if (!$bAlarm) { $sTime = date('H:i', strtotime($sSleep)); System_Daemon::info(sprintf('Schedule sleep at %s', $sTime)); command(sprintf('at -f %s %s 2> /dev/null', FILE_DAEMON_STOP, $sTime)); $bAlarm = true; - } + }*/ /* Execute task */ System_Daemon::info('Running task'); diff --git a/opt/inverter/pvoutput.php b/opt/inverter/pvoutput.php index 2c23eaf..84a12f3 100644 --- a/opt/inverter/pvoutput.php +++ b/opt/inverter/pvoutput.php @@ -17,7 +17,9 @@ $aSystems = array( ); /* Fake command line for debugging */ -//$argv = array(null, 1.5, 1234, 230, '1204DQ0116'); +if (count($argv) < 5) { + $argv = array(null, 1.5, 1234, 230, '1204DQ0116'); +} /* Fetch command line arguments */ $fToday = floatval($argv[1]); // Wh @@ -77,7 +79,7 @@ $aToday[3] = $fTemperature; file_put_contents($sTodayFile, implode(',', $aToday)); /* Correct today data */ -$fToday = $fToday > ((1 + MARGIN_ENERGY) * $aToday[1]) ? $aToday[1] : $fToday; +$fToday = abs($aToday[1] - $fToday) > (MARGIN_ENERGY * $aToday[1]) ? $aToday[1] : $fToday; /* Construct PVOutput data */ $aData = array(