no message
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
"name": "TopicSuffix",
|
||||
"caption": "Topic Suffix / x"
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "FeedbackResponseID",
|
||||
"caption": "Feedback Response Variable"
|
||||
},
|
||||
{
|
||||
"type": "SelectVariable",
|
||||
"name": "ReqActionID",
|
||||
|
||||
@@ -18,6 +18,8 @@ class MQTTBatterySDL extends IPSModule
|
||||
$this->RegisterPropertyInteger('DischargePower', 2500);
|
||||
$this->RegisterPropertyInteger('MaxPowerSetpoint', 10000);
|
||||
|
||||
$this->RegisterPropertyInteger('FeedbackResponseID', 0);
|
||||
|
||||
// Variablen
|
||||
$this->RegisterVariableBoolean('IsReady', 'Is Ready', '', 10);
|
||||
$this->RegisterVariableBoolean('IsRunning', 'Is Running', '', 20);
|
||||
@@ -373,10 +375,7 @@ public function ReceiveData($JSONString)
|
||||
if ($topic === 'feedback-request/' . $suffix) {
|
||||
$json = $this->BuildReadResponse();
|
||||
|
||||
$this->QueuePublish(
|
||||
'feedback-response/' . $suffix,
|
||||
$json
|
||||
);
|
||||
$this->SendFeedbackResponse($json);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -414,6 +413,19 @@ private function PublishMQTT(string $topic, string $payload)
|
||||
]));
|
||||
}
|
||||
|
||||
|
||||
private function SendFeedbackResponse(string $payload)
|
||||
{
|
||||
$id = $this->ReadPropertyInteger('FeedbackResponseID');
|
||||
|
||||
if (!$this->IsValidVariable($id)) {
|
||||
$this->SendDebug('SendFeedbackResponse', 'Keine gültige FeedbackResponseID gewählt', 0);
|
||||
return;
|
||||
}
|
||||
|
||||
RequestAction($id, $payload);
|
||||
}
|
||||
|
||||
private function IsValidVariable(int $id)
|
||||
{
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user