no message

This commit is contained in:
dh
2026-08-25 16:59:15 +02:00
parent 6edd688c1f
commit 6b8db1acec
2 changed files with 28 additions and 89 deletions
+11 -40
View File
@@ -69,17 +69,6 @@ class Ladestation extends IPSModule
IPS_SetHidden($this->GetIDForIdent("Is_Peak_Shaving") , true); IPS_SetHidden($this->GetIDForIdent("Is_Peak_Shaving") , true);
$this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0); $this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0);
IPS_SetHidden($this->GetIDForIdent("Leistung_Delta") , true); IPS_SetHidden($this->GetIDForIdent("Leistung_Delta") , true);
$this->RegisterVariableBoolean(
"Easee_Gateway_Connected",
"Easee Gateway verbunden",
"~Switch",
false
);
IPS_SetHidden(
$this->GetIDForIdent("Easee_Gateway_Connected"),
true
);
$this->SetBuffer("EaseeGatewayState", "{}");
$this->RegisterVariableString("Token_Intern", "Internes Token Easee"); $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
IPS_SetHidden($this->GetIDForIdent("Token_Intern") , true); IPS_SetHidden($this->GetIDForIdent("Token_Intern") , true);
// Hilfsvariabeln für Idle zustand // Hilfsvariabeln für Idle zustand
@@ -97,34 +86,26 @@ $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
public function ApplyChanges() public function ApplyChanges()
{ {
parent::ApplyChanges(); parent::ApplyChanges();
$this->RegisterVariableBoolean(
"Easee_Gateway_Connected",
"Easee Gateway verbunden",
"~Switch",
false
);
$this->SetTimerInterval( $this->SetTimerInterval(
"Timer_Do_UserCalc_EVC", "Timer_Do_UserCalc_EVC",
$this->ReadPropertyInteger("Interval") * 1000 $this->ReadPropertyInteger("Interval") * 1000
); );
$this->SetTimerInterval("Timer_Refresh_Token", 0);
$stationType = $this->ReadPropertyInteger("Ladestation"); $stationType = $this->ReadPropertyInteger("Ladestation");
$usesEaseeGateway = $this->UsesEaseeGateway($stationType); if (!$this->UsesEaseeGateway($stationType)) {
IPS_SetHidden( return;
$this->GetIDForIdent("Easee_Gateway_Connected"), }
!$usesEaseeGateway
);
if ( $this->SetTimerInterval("Timer_Refresh_Token", 0);
$usesEaseeGateway && if ($this->GetConfiguredEaseeGatewayID() <= 0) {
$this->GetConfiguredEaseeGatewayID() > 0 return;
) { }
try {
$this->SubscribeToEaseeGateway(); $this->SubscribeToEaseeGateway();
$this->GetEaseeStateFromGateway(); $this->GetEaseeStateFromGateway();
} else { } catch (Throwable $exception) {
$this->SetValue("Easee_Gateway_Connected", false); return;
} }
} }
@@ -957,7 +938,6 @@ $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
$gatewayID <= 0 || $gatewayID <= 0 ||
!function_exists("EASEEGW_ProcessStationRequest") !function_exists("EASEEGW_ProcessStationRequest")
) { ) {
$this->SetValue("Easee_Gateway_Connected", false);
return null; return null;
} }
@@ -985,17 +965,9 @@ $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
private function ApplyEaseeGatewayResponse($response) private function ApplyEaseeGatewayResponse($response)
{ {
if (!is_array($response)) { if (!is_array($response)) {
$this->SetValue("Easee_Gateway_Connected", false);
return; return;
} }
if (array_key_exists("connected", $response)) {
$this->SetValue(
"Easee_Gateway_Connected",
(bool)$response["connected"]
);
}
if (!isset($response["state"]) || !is_array($response["state"])) { if (!isset($response["state"]) || !is_array($response["state"])) {
return; return;
} }
@@ -1137,4 +1109,3 @@ $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
} }
} }
?> ?>
+17 -49
View File
@@ -92,17 +92,6 @@ class Ladestation_v2 extends IPSModule
$this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0); $this->RegisterVariableInteger("Leistung_Delta", "Leistung_Delta", "", 0);
IPS_SetHidden($this->GetIDForIdent("Leistung_Delta"), true); IPS_SetHidden($this->GetIDForIdent("Leistung_Delta"), true);
$this->RegisterVariableBoolean(
"Easee_Gateway_Connected",
"Easee Gateway verbunden",
"~Switch",
false
);
IPS_SetHidden(
$this->GetIDForIdent("Easee_Gateway_Connected"),
true
);
$this->SetBuffer("EaseeGatewayState", "{}");
$this->RegisterVariableString("Token_Intern", "Internes Token Easee"); $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
IPS_SetHidden($this->GetIDForIdent("Token_Intern"), true); IPS_SetHidden($this->GetIDForIdent("Token_Intern"), true);
@@ -121,45 +110,38 @@ $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
$this->RegisterVariableInteger("Mindestaldestrom", "Mindestaldestrom", "", 0); $this->RegisterVariableInteger("Mindestaldestrom", "Mindestaldestrom", "", 0);
$this->EnableAction("Mindestaldestrom"); $this->EnableAction("Mindestaldestrom");
$this->ConnectParent(self::EASEE_GATEWAY_MODULE_ID);
} }
public function ApplyChanges() public function ApplyChanges()
{ {
parent::ApplyChanges(); parent::ApplyChanges();
$this->RegisterVariableBoolean(
"Easee_Gateway_Connected",
"Easee Gateway verbunden",
"~Switch",
false
);
$this->SetTimerInterval( $this->SetTimerInterval(
"Timer_Do_UserCalc_EVC", "Timer_Do_UserCalc_EVC",
$this->ReadPropertyInteger("Interval") * 1000 $this->ReadPropertyInteger("Interval") * 1000
); );
$this->SetTimerInterval("Timer_Refresh_Token", 0);
$stationType = $this->ReadPropertyInteger("Ladestation"); $stationType = $this->ReadPropertyInteger("Ladestation");
$usesEaseeGateway = $this->UsesEaseeGateway($stationType); if (!$this->UsesEaseeGateway($stationType)) {
IPS_SetHidden( return;
$this->GetIDForIdent("Easee_Gateway_Connected"),
!$usesEaseeGateway
);
$instance = IPS_GetInstance($this->InstanceID);
$parentID = (int)$instance["ConnectionID"];
if ($parentID <= 0) {
$this->ConnectParent(self::EASEE_GATEWAY_MODULE_ID);
$instance = IPS_GetInstance($this->InstanceID);
$parentID = (int)$instance["ConnectionID"];
} }
if ($usesEaseeGateway && $this->IsEaseeGatewayInstance($parentID)) { $this->SetTimerInterval("Timer_Refresh_Token", 0);
try {
$instance = IPS_GetInstance($this->InstanceID);
$parentID = (int)$instance["ConnectionID"];
if ($parentID <= 0) {
$this->ConnectParent(self::EASEE_GATEWAY_MODULE_ID);
$instance = IPS_GetInstance($this->InstanceID);
$parentID = (int)$instance["ConnectionID"];
}
if (!$this->IsEaseeGatewayInstance($parentID)) {
return;
}
$this->SubscribeToEaseeGateway(); $this->SubscribeToEaseeGateway();
$this->GetEaseeStateFromGateway(); $this->GetEaseeStateFromGateway();
} else { } catch (Throwable $exception) {
$this->SetValue("Easee_Gateway_Connected", false); return;
} }
} }
@@ -308,10 +290,6 @@ $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
} }
if ($message["type"] === "GatewayStatus") { if ($message["type"] === "GatewayStatus") {
$this->SetValue(
"Easee_Gateway_Connected",
(bool)($message["connected"] ?? false)
);
return; return;
} }
@@ -1057,7 +1035,6 @@ $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
$instance = IPS_GetInstance($this->InstanceID); $instance = IPS_GetInstance($this->InstanceID);
$parentID = (int)$instance["ConnectionID"]; $parentID = (int)$instance["ConnectionID"];
if (!$this->IsEaseeGatewayInstance($parentID)) { if (!$this->IsEaseeGatewayInstance($parentID)) {
$this->SetValue("Easee_Gateway_Connected", false);
return null; return null;
} }
@@ -1077,17 +1054,9 @@ $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
private function ApplyEaseeGatewayResponse($response) private function ApplyEaseeGatewayResponse($response)
{ {
if (!is_array($response)) { if (!is_array($response)) {
$this->SetValue("Easee_Gateway_Connected", false);
return; return;
} }
if (array_key_exists("connected", $response)) {
$this->SetValue(
"Easee_Gateway_Connected",
(bool)$response["connected"]
);
}
if (!isset($response["state"]) || !is_array($response["state"])) { if (!isset($response["state"]) || !is_array($response["state"])) {
return; return;
} }
@@ -1227,4 +1196,3 @@ $this->RegisterVariableString("Token_Intern", "Internes Token Easee");
} }
?> ?>