Hubitat and MQTT

Hubitat and MQTT

graph TB subgraph Home Network hubitat[Hubitat Elevation] bridge[Hue Bridge] hue[Hue Devices] zwave[Z-Wave Devices] more[more devices
and services] subgraph Raspberry Pi mosquitto[Mosquitto] nodered[Node-RED] zstick[Aeotec Z-Stick] end hubitat == "MQTT" === mosquitto nodered == "Hue API" === bridge bridge -. Zigbee ..- hue zstick -. Z-Wave ..- zwave hubitat -.- more nodered == OpenZWave === zstick nodered == MQTT === mosquitto end classDef feature fill:#ffaaff,stroke:#000000,stroke-width:1px class hubitat,mosquitto feature

While I use Node-RED as my primary home automation engine, there are certain devices and services which it does not support. I use a Hubitat Elevation hub for integrating such devices and services into my Node-RED flows. The reason is simple: while Hubitat does provide native support for a number of devices and services not supported directly by Node-RED it is quite deficient in most other ways. Its built-in Rule Machine app is missing a number of critical features and has an crude user interface that makes it extremely painful to use. Ditto for its built-in dashboarding features.

Among the deficiencies that prevent me from relying on Hubitat as my primary home automation hub is its failure to support MQTT as a feature in its Rule Machine app. The only support for the MQTT protocol is hidden deep in the bowels of its custom driver API. While it is possible to use Hubitat’s Maker API app to integrate with Node-RED via a web service, like most of Hubitat’s features the Maker API app is inefficiently implemented and burdensome to use. I far prefer the lighter weight, better optimized MQTT protocol for home automation applications.

As a learning experience and to provide reliable MQTT support within my personal home automation environment I created my own simple hubitat-mqtt-connection driver. This is not a competitor to the excellent MQTT Client app under development by Kevin H. Most people will be far happier using his app than attempting to use device drivers. I make mine available publicly simply for tutorial purposes and possibly as an inspiration for your own efforts.

Together, the preceding two drivers support:

  1. Listening for MQTT messages on particular topics as Rule Machine triggers
  2. Accessing the payloads of MQTT messages in Rule Machine triggers and actions
  3. Publishing MQTT messages on any topic with any payload and values for qos and retain in Rule Machine actions