no message
This commit is contained in:
@@ -38,6 +38,10 @@ class MQTTBatterySDL extends IPSModule
|
|||||||
|
|
||||||
// MQTT Parent verbinden
|
// MQTT Parent verbinden
|
||||||
$this->ConnectParent('{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}');
|
$this->ConnectParent('{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}');
|
||||||
|
|
||||||
|
$this->RegisterTimer('PublishDelay', 0, 'MBSDL_DoDelayedPublish($_IPS["TARGET"]);');
|
||||||
|
$this->SetBuffer('PublishTopic', '');
|
||||||
|
$this->SetBuffer('PublishPayload', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ApplyChanges()
|
public function ApplyChanges()
|
||||||
@@ -381,7 +385,7 @@ class MQTTBatterySDL extends IPSModule
|
|||||||
|
|
||||||
$json = $this->BuildReadResponse();
|
$json = $this->BuildReadResponse();
|
||||||
|
|
||||||
$this->PublishViaHelper(
|
$this->QueuePublish(
|
||||||
'feedback-response/' . $suffix,
|
'feedback-response/' . $suffix,
|
||||||
$json
|
$json
|
||||||
);
|
);
|
||||||
@@ -399,7 +403,7 @@ class MQTTBatterySDL extends IPSModule
|
|||||||
|
|
||||||
if ($json !== null) {
|
if ($json !== null) {
|
||||||
|
|
||||||
$this->PublishViaHelper(
|
$this->QueuePublish(
|
||||||
'remote-control-response/' . $suffix,
|
'remote-control-response/' . $suffix,
|
||||||
$json
|
$json
|
||||||
);
|
);
|
||||||
@@ -440,6 +444,32 @@ class MQTTBatterySDL extends IPSModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function QueuePublish(string $topic, string $payload)
|
||||||
|
{
|
||||||
|
$this->SetBuffer('PublishTopic', $topic);
|
||||||
|
$this->SetBuffer('PublishPayload', $payload);
|
||||||
|
|
||||||
|
$this->SetTimerInterval('PublishDelay', 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function DoDelayedPublish()
|
||||||
|
{
|
||||||
|
$this->SetTimerInterval('PublishDelay', 0);
|
||||||
|
|
||||||
|
$topic = $this->GetBuffer('PublishTopic');
|
||||||
|
$payload = $this->GetBuffer('PublishPayload');
|
||||||
|
|
||||||
|
$this->SetBuffer('PublishTopic', '');
|
||||||
|
$this->SetBuffer('PublishPayload', '');
|
||||||
|
|
||||||
|
if ($topic == '' || $payload == '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->PublishViaHelper($topic, $payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function SafeSend(array $packet)
|
private function SafeSend(array $packet)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user