no message
This commit is contained in:
@@ -11,6 +11,10 @@ Easee-Konto wird eine weitere Gateway-Instanz benötigt.
|
|||||||
Stromvorgaben werden von den Ladestationsinstanzen an das Gateway übergeben und
|
Stromvorgaben werden von den Ladestationsinstanzen an das Gateway übergeben und
|
||||||
von dort über die Easee-REST-API gesendet.
|
von dort über die Easee-REST-API gesendet.
|
||||||
|
|
||||||
|
Bei 0 A pausiert das Gateway die aktuelle Ladesitzung. Beim anschließenden
|
||||||
|
Wechsel auf einen positiven Strom wird die Sitzung zuerst fortgesetzt und danach
|
||||||
|
das neue dynamische Stromlimit gesetzt.
|
||||||
|
|
||||||
Der benötigte WebSocket-Client wird nach dem Speichern der Easee-Zugangsdaten
|
Der benötigte WebSocket-Client wird nach dem Speichern der Easee-Zugangsdaten
|
||||||
automatisch erstellt und konfiguriert. Im WebSocket-Client muss keine URL
|
automatisch erstellt und konfiguriert. Im WebSocket-Client muss keine URL
|
||||||
eingetragen werden.
|
eingetragen werden.
|
||||||
|
|||||||
+49
-1
@@ -50,6 +50,7 @@ class EaseeGateway extends IPSModule
|
|||||||
$this->SetBuffer("Subscriptions", "{}");
|
$this->SetBuffer("Subscriptions", "{}");
|
||||||
$this->SetBuffer("SubscribedThisConnection", "{}");
|
$this->SetBuffer("SubscribedThisConnection", "{}");
|
||||||
$this->SetBuffer("PendingInvocations", "{}");
|
$this->SetBuffer("PendingInvocations", "{}");
|
||||||
|
$this->SetBuffer("LastCommandedCurrents", "{}");
|
||||||
$this->SetValue("SubscriptionCount", 0);
|
$this->SetValue("SubscriptionCount", 0);
|
||||||
$this->SetConnected(false);
|
$this->SetConnected(false);
|
||||||
|
|
||||||
@@ -551,12 +552,59 @@ class EaseeGateway extends IPSModule
|
|||||||
return ["success" => false, "error" => "Strom muss zwischen 0 und 32 A liegen"];
|
return ["success" => false, "error" => "Strom muss zwischen 0 und 32 A liegen"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->AuthorizedApiRequest(
|
$lastCurrents = $this->ReadBufferArray("LastCommandedCurrents");
|
||||||
|
$previousAmps = isset($lastCurrents[$serialNumber])
|
||||||
|
? (float)$lastCurrents[$serialNumber]
|
||||||
|
: null;
|
||||||
|
|
||||||
|
if ($amps <= 0) {
|
||||||
|
$result = $this->AuthorizedApiRequest(
|
||||||
|
"POST",
|
||||||
|
"/api/chargers/" . rawurlencode($serialNumber) .
|
||||||
|
"/commands/pause_charging",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($result["success"] ?? false) {
|
||||||
|
$lastCurrents[$serialNumber] = 0;
|
||||||
|
$this->SetBuffer("LastCommandedCurrents", json_encode($lastCurrents));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Easee behandelt 0 A als pausierte Sitzung. Beim ersten positiven
|
||||||
|
// Sollwert nach 0 A muss die Sitzung vor dem Setzen des Stromlimits
|
||||||
|
// explizit fortgesetzt werden. Resume setzt das dynamische Limit zurueck.
|
||||||
|
if ($previousAmps === null || $previousAmps <= 0) {
|
||||||
|
$resumeResult = $this->AuthorizedApiRequest(
|
||||||
|
"POST",
|
||||||
|
"/api/chargers/" . rawurlencode($serialNumber) .
|
||||||
|
"/commands/resume_charging",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!($resumeResult["success"] ?? false)) {
|
||||||
|
$resumeResult["error"] =
|
||||||
|
"Ladevorgang konnte nicht fortgesetzt werden: " .
|
||||||
|
(string)($resumeResult["error"] ?? "Unbekannter Fehler");
|
||||||
|
return $resumeResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->AuthorizedApiRequest(
|
||||||
"POST",
|
"POST",
|
||||||
"/api/chargers/" . rawurlencode($serialNumber) .
|
"/api/chargers/" . rawurlencode($serialNumber) .
|
||||||
"/commands/set_dynamic_charger_current",
|
"/commands/set_dynamic_charger_current",
|
||||||
json_encode(["amps" => $amps, "minutes" => 0])
|
json_encode(["amps" => $amps, "minutes" => 0])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($result["success"] ?? false) {
|
||||||
|
$lastCurrents[$serialNumber] = $amps;
|
||||||
|
$this->SetBuffer("LastCommandedCurrents", json_encode($lastCurrents));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function AuthorizedApiRequest(string $method, string $path, string $body): array
|
private function AuthorizedApiRequest(string $method, string $path, string $body): array
|
||||||
|
|||||||
Reference in New Issue
Block a user