This commit is contained in:
2025-08-05 15:24:00 +02:00
parent 7d1d9bddfa
commit dd55d405d5

View File

@@ -77,6 +77,9 @@ class Ladestation_v2 extends IPSModule
$this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0);
IPS_SetHidden($this->GetIDForIdent("Leistung_Delta"), true);
$this->RegisterVariableString("Token_Intern", "Internes Token Easee");
IPS_SetHidden($this->GetIDForIdent("Token_Intern"), true);
// Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2);
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
@@ -428,7 +431,7 @@ class Ladestation_v2 extends IPSModule
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer ".$this->GetBuffer("Easee_Token")."",
"Authorization: Bearer ".$this->GetValue("Token_Intern")."",
"content-type: application/*+json"
],
]);
@@ -709,7 +712,7 @@ class Ladestation_v2 extends IPSModule
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"amps\":". $value .",\"minutes\":0}",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer ".$this->GetBuffer("Easee_Token")."",
"Authorization: Bearer ".$this->GetValue("Token_Intern")."",
"content-type: application/*+json"
],
]);
@@ -755,7 +758,7 @@ class Ladestation_v2 extends IPSModule
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"amps\":". $value .",\"minutes\":0}",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer ".$this->GetBuffer("Easee_Token")."",
"Authorization: Bearer ".GetValue($this->ReadPropertyInteger("Token_Easee"))."",
"content-type: application/*+json"
],
]);
@@ -772,7 +775,7 @@ class Ladestation_v2 extends IPSModule
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"amps\":". $value .",\"minutes\":0}",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer ".GetValue($this->ReadPropertyInteger("Token_Easee"))."",
"Authorization: Bearer ".$this->GetValue("Token_Intern")."",
"content-type: application/*+json"
],
]);
@@ -838,8 +841,7 @@ class Ladestation_v2 extends IPSModule
// cURL-Handle schließen
curl_close($ch);
$data = json_decode($response['accessToken']);
$this->SetBuffer("Easee_Token", (string)$data);
$this->SetValue("Token_Intern", json_decode($response['accessToken']));
}