From dd55d405d56723a60a55a7f36af802a54162d4d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fliger?= Date: Tue, 5 Aug 2025 15:24:00 +0200 Subject: [PATCH] asdf --- Ladestation_v2/module.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Ladestation_v2/module.php b/Ladestation_v2/module.php index 1622720..32a894b 100644 --- a/Ladestation_v2/module.php +++ b/Ladestation_v2/module.php @@ -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'])); }