no message

This commit is contained in:
2025-11-28 08:07:49 +01:00
parent 9d66cbcaab
commit 5ba0650c00

View File

@@ -8,10 +8,9 @@ class VGT_Sub extends IPSModule
{
parent::Create();
// Konfiguration
$this->RegisterPropertyString('DeviceID', '');
// Eigene Status Variablen (schreibbar)
// Status Variablen
$this->RegisterVariableFloat('PowerProduction', 'Power Production', '', 10);
$this->EnableAction('PowerProduction');
@@ -30,7 +29,7 @@ class VGT_Sub extends IPSModule
$this->RegisterVariableFloat('MaxSoc', 'Max SoC', '', 15);
$this->EnableAction('MaxSoc');
// Remote-Control Werte (readonly)
// Remote-control readonly Variablen
$this->RegisterVariableInteger('PowerSetpoint', 'Power Setpoint', '', 30);
IPS_SetVariableCustomAction($this->GetIDForIdent('PowerSetpoint'), 0);
@@ -41,7 +40,9 @@ class VGT_Sub extends IPSModule
public function ApplyChanges()
{
parent::ApplyChanges();
$this->ConnectParent('{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}');
// Richtiger Parent
$this->ConnectParent('{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}');
$this->SubscribeTopics();
}
@@ -61,10 +62,11 @@ class VGT_Sub extends IPSModule
foreach ($topics as $topic) {
$this->SendDebug("Subscribe", $topic, 0);
// Richtige MQTT Client Struktur
$this->SendDataToParent(json_encode([
'DataID' => '{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}',
'Topic' => $topic
"DataID" => "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
"PacketType" => 8, // Subscribe
"Topic" => $topic,
"QoS" => 0
]));
}
}
@@ -110,13 +112,16 @@ class VGT_Sub extends IPSModule
$json = json_encode($response);
$topic = "feedback-response/$device";
$this->SendDebug("TX Feedback", "$topic => $json", 0);
$this->SendDebug("TX Feedback", $json, 0);
// MQTT Client: Publish
// RAW MQTT Publish
$this->SendDataToParent(json_encode([
'DataID' => '{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}',
'Topic' => $topic,
'Payload' => $json
"DataID" => "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
"PacketType" => 3, // Publish
"Topic" => $topic,
"Payload" => $json,
"QoS" => 0,
"Retain" => false
]));
}
@@ -139,14 +144,17 @@ class VGT_Sub extends IPSModule
$topic = "remote-control-response/$device";
$payloadOut = json_encode($json);
// MQTT Client: Publish
$this->SendDataToParent(json_encode([
'DataID' => '{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}',
'Topic' => $topic,
'Payload' => $payloadOut
]));
$this->SendDebug("TX RemoteControl", $payloadOut, 0);
$this->SendDebug("TX RemoteControl", "$topic => $payloadOut", 0);
// RAW MQTT Publish
$this->SendDataToParent(json_encode([
"DataID" => "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
"PacketType" => 3,
"Topic" => $topic,
"Payload" => $payloadOut,
"QoS" => 0,
"Retain" => false
]));
}
public function RequestAction($Ident, $Value)