no message

This commit is contained in:
2026-05-26 14:03:51 +02:00
parent f3208942a5
commit b5ddce0817
+13 -2
View File
@@ -13,6 +13,7 @@ class MQTTBatterySDL extends IPSModule
$this->RegisterPropertyInteger('ReqActionID', 0);
$this->RegisterPropertyInteger('SoCID', 0);
$this->RegisterPropertyInteger('PowerProductionID', 0);
$this->RegisterPropertyInteger('PublishInstanceID', 0);
$this->RegisterPropertyInteger('TargetSoC', 50);
$this->RegisterPropertyInteger('ChargePower', 2500);
@@ -380,7 +381,7 @@ class MQTTBatterySDL extends IPSModule
$json = $this->BuildReadResponse();
$this->PublishMQTT(
$this->PublishViaHelper(
'feedback-response/' . $suffix,
$json
);
@@ -398,7 +399,7 @@ class MQTTBatterySDL extends IPSModule
if ($json !== null) {
$this->PublishMQTT(
$this->PublishViaHelper(
'remote-control-response/' . $suffix,
$json
);
@@ -426,7 +427,17 @@ class MQTTBatterySDL extends IPSModule
}
private function PublishViaHelper(string $topic, string $payload)
{
$id = $this->ReadPropertyInteger('PublishInstanceID');
if ($id <= 0 || !IPS_InstanceExists($id)) {
$this->SendDebug('PublishViaHelper', 'Kein gültiges Publish-Modul gewählt', 0);
return;
}
MBPUB_Publish($id, $topic, $payload);
}