I am coming here from HomeAssistant as what I wanted to try and do Is control my Philips hue and a wemo smartplug via a diy control panel running on an esp8266, I had looked into mqtt on homeassistant but it turned out that that wasn’t going to work with the Philips hues, eventually I plan on using a tft touchscreen lcd to control my devices (still running from the esp8266) but at the moment I am just trying to use a normal button to send a signal to openhab (which I would be running of a pi) and wanted to see if anyone had any ideas of code or anything before I make the leap to reformat the pi running homeassistant at the moment.
I have a few videos on my channel that show you how to connect NodeMCU based devices to openHab via MQTT. Check out either of these topics, specifically part 3 of the video series (which show MQTT):
The sensor one will probably be better suited for what you’re trying to do (i.e. send MQTT data from ESP8266 to OH).
I set up something similar to what you’re trying to do. I have a PIR sensor hooked up to my Kube, and every time motion is detected, the Kube sends a “1” to the “motion” MQTT topic. In openHab, I have a rule set up that fires on that motion event, and if it is night time, it sends a color/brightness command to a Hue lightbulb. This lights up my ensuite hallway light a dim red if motion is detected at night.