I had this code sitting around for a while... It is somewhat preliminary, and likely not of any use to anyone for any reason versus the other 3 or 4 MQTT apps/clients already out there.
So why did I make this, then? My thought was that I wanted a SUPER SIMPLE MQTT app/client that would support any command/attribute (even custom ones) without any custom work needed by the end user (me!).
This app only allows you to select Hubitat devices to publish to MQTT. You can not select specific commands/attributes - it is all or none on a device basis (on purpose).
With few features, the code is very light (~200 lines w/comments currently).
I only tested it against devices on my dev hub - so I fully expect many device types I haven't tested may throw errors/break it.
All of that said, if you want to try it a link to the code is below. I'm open to error/bug reports, but as a side project issues may not get fixed immediately.
Install driver code
Create virtual device, use driver for type
Enter MQTT broker info, save preferences
Install app code
Install user app
Select devices to publish to MQTT
Select driver created above for the "MQTT Driver"
Initialization is throttled to 4 commands/attributes/sec (no throttling once init is complete). So if you add a ton of devices, each with a lot of commands/attributes it will take a while to initialize!!!!
All attributes should show up in MQTT topic structure: hubitat/hubname/device/attribute/value
Devices are controlled by publishing values to MQTT topic structure hubitat/hubname]/device/command/set
Note 1: for commands that do not need parameters, you can publish anything as the value for the /set topic.
Note 2: For commands that take multiple parameters, separate with comma
No guarantees of the quality of the code. It is ALPHA, and I'm not a professional programmer. Use at your own risk.
That said, it hasn't destroyed my dev hub, so there is that.
I've tested the app/driver with a few hundred virtual devices loaded in, and about 30 command changes/s (on virtual devices! don't expect that speed on a z radio!) with no issues on my dev hub. As stated before, it is beta and YMMV.
On init only /set topics are published. If you want to re-publish all attribute values (like on a node-red reboot or similar) you can hit the sendAll command on the driver, or set the MQTT topic /hubitat/hubname/sendAll to a non-blank value. Remember, it can take up to a few minutes to re-send all values if you have a lot of devices!
Raised init speed to 10 commands or attributes per second. Note that it can still take a long time to initialize if you are publishing a lot of devices, or have many devices with a ton of commands or attributes. Check the log - it logs begin and end of init and sendAll.