MQTT and JSON

I've started to make use of MQTT to monitor devices (though not yet for control). I hesitated because of the potential of having a single point of failure, but as a monitor, that is no problem and far more flexible than the current use of HTTP for notification. It would be helpful if Hubitat could act as an MQTT client for notifications and, optionally, as an MQTT broker.

Separately but closely related is the use of JSON for settings. The maker API parameters on the command line would also be encoded as JSON to allow a message to be sent via other channels (such as MQTT), thus leveraging the existing drivers.

You can write groovy code to listen on MQTT topics and parse the payload. There is no single standard for MQTT home automation topics and payload structures. All of them have one weakness or another. JSON has the same problem(s).

I don't want automation -- just APIs. And I don't need a single format. I want Hubitat to simply take the messages that the MakerAPI sends and send them via MQTT as an option. Similarly for receiving messages.

JSON is a particular payload that Hubitat can choose to use like others have.

Just checking back on this. I'm trying to listen to MakeAPI notifications on a second system but there doesn't seem to be a way to set two targets for notification. Rather than implement a new mechanism it would be simpler to implement sending the same messages via MQTT rather than http.

You can have two MakerAPI instances. Each can have their own target.

1 Like

Ugh, but well, OK. I can live with it.

Many people are able to use MQTT and / or MakerAPI to connect all kinds of things from simple sensors to complete HA systems. If I understand your complaint it seems to be that Hubitat isn't doing it your way - which appears to be MQTT interface to everything in MakerAPI . There is a pretty comprehensive app from @kevin. You can even rewrite to what you want.

1 Like

My app doesn’t in either direction support the Maker API but it seems for your needs writing a small app that exposes the Maker API info as an MQTT payload might be useful. The reverse would require a bit more thought but not hugely complex I think.

I did write such an app -- it runs on a PC, but I want a backup PC.

Writing such an app on the Hubitat has a huge amount of static friction in coming up to speed. I'm just trying to limit the amount of scaffolding I need to build since, in this case, MQTT is a standard for such messaging.

Have you considered using something like Node-RED? I run a combination of Mosquitto broker, Node-RED and the awesome Node-RED HE Nodes..

1 Like

Something good to write about in my upcoming column. I'm using Hubitat and HomeAssistant as bridges but prefer to go directly to devices. I could use node-red and other smarts as apps built on the simpler mechanisms but don't want too much smart in the path. That's a long conversation so fodder for lots of columns but the short form is I want control but am wary of automation [see Stepford Wives for details]

1 Like

I hear you! :robot: !!

I am actually testing HomeAssistant with the Node-RED addon on my home system. Using a "companion server" is a great way to offload the more complicated stuff - really helps keep the resource utilization low for all my hubs.

Of course Matter is going to make MQTT obsolete right? :grin:

2 Likes

I hesitate to even engage in this conversation, but that's more or less what my YAMA hubitat app does, but it does not use makerapi.

It just passes every event for included devices out to mqtt, and makes an endpoint to control all commands for included devices via mqtt.

But it may or may not be a fit for your use case.

3 Likes

Sounds exactly like what I need. How do I install and use it?

Matter -- like CEBus -- is going to solve all problems for all people. OK, I'll be explicit with an /S for sarcasm

1 Like
1 Like

I will say I haven't looked at the app in quite some time. I don't know of any reason why it wouldn't still work, though.

If you get a chance to use it, and something doesn't work right, just let me know in that thread.

2 Likes

I did, thanks.

I’m not quite grabbing the relationship here - unless it was just a fun /s comment ?

Was a fun comment - kind of a dig at Matter attempting to be a solution to everything smart home related at least according to all the media hype... :wink:

Download the Hubitat app