NodeMCU with several sensors integrating into OpenHab2 with MQTT?


(Antsy) #1

Hi,
I was planning to use a NodeMCU v2 (ESP8266) (with usb charger) and add these sensors: https://www.modmypi.com/raspberry-pi/se … ure-sensor
They have a digital output. I wanted to connect 5 of these sensors to different GPIOs of one NodeMCU.

Then I wanted to integrate the NodeMCU with the sensors into OpenHAB2. I did read that I need to do that with MQTT.

Can anybody confirm if it is possbible to use several sensors on one NodeMCU with ESPEasy and integrate it with MQTT in OpenHab2? I just need digital output of the sensors.

Or is there even a better way?


(Skinah) #2

Getting the mqtt into openhab is no problem, the other half of your questions is better asked at the espeasy project. Have not tried that project as I like to program the devices myself which if you do that then multiple sensors are possible. If you need a working mqtt set of rules to copy find my milight thread in the solutions area of this forum.


(Martin Korsrud) #3

I’ve used NodeMCU with 4 sensors (RF proximity, humidity, temp and voltage) and MQTT for sending sensor data to a Mosquitto broker running on Ubuntu 17.10 server. It’s quite easy to get it all working. I used this link as a starting point and developed from there. Alas, I cannot share the code as I do not have the intellectual property rights (commercial project), but I think you are dead on with respect to the technologies you’ve selected.

Although, I did not connect anything to OpenHab in this project, that should not be any problem.


(B K) #4

My project https://www.thingiverse.com/thing:2539897 is a NodeMCU based multi-sensor with MQTT. I developed the code for it (https://github.com/bkpsu/NodeMCU-Home-Automation-Sensor) which allows configuration for different scenarios, including using the built-in DHT22 temp/humidity sensor, displaying information on the built-in OLED screen (for local info), etc…I also have an external input port, which I’ve used for connecting an HC-SR501 motion sensor (though it could be used for any 3-wire sensor or servo connection).

I also designed a PCB and case (as shown on the Thingiverse link), to make it all look a bit more put together.


(Johann Obermeier) #5

If you want todo it the easy way, i mean no programming stuff, than use this software

on an NodeMCU or similar. Just flash, setup your MQTT settings and your sensors in the web Console and your gone


(Antsy) #6

Is there a difference between Sonoff-Tasmota and ESPEasy concerning what I want to do?


(Markus Haack) #7

If you want to do more complex stuff you also might wan’t to look into https://github.com/marvinroger/homie-esp8266. I use that for a bunch of simple temp & humidity sensors, works very smooth.