no message

This commit is contained in:
2025-11-28 07:56:50 +01:00
parent bbb3037fe6
commit 9d66cbcaab

View File

@@ -11,7 +11,7 @@ class VGT_Sub extends IPSModule
// Konfiguration
$this->RegisterPropertyString('DeviceID', '');
// Eigene Status-Variablen (schreibbar)
// Eigene Status Variablen (schreibbar)
$this->RegisterVariableFloat('PowerProduction', 'Power Production', '', 10);
$this->EnableAction('PowerProduction');
@@ -30,7 +30,7 @@ class VGT_Sub extends IPSModule
$this->RegisterVariableFloat('MaxSoc', 'Max SoC', '', 15);
$this->EnableAction('MaxSoc');
// Eingehende remote-control commands (readonly)
// Remote-Control Werte (readonly)
$this->RegisterVariableInteger('PowerSetpoint', 'Power Setpoint', '', 30);
IPS_SetVariableCustomAction($this->GetIDForIdent('PowerSetpoint'), 0);
@@ -41,7 +41,7 @@ class VGT_Sub extends IPSModule
public function ApplyChanges()
{
parent::ApplyChanges();
$this->ConnectParent('{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}');
$this->ConnectParent('{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}');
$this->SubscribeTopics();
}
@@ -53,7 +53,6 @@ class VGT_Sub extends IPSModule
return;
}
// Topics zum Abonnieren
$topics = [
"feedback-request/$device",
"remote-control-request/$device"
@@ -62,11 +61,10 @@ class VGT_Sub extends IPSModule
foreach ($topics as $topic) {
$this->SendDebug("Subscribe", $topic, 0);
// Richtige MQTT Client Struktur
$this->SendDataToParent(json_encode([
"DataID" => "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
"PacketType" => 8, // SUBSCRIBE
"Topic" => $topic,
"QoS" => 0
'DataID' => '{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}',
'Topic' => $topic
]));
}
}
@@ -101,26 +99,24 @@ class VGT_Sub extends IPSModule
private function HandleFeedbackRequest($device)
{
$response = [
"power_production" => GetValueFloat($this->GetIDForIdent('PowerProduction')),
"state_of_charge" => GetValueFloat($this->GetIDForIdent('StateOfCharge')),
"is_running" => GetValueBoolean($this->GetIDForIdent('IsRunning')),
"is_ready" => GetValueBoolean($this->GetIDForIdent('IsReady')),
"min_soc" => GetValueFloat($this->GetIDForIdent('MinSoc')),
"max_soc" => GetValueFloat($this->GetIDForIdent('MaxSoc'))
"power_production" => GetValue($this->GetIDForIdent('PowerProduction')),
"state_of_charge" => GetValue($this->GetIDForIdent('StateOfCharge')),
"is_running" => GetValue($this->GetIDForIdent('IsRunning')),
"is_ready" => GetValue($this->GetIDForIdent('IsReady')),
"min_soc" => GetValue($this->GetIDForIdent('MinSoc')),
"max_soc" => GetValue($this->GetIDForIdent('MaxSoc'))
];
$json = json_encode($response);
$json = json_encode($response);
$topic = "feedback-response/$device";
$this->SendDebug("TX Feedback", "$topic => $json", 0);
// MQTT Client: Publish
$this->SendDataToParent(json_encode([
"DataID" => "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
"PacketType" => 3, // PUBLISH
"Topic" => $topic,
"Payload" => $json,
"QoS" => 0,
"Retain" => false
'DataID' => '{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}',
'Topic' => $topic,
'Payload' => $json
]));
}
@@ -143,16 +139,14 @@ class VGT_Sub extends IPSModule
$topic = "remote-control-response/$device";
$payloadOut = json_encode($json);
// MQTT Client: Publish
$this->SendDataToParent(json_encode([
"DataID" => "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
"PacketType" => 3, // PUBLISH
"Topic" => $topic,
"Payload" => $payloadOut,
"QoS" => 0,
"Retain" => false
'DataID' => '{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}',
'Topic' => $topic,
'Payload' => $payloadOut
]));
$this->SendDebug("TX Remote", "$topic => $payloadOut", 0);
$this->SendDebug("TX RemoteControl", "$topic => $payloadOut", 0);
}
public function RequestAction($Ident, $Value)