Feature Request

@dman2306 is correct about apps not having access to the built-in MQTT client. It is only accessible on the driver side. Implementing it in RM would definitely require the Hubitat dev team to add this functionality.

That said, if you'll accept an interim solution then MQTT Link will do what you're looking for. @kevin 's app / device combo may work as well but I don't know the intricacies of his work to say for sure. I'll provide some instructions for setting this up with my app and then Kevin can provide some for his if he likes.

I know that you don't want to install an app or driver but this method will require both.

  1. Install both the MQTT Link app and driver according to the readme in the repo
  2. Add a new, virtual device with the following:
    2a. Device name. This will become a portion of the outbound MQTT topic so choose appropriately
    2b. You mentioned wanted to send an 'on' and presumably an 'off' so choose Virtual Switch and then save the device
  3. Open the MQTT Link app and pick the newly added virtual switch device on the first screen. Will assume that you've already set up the driver in step 1 so press Next after you've selected the device.
  4. On the next page find the newly selected virtual switch and choose the Switch capability from the dropdown then click Done.

At this point, MQTT Link will monitor the virtual switch for any change in Switch state and will publish a message with that new state to the generated topic.

Now, you can go into RM and and configure as desired but also add the following

  1. Add action via Set Actions to Run
  2. Select Set Mode or Variables, Run Custom Action from the dropdown
  3. Select Set Custom Action in the second dropdown
  4. Select Switch from the Capabilities dropdown
  5. Choose the new virtual switch that was added in the prior setup list
  6. Specify the custom command to perform. e.g. 'on' or 'off'
  7. Complete the rest of your rule setup and test.

Now, when the rule is fired and conditions are met according to your configuration, the action will change the state of the virtual switch and the MQTT Link app will be listening. Once it gets notification of the change, it'll forward that state change to the MQTT Link Driver which will publish the message.

I realize that this is a bit convoluted and much more complicated than simply picking 'Send MQTT Message' from a dropdown but it might be the easiest stop-gap solution for you.

Open to any feedback that you may have. Thanks!

1 Like