diff --git a/Symcon_Publish_to_Shelly_MQTT/module.php b/Symcon_Publish_to_Shelly_MQTT/module.php index d677264..8b2f7ba 100644 --- a/Symcon_Publish_to_Shelly_MQTT/module.php +++ b/Symcon_Publish_to_Shelly_MQTT/module.php @@ -46,7 +46,7 @@ class Symcon_Publish_to_Shelly_MQTT extends IPSModule { IPS_LogMessage("ShellySwitchSender", "GetAction gestartet"); - $mqttInstanceID = $this->ReadPropertyInteger("mqtt_instance_id"); // Instanz-ID deiner MQTT-Instanz + $mqttInstanceID = $this->ReadPropertyInteger("mqtt_instance_id"); $topic = $this->ReadPropertyString("Topic"); $msg_id = $this->ReadPropertyInteger("msg_id"); @@ -80,8 +80,13 @@ class Symcon_Publish_to_Shelly_MQTT extends IPSModule return; } - // Nachricht senden - $result = MQTT_Publish($mqttInstanceID, $topic, $jsonPayload, 0); + // MQTT-Nachricht senden via RequestAction + $result = IPS_RequestAction($mqttInstanceID, "Publish", [ + "Topic" => $topic, + "Payload" => $jsonPayload, + "QoS" => 0, + "Retain" => false + ]); if ($result) { IPS_LogMessage("ShellySwitchSender", "Nachricht erfolgreich gesendet"); @@ -90,4 +95,5 @@ class Symcon_Publish_to_Shelly_MQTT extends IPSModule } } + }