Controlling everything with mqtt?

After two weeks of fighting with the mobile apps and myopenhab I’m looking for a better way to control things remotely with out exposing my network; I’m leaning towards mqtt.

Basically, I have OH pub/sub to my broker (outside the network) and then I can control everything just by again publishing to that same broker. My only concern is speed and how fresh the data is. If I have an iOS widget to turn devices on/off I need to first know their status so I have to publish to request the status, wait for a response, update the ui and this has to happen ideally within a few hundred ms.

Has anyone done this, how well does it work?

I can’t speak to updating the UI part but I send out a request over MQTT for current status and have sensors report. The end to end usually takes under a second but we are talking hundreds of milliseconds, not tens. And this is on a LAN. I would expect remote and cell networks will add on to that time.

Another potential solution, of you have a place to host something outside your network (which I assume since you are talking about having an MQTT broker out there), is running your own instance of myopenhab. I don’t know what problems you have had but maybe if you have more control over everything you will have more success.

Another option could be hosting a reverse proxy outside your network and configuring your firewall to only allow it through. It’s not as good as having your network completely closed but it does mitigate much of the risk.

You could potentially use IFTTT, though I don’t know if that will provide the feedback you are after.

I don’t know if services like Node-Red have web based or phone based UIs but if so that could be a solution.

I know that hundreds if not thousands are successfully using the myopenhab.org service and apps. Are you taking to connect at all or finding things you need to do that doesn’t appear to work (e.g. proxying webviews outside the LAN)?

Thanks for the input, interestingly enough I just setup my own instance of myopenhab this morning. It was pretty easy which kind of solves my problem with myopenhab always being down or slow. I still think it’s hard for some people though so maybe a simple turnkey solution to get remote working would be nice. I also like to control my own domain so to speak so using a free service scares me. :slight_smile:

I like the mqtt approach because it’s technology agnostic, basically I could change out the backend or frontend at any time with updating everything. If I build a special mobile client around the OH api if I ever move to another system I would have to rewrite it but if it’s just using mqtt then the client would stay the same. I think I’m still bitter about spending so much time setting up smartthings just to get sick of it and now I can’t take anything with me.

I having a working demo so I know my theory is sound and it’s pretty fast, faster even then myopenhab which still has multiple hops. I did have to write a script to get updates though which ideally would be built into the mqtt binding itself. Basically I publish /openhab/update with a message of the items and the OH then publishes the states of those items back which my app captures.

Mostly. You still have the structure of your topics and durbar of the messages to contend with.

Granted that is far easier than adapting to a whole API. But it is still work.