no message
This commit is contained in:
+1
-32
@@ -40,38 +40,7 @@ class PV_Visu extends IPSModule
|
|||||||
*/
|
*/
|
||||||
public function GetVisualizationTile()
|
public function GetVisualizationTile()
|
||||||
{
|
{
|
||||||
$start = strtotime('today 00:00');
|
$this->UpdateData();
|
||||||
$end = time();
|
|
||||||
|
|
||||||
$prod = $this->GetDailyTotal($this->ReadPropertyInteger('VarProduction'), $start, $end);
|
|
||||||
$cons = $this->GetDailyTotal($this->ReadPropertyInteger('VarConsumption'), $start, $end);
|
|
||||||
$feed = $this->GetDailyTotal($this->ReadPropertyInteger('VarFeedIn'), $start, $end);
|
|
||||||
$grid = $this->GetDailyTotal($this->ReadPropertyInteger('VarGrid'), $start, $end);
|
|
||||||
|
|
||||||
// Prozent-Quoten
|
|
||||||
$prodCons = $prod > 0 ? ($cons / $prod) * 100 : 0;
|
|
||||||
$prodFeed = $prod > 0 ? ($feed / $prod) * 100 : 0;
|
|
||||||
$consPV = $cons > 0 ? min($prod, $cons) / $cons * 100 : 0;
|
|
||||||
$consGrid = $cons > 0 ? ($grid / $cons) * 100 : 0;
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'prodCons' => round($prodCons, 1),
|
|
||||||
'prodFeed' => round($prodFeed, 1),
|
|
||||||
'consPV' => round($consPV, 1),
|
|
||||||
'consGrid' => round($consGrid, 1),
|
|
||||||
'value' => [
|
|
||||||
'prod' => round($prod, 2),
|
|
||||||
'cons' => round($cons, 2),
|
|
||||||
'feed' => round($feed, 2),
|
|
||||||
'grid' => round($grid, 2),
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// Daten als JSON-String übergeben
|
|
||||||
$json = json_encode($data);
|
|
||||||
IPS_LogMessage("TEST", print_r($data));
|
|
||||||
|
|
||||||
$this->UpdateVisualizationValue($json);
|
|
||||||
|
|
||||||
// HTML-Template laden und zurückgeben
|
// HTML-Template laden und zurückgeben
|
||||||
$htmlPath = __DIR__ . '/module.html';
|
$htmlPath = __DIR__ . '/module.html';
|
||||||
|
|||||||
Reference in New Issue
Block a user