[SOLVED] Newbie ESP8266 MQTT connection help/guidance

  • Platform information:
    • Hardware: i7
    • OS: Win7
    • Java Runtime Environment:
    • openHAB version: 2.5.0-snapshot build #1772

I have spent some time looking at youtube videos and searching the forums however I cannot find the combination of things I am looking for. Essentially I just want to read temp from an ESP8266 into OH. Once I have the ESP and OH playing nice with one another I can work from there. The things I need help on are…

Other Info:

I have installed mosquitto MQTT and can send from the pub command prompt to the sub command prompt.

OH runs fine (nothing really done to it), have it running on my desktop PC


  1. What else do I need to install external to OH
  2. What other files are required in OH
  3. What bindings and services need to be installed in OH (I assume MQTT embeded broker and MQTT binding)
  4. Is there any plain code in the Arduino IDE I can use as an example (hopefully just basic ESP nad temp sensor)

TIA, I tried to do as much research before sending this post but I am running out of option, resources to look at.

Here is something I wrote to monitor the temp of my smoker.

Basically you need the required mqtt and Wifi libraries for arduino ide. Once you have that it’s just call the publish function in the library and it sends it out!
I was in your shoes a few years ago so I understand!

On the openHAB side install the mqtt2 binding and a broker. I suggest mosquito over the embedded one but that’s my opinion.

You also need to find an mqtt watcher program. I have been using mqttfx, but there is mqttspy and a chrome extension I don’t remember the name.

So I installed MQTT Binding (mqtt-binding - 2.5.0 SNAPSHOT) as for the broker the only thing that comes up under Add-ons Misc is MQTT Broker Moquette, is this the one ?. I have Mosquitto MQTT installed on my PC ?

If you have mosquito installed on pc you don’t need the embedded broker. So if mosquito is installed and functioning I would remove the embedded broker. You only need the binding.

1 Like

What is the purpose of mqttfx ?

It is a viewer (call it a mqtt client) used to read the communications to and from the mqtt server.
it is a very powerful tool for fault finding and setup use.
it is all i use to make sure i have my ch. setup correctly and that the right information gets to my OpenHAB setup.



I cannot compile your arduino code due to this, any idea ?. It may be due to my board (nodemcu/esp8266), is this code for a different type of board ?


You can try the “ESP Easy” firmware - https://www.letscontrolit.com/wiki/index.php/ESPEasy. I’ve used it with an ESP32 and it worked out of the box.


it works for me i have been using it for over 2 years . and it is a breeze

I use the following lib’s in the ESP8266 on my setup:

#include <ESP8266WiFi.h>
#include <ArduinoOTA.h>
#include <PubSubClient.h> 

and then the Mosquitto broker.

@waketech found the problem. You need a special max6675 library. I seem to remember this. If you don’t have the correct one it won’t compile. Here is one that works.

I uploaded to that git project. https://github.com/thedannymullen/smoker-temp/blob/master/MAX6675-master.zip

See here: https://github.com/adafruit/MAX6675-library/issues/9

This is what I followed to get it working a few years ago. I just forgot since the libraries have been sitting in my directory since then.

1 Like


Much appreciated, so I got it loaded and running…


I loaded mosquiito.exe and connected mqttfx, what do I need to setup in mqttfx to see the values, then what gets done in OH

Update: So I got the data coming into and showing in MQTTFX, now the question remains for proper OH

1 Like

Ok guys/gals, played around with OH and got it going. I would like to thank you all for your time and help it is much appreciated :slight_smile: