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.
Example of what it looks like on the MQTT side: