MQTT (Smarthome)


With proper a MQTT integration SB will be able to control nearly all smarthome devices and even allow bot to bot communication.


  • Topic subscriptions now create custom triggers (see the example on how to set them up)
  • Reconnecting the connection to the Broker is now more robust


  1. Extract the zip and put the MQTTnet.dll into the SB folder (113.6 KB)

  2. Import the Action(s) included with the mqtt.txt file (you might need to remove an extra line at the end of the import code)

  3. Edit the Action “MQTT-Broker”
    3.1) provide the URL to your own MQTT broker in the “Set argument %broker%” sub-action
    3.2) Edit the “Execute Code (MQTT)” sub-action - find refs (if needed manually add the reference to “MQTTnet.dll”) and compile

  4. After the Delay sub-action in the Action “MQTT-Broker” you can add all topics you want to Subscribe to just like shown in the included example

  5. After first importing the code you might need to trigger the Action “MQTT-Broker” manually once…it is run on startup automatically

The zip also includes a “mqtt-test” Action which publishes the payload “OFF” to the same topic as my example subscription in “MQTT-Broker”…
This is an easy test to see if it works as i can externally turn on the device that is behind that topic, it triggers the event since is subscribed to the topic and turns it off again. Obviously you can either use this Action to test it out yourself or just delete it and replace it with your own Actions…it mostly serves as an example on how to publish a payload to a topic

I should also mention this is based on a MQTT library found here: GitHub - dotnet/MQTTnet: MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from