no message
This commit is contained in:
@@ -34,39 +34,19 @@ class VGT_Sub extends IPSModule
|
||||
$this->ConnectParent('{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}');
|
||||
}
|
||||
|
||||
|
||||
public function ApplyChanges()
|
||||
{
|
||||
parent::ApplyChanges();
|
||||
|
||||
// Child darf NICHT subscriben!
|
||||
$this->ConnectParent('{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}');
|
||||
|
||||
$device = $this->ReadPropertyString("DeviceID");
|
||||
|
||||
$topics = [
|
||||
"feedback-request/" . $device,
|
||||
"remote-control-request/" . $device
|
||||
];
|
||||
|
||||
foreach ($topics as $topic) {
|
||||
$this->SendDataToParent(json_encode([
|
||||
"DataID" => "{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}",
|
||||
"PacketType" => 8, // SUBSCRIBE
|
||||
"QualityOfService" => 0,
|
||||
"Retain" => false,
|
||||
"Topic" => $topic,
|
||||
"Payload" => "" // <-- WICHTIG !!!
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
SetValue($this->GetIDForIdent($Ident), $Value);
|
||||
}
|
||||
|
||||
|
||||
public function ReceiveData($JSONString)
|
||||
{
|
||||
$data = json_decode($JSONString);
|
||||
@@ -89,7 +69,6 @@ class VGT_Sub extends IPSModule
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function HandleFeedbackRequest()
|
||||
{
|
||||
$response = [
|
||||
@@ -101,11 +80,9 @@ class VGT_Sub extends IPSModule
|
||||
"max_soc" => GetValue($this->GetIDForIdent("MaxSOC"))
|
||||
];
|
||||
|
||||
$topic = "feedback-response/" . $this->ReadPropertyString("DeviceID");
|
||||
$this->SendToMQTT($topic, json_encode($response));
|
||||
$this->SendToMQTT("feedback-response/" . $this->ReadPropertyString("DeviceID"), json_encode($response));
|
||||
}
|
||||
|
||||
|
||||
private function HandleRemoteControlRequest(string $payload)
|
||||
{
|
||||
$data = json_decode($payload, true);
|
||||
@@ -121,16 +98,14 @@ class VGT_Sub extends IPSModule
|
||||
SetValue($this->GetIDForIdent("RC_Strategy"), $data["strategy"]);
|
||||
}
|
||||
|
||||
$topic = "remote-control-response/" . $this->ReadPropertyString("DeviceID");
|
||||
$this->SendToMQTT($topic, json_encode($data));
|
||||
$this->SendToMQTT("remote-control-response/" . $this->ReadPropertyString("DeviceID"), json_encode($data));
|
||||
}
|
||||
|
||||
|
||||
private function SendToMQTT(string $topic, string $payload)
|
||||
{
|
||||
$this->SendDataToParent(json_encode([
|
||||
"DataID" => "{043EA491-0325-4ADD-8FC2-A30C8EEB4D3F}",
|
||||
"PacketType" => 3, // PUBLISH
|
||||
"PacketType" => 3,
|
||||
"QualityOfService" => 0,
|
||||
"Retain" => false,
|
||||
"Topic" => $topic,
|
||||
@@ -138,16 +113,11 @@ class VGT_Sub extends IPSModule
|
||||
]));
|
||||
}
|
||||
|
||||
|
||||
public function GetConfigurationForm()
|
||||
{
|
||||
return json_encode([
|
||||
"elements" => [
|
||||
[
|
||||
"type" => "ValidationTextBox",
|
||||
"name" => "DeviceID",
|
||||
"caption" => "Device ID"
|
||||
]
|
||||
[ "type" => "ValidationTextBox", "name" => "DeviceID", "caption" => "Device ID" ]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user