How to access the MQTT data

As I’m starting to plan out the MagicMirror2 module I’m trying to figure out where the actual settings are and how to access them.

The module plan overall is to create a module for touch mirrors [Like the one I am currently building].

Any help would be greatly appreciated!

Thank you
John

Well had in an iFrame but I want to be able to access the data directly…

You have all the free time we don’t! :wink:
This is exactly the next step for us once we commit all issues/features.
MQTT imho is the best move forward for integrating external sensors/units/devices with HestiaPi vice versa and this is exactly where we are heading.
The easiest first move we will suggest is the Sonoff family. These are very cheap commercial solutions (<10USD) based on ESP8266 that you can find in the usual places. They originally use their own App and server but we will re-program them with custom firmware that will connect straight away to your HestiaPi and allow you get data to and from HestiaPi. They are open hardware but not open source so by re-programming them we will make them fully open again :wink:
Till we do that here is a very good starting point for you. Basically you need to install Mosquito in the RasPi and then modify your “items” (/etc/openhab2/items/…) You will then need to change the sensor data and button presses to be sent via MQTT. it is not that hard and I’m 100% sure you will find code ready in OH2 forums.

I suggest you backup the OH2 files you are to modify but please move the backups in external dir like you home dir as OH2 scans all the files under its dir and if duplicate files/items found the double memory will be occupied and with the limitations of RasPi Zero, you don’t want that :sweat:
If you manage to produce 5-6 clear steps to move from your current image to an MQTT setup, please share on a separate thread.

Thank you!! No actually I have very little free time… it’s Summer and that’s when I’m the most busy but I figured hey I’ll start looking into this… :wink:

BUT the original module that I’m intending to write will be supporting a mini itx with SSD drive but of course RPI will be kept in mind as well!! :slight_smile: We want it to work on ANY MagicMirror :slight_smile:

I’ve been installing the Sonoff devices all over the house and wiring them up to OpenHAB via MQTT over the last month. The open firmware mentioned - https://github.com/arendst/Sonoff-Tasmota/wiki - is lovely, and pretty easy to install. Some of the soldering can be awkward (the basic Sonoff relays are fine, but the Sonoff Touch is a nightmare :P) but it supports over-the-air updates once you’ve got it up and running for the first time.

I’m waiting on a couple of things and then there’ll be a few new entries in my automation blog series on it - I already covered installing Mosquitto in the HestiaPi Classic posts, so I’ll build on that - and there’s going to be a post on using the Sonoff TH10 (with temperature sensor) as a remote thermostat for Hestia :slight_smile:

1 Like

I’m fairly experienced when it comes to embeded sw and flashing microcontrollers with custom firmware via non-USB methods but I have to confess the Sonoff Touch was indeed a nightmare. The worst and most shameful result is that I managed to actually flash Tasmota on Sonoff touch BUT I don’t know how. To be more precise, I know exactly how I did it (that is after maybe 50 attempts over 2-3 nights), but the same technique never worked again. The actual Sonoff Touch works great now with Tasmota for the record. If Im going to mass-flash them I need something more efficient :wink:
Did you actually desolder the shield of the ESP? Never read it was needed but most people demonstrated it this way. Maybe it was only to show the different ESP. Dunno…

I’m glad I’m not the only one going crazy…

In my case it’s my lack of appropriate gear. I don’t have any angled header pins, so I had to solder on straight ones, flash the Touch, and then desolder the pins afterwards so that I could replace the back plate.

Interesting, once my bad soldering was done, and I’d constructed a cable I could use to ground GPIO00 it worked first time. The Tasmota Sonoff Touch wiki page was essential, of course. It also helps that I’m using the PlatformIO setup from Tasmota, which has a sonoff-touch target, and a way to view the serial output from the device.

Took me about an hour to get it working, and about 3 days to figure out the wiring in my light socket so I could hook it up - like I said, I’m a software guy :stuck_out_tongue:

The only thing I had to desolder was my own soldering of header pins (I really hope over-the-air updates work now …). I left everything else alone.

2 Likes

Too scared to try reprogram the already programmed SonOff Touch. All I did was through Arduino IDE. Maybe next time I’ll try the PlatformIO (Atom editor with extensions). Oh and there will be a “next time” as I plan to offer these SonOff gadgets as part of the HestiaPi ecosystem preconfigured to talk to each other via MQTT.

Got it… never mind LOL