feat: Anlagentopologie im Manager abbilden
This commit is contained in:
@@ -6,7 +6,9 @@ require_once __DIR__ . '/../libs/ManagerSchnittstelle.php';
|
||||
require_once __DIR__ . '/../libs/Nachrichtenvertrag.php';
|
||||
require_once __DIR__ . '/../libs/ManagerRegler.php';
|
||||
require_once __DIR__ . '/../libs/Lizenzpruefung.php';
|
||||
require_once __DIR__ . '/../libs/Anlagentopologie.php';
|
||||
|
||||
use Belevo\EnelixEMS\Anlagentopologie;
|
||||
use Belevo\EnelixEMS\Lizenzpruefung;
|
||||
use Belevo\EnelixEMS\ManagerRegler;
|
||||
use Belevo\EnelixEMS\ManagerSchnittstelle;
|
||||
@@ -91,6 +93,9 @@ class Manager extends IPSModule implements ManagerSchnittstelle
|
||||
$this->RegisterPropertyString('Monatsgrenzen', $this->standardMonatsgrenzen());
|
||||
$this->RegisterPropertyFloat('SollwertSolarladen', 0.0);
|
||||
$this->RegisterPropertyFloat('Umschaltdifferenz', 5.0);
|
||||
$this->RegisterPropertyString('AnlagenWechselrichter', '[]');
|
||||
$this->RegisterPropertyString('AnlagenPVFlaechen', '[]');
|
||||
$this->RegisterPropertyString('AnlagenBatterien', '[]');
|
||||
$this->RegisterPropertyString('PrognoseAnschluss', '{}');
|
||||
$this->RegisterPropertyString('SDLAnschluss', '{}');
|
||||
$this->RegisterPropertyString('Lizenzcode', '');
|
||||
@@ -253,6 +258,14 @@ class Manager extends IPSModule implements ManagerSchnittstelle
|
||||
return json_encode($formular, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
public function AnlagentopologieExportieren(): string
|
||||
{
|
||||
return json_encode(
|
||||
$this->leseAnlagentopologie(),
|
||||
JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES
|
||||
);
|
||||
}
|
||||
|
||||
public function MessageSink($zeitstempel, $senderID, $nachricht, $daten): void
|
||||
{
|
||||
if ((int) $senderID === $this->ReadPropertyInteger('NetzleistungVariableID')
|
||||
@@ -1415,6 +1428,7 @@ class Manager extends IPSModule implements ManagerSchnittstelle
|
||||
$this->leseAktiveVerbraucherIDs('VerbraucherZuordnung');
|
||||
$this->leseAktiveVerbraucherIDs('AutomatischeVerbraucherZuordnung');
|
||||
$this->dekodiereMonatsgrenzen($this->ReadPropertyString('Monatsgrenzen'));
|
||||
$this->leseAnlagentopologie();
|
||||
foreach (['PrognoseAnschluss', 'SDLAnschluss', 'StoermeldeAnschluss'] as $property) {
|
||||
$wert = json_decode($this->ReadPropertyString($property), true, 512, JSON_THROW_ON_ERROR);
|
||||
if (!is_array($wert)) {
|
||||
@@ -1423,6 +1437,17 @@ class Manager extends IPSModule implements ManagerSchnittstelle
|
||||
}
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
private function leseAnlagentopologie(): array
|
||||
{
|
||||
return Anlagentopologie::ausJson(
|
||||
$this->ReadPropertyString('AnlagenWechselrichter'),
|
||||
$this->ReadPropertyString('AnlagenPVFlaechen'),
|
||||
$this->ReadPropertyString('AnlagenBatterien'),
|
||||
$this->ReadAttributeString('LizenzInstallationID')
|
||||
);
|
||||
}
|
||||
|
||||
/** @return array<int, float> */
|
||||
private function dekodiereMonatsgrenzen(string $json): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user