no message

This commit is contained in:
dh
2026-08-06 11:50:34 +02:00
parent 6763aec78b
commit db5d53820b
3 changed files with 6 additions and 136 deletions
-6
View File
@@ -16,12 +16,6 @@ Jeder Aufruf der Ladestationsinstanz wird sofort als
Version wird dabei `minutes: 0` gesendet. Das Gateway puffert, begrenzt oder
wiederholt die Stromvorgabe nicht selbst.
Im Debug der Ladestations- und Gateway-Instanz werden der vollständige
Strombefehl, URL und Payload sowie HTTP-Status und Easee-Antwort ausgegeben.
Zusätzlich werden die Observations 48, 96, 111 bis 114 protokolliert. Damit ist
erkennbar, ob der Sollwert übernommen wurde und welches weitere Limit das Laden
verhindert.
Der benötigte WebSocket-Client wird nach dem Speichern der Easee-Zugangsdaten
automatisch erstellt und konfiguriert. Im WebSocket-Client muss keine URL
eingetragen werden.
+2 -53
View File
@@ -499,7 +499,7 @@ class EaseeGateway extends IPSModule
if (
$serialNumber !== "" &&
$valueExists &&
in_array($observationID, [48, 96, 109, 111, 112, 113, 114, 120], true)
($observationID === 109 || $observationID === 120)
) {
$this->PublishObservation($serialNumber, $observationID, $value);
}
@@ -513,17 +513,6 @@ class EaseeGateway extends IPSModule
private function PublishObservation(string $serialNumber, int $observationID, $value)
{
$names = [
48 => "DynamicChargerCurrent",
96 => "ReasonForNoCurrent",
109 => "ChargerOpMode",
111 => "DynamicCircuitCurrentP1",
112 => "DynamicCircuitCurrentP2",
113 => "DynamicCircuitCurrentP3",
114 => "OutputCurrent",
120 => "TotalPower",
];
$cache = $this->ReadAttributeArray("ObservationCache");
if (!isset($cache[$serialNumber]) || !is_array($cache[$serialNumber])) {
$cache[$serialNumber] = [];
@@ -532,17 +521,6 @@ class EaseeGateway extends IPSModule
$cache[$serialNumber]["updated"] = time();
$this->WriteAttributeString("ObservationCache", json_encode($cache));
$this->SendDebug(
"Easee Observation RX",
json_encode([
"serialNumber" => $serialNumber,
"id" => $observationID,
"name" => $names[$observationID] ?? "Unknown",
"value" => $value,
]),
0
);
$this->SendDataToChildren(json_encode([
"DataID" => self::CHILD_EVENT_DATA_ID,
"Buffer" => json_encode([
@@ -578,37 +556,11 @@ class EaseeGateway extends IPSModule
"/commands/set_dynamic_charger_current";
$body = '{"amps":' . $amps . ',"minutes":0}';
$this->SendDebug(
"Easee Command TX",
json_encode([
"method" => "POST",
"url" => self::API_BASE_URL . $path,
"contentType" => "application/*+json",
"body" => $body,
]),
0
);
$result = $this->AuthorizedApiRequest(
return $this->AuthorizedApiRequest(
"POST",
$path,
$body
);
$this->SendDebug(
"Easee Command RX",
json_encode([
"serialNumber" => $serialNumber,
"requestedAmps" => $amps,
"success" => (bool)($result["success"] ?? false),
"httpCode" => (int)($result["httpCode"] ?? 0),
"responseBody" => (string)($result["body"] ?? ""),
"error" => (string)($result["error"] ?? ""),
]),
0
);
return $result;
}
private function AuthorizedApiRequest(string $method, string $path, string $body): array
@@ -782,9 +734,6 @@ class EaseeGateway extends IPSModule
private function SetLastError(string $message)
{
$this->SetValue("LastError", $message);
if ($message !== "") {
$this->SendDebug("EaseeGateway", $message, 0);
}
}
private function IsSubscribedSerial(string $candidate): bool
+4 -77
View File
@@ -505,7 +505,7 @@ class Ladestation_v2 extends IPSModule
}
$updated = (int)($response["state"]["updated"] ?? time());
foreach ([48, 96, 109, 111, 112, 113, 114, 120] as $observationID) {
foreach ([109, 120] as $observationID) {
$key = (string)$observationID;
if (array_key_exists($key, $response["state"])) {
$this->StoreEaseeObservation(
@@ -519,17 +519,7 @@ class Ladestation_v2 extends IPSModule
private function StoreEaseeObservation(int $observationID, $value, int $timestamp)
{
$names = [
48 => "DynamicChargerCurrent",
96 => "ReasonForNoCurrent",
109 => "ChargerOpMode",
111 => "DynamicCircuitCurrentP1",
112 => "DynamicCircuitCurrentP2",
113 => "DynamicCircuitCurrentP3",
114 => "OutputCurrent",
120 => "TotalPower",
];
if (!isset($names[$observationID])) {
if ($observationID !== 109 && $observationID !== 120) {
return;
}
@@ -541,17 +531,6 @@ class Ladestation_v2 extends IPSModule
$state["updated"] = $timestamp;
$this->SetBuffer("EaseeGatewayState", json_encode($state));
$this->SendDebug(
"Easee Observation",
json_encode([
"id" => $observationID,
"name" => $names[$observationID],
"value" => $value,
"timestamp" => $timestamp,
]),
0
);
if ($observationID === 109) {
$this->SetValue("Fahrzeugstatus", (int)$value);
} elseif ($observationID === 120) {
@@ -591,31 +570,16 @@ class Ladestation_v2 extends IPSModule
private function SendEaseeCurrentToGateway(float $value)
{
$request = [
$response = $this->SendEaseeGatewayRequest([
"action" => "SetDynamicChargerCurrent",
"serialNumber" => strtoupper(trim($this->ReadPropertyString("Seriennummer"))),
"amps" => $value,
];
$this->SendDebug(
"Easee Station TX",
json_encode($request),
0
);
$response = $this->SendEaseeGatewayRequest($request);
$this->SendDebug(
"Easee Station RX",
json_encode($response),
0
);
]);
if (!is_array($response) || !($response["success"] ?? false)) {
$error = is_array($response)
? (string)($response["error"] ?? "Unbekannter Gateway-Fehler")
: "Easee Gateway nicht erreichbar";
IPS_LogMessage("Ladestation_v2", $error);
return $error;
}
@@ -1125,45 +1089,10 @@ class Ladestation_v2 extends IPSModule
$stationType = $this->ReadPropertyInteger("Ladestation");
if ($stationType === 5 || $stationType === 6) {
$lastValue = $this->GetBuffer("LastEaseeRequestedAmps");
$transition = "unchanged";
if ($lastValue === "") {
$transition = "initial";
} elseif ((float)$lastValue <= 0 && $value > 0) {
$transition = "zero_to_positive";
} elseif ((float)$lastValue > 0 && $value <= 0) {
$transition = "positive_to_zero";
} elseif (abs((float)$lastValue - $value) > 0.01) {
$transition = "changed";
}
$this->SetBuffer("LastEaseeRequestedAmps", (string)$value);
$this->SendDebug(
"Easee Current Decision",
json_encode([
"stationType" => $stationType,
"serialNumber" => strtoupper(trim($this->ReadPropertyString("Seriennummer"))),
"previousAmps" => $lastValue === "" ? null : (float)$lastValue,
"requestedAmps" => $value,
"transition" => $transition,
"powerWatts" => $this->GetValue("Aktuelle_Leistung"),
"isSinglePhase" => $this->GetValue("Is_1_ph"),
"chargerReady" => $this->GetValue("Ladebereit"),
"carDetected" => $this->GetValue("Car_detected"),
"chargerOpMode" => $this->GetValue("Fahrzeugstatus"),
]),
0
);
if (
$stationType === 5 &&
$this->ReadPropertyString("Username") != $this->GetValue("Letzer_User")
) {
$this->SendDebug(
"Easee Current Blocked",
"Benutzerkennung stimmt nicht mit Letzer_User überein",
0
);
return;
}
return $this->SendEaseeCurrentToGateway($value);
@@ -1185,8 +1114,6 @@ class Ladestation_v2 extends IPSModule
}
$ch = curl_init();
IPS_LogMessage("value", "nach konvertierung" . $value);
if ($value == 0) {
switch ($stationType) {
case 1: