This is a conversion of the terrific MQTT Bridge project that removes the requirement for the nodejs application and replaces it with a native Hubitat MQTT client.
I would call myself a Hubitat enthusiast as it is not my primary hub. I purchased the hub a few years back after hearing Patrick promote it on a podcast. He touted the non-cloud focus of the platform and that appealed to me. But, after purchasing my hub, I soon discovered that Zigbee and Z-Wave devices aren't cheap and ended up purchasing only a few devices to connect to my hub.
My primary hub of choice is Home Assistant so I began my quest to find a way to integrate Hubitat with Home Assistant to gain access to those devices that I'd purchased. MQTT seemed like the logical choice and after browsing this forum I learned about MQTT Bridge for Hubitat that someone from the community had ported from an implementation made for SmartThings.
I was reluctant at first because it required a middle-man nodejs server to convert MQTT messages to REST calls. After searching for a better option and coming up empty, I relented and installed the nodejs server on a Raspberry Pi Zero. I was happy because it worked...for awhile.
I started having trouble with the nodejs server and often found that my devices stopped reporting / responding due to this. I suspect that running that server on a Pi Zero may not have been the best idea however, I had had enough and retired MQTT Bridge even though it meant losing integration with Home Assistant.
Sometime later, while browsing the forums, I heard about the Hubitat team adding an MQTT client to the platform. At first I was under the impression that it was a Built-in app that I could quickly install and be on my way. I soon discovered that the team had added the client library but had not provided an app to support it.
I waited, and waited for someone to implement a decent MQTT app using the built in client but none materialized to my liking. That got me thinking about the old MQTT Bridge app and the possibility of replacing that nodejs server with the native MQTT client. I started looking through the code even though knew nothing about building SmartThings / Hubitat apps and very little about coding in Groovy.
After a few months of reading through documentation, reviewing features of other Hubitat apps and a lot of trial and error, I've finally put together a solution that I am happy with.
MQTT Link is a bare bones app and driver set that simply sends and receives msgs to / from an MQTT broker. It knows nothing about the downstream subscribers of message that are sent out but it does utilize the message formatting established in the original application. This means that downstream clients can control devices simply by publishing a properly formatted message to the appropriate topic.
I've decided to make my implementation public just in case any others out there waiting, like me, for someone to built it.
I am open to maintaining this if bugs are reported and will even consider new features however, I will strive to maintain the simplistic design to ensure that it continues to be just a boring MQTT client reporting and receiving device events.
For more details, see the readme in the repo. I am looking forward to receiving feedback from the community. Enjoy!