NodeMCU based MQTT multi-sensor with OLED display

Use code fences around all your posted code, so we can read it easier :wink:

Here’s my persistence strategy for the Temp_Chart group (all my sensors items belong to this group):

Items {
Temp_Chart* : strategy = everyMinute, restoreOnStartup
Temp_Chart_Period : strategy = everyChange, restoreOnStartup
}

Please post your items & sitemap definition files so we can take a look and see what’s wrong.

For this, I have started to use ESPEasy with these sensors. ESPEasy makes it easy to create an access point, but also allows me to change the configuration of the sensor using webpages, and add new sensors very easily too :slight_smile:

I haven’t made a full video about setting these up with ESP Easy, but I did show how to do it during my last live stream. You can watch it (it’s towards the end of the video where I show how I load/use ESPEasy), and hopefully it helps you!

Thank you BK for your help and yes i will try to use code fences:grinning: Actually i am new to these things. Here are my bindings and sitemaps files:-

Sitemaps:-

Text label="Temperature Chart" icon="line"
                       {
       Switch item=Temp_Chart_Period label="Temp Chart Period" mappings=[0="Hour", 1="Day", 2="Week", 3="Off"] icon="line"
       Chart item=Temp_Chart period=h refresh=6000 visibility=[Temp_Chart_Period==0, Temp_Chart_Period=="Uninitialized"]
       Chart item=Temp_Chart period=D refresh=30000 visibility=[Temp_Chart_Period==1]
       Chart item=Temp_Chart period=W refresh=30000 visibility=[Temp_Chart_Period==2]
                       }

Text label="Humidity Chart" icon="line"
                       {
      Switch item=Hum_Chart_Period label="Hum Chart Period" mappings=[0="Hour", 1="Day", 2="Week", 3="Off"] icon="line"
      Chart item=Hum_Chart period=h refresh=6000 visibility=[Hum_Chart_Period==0, Hum_Chart_Period=="Uninitialized"]
      Chart item=Hum_Chart period=D refresh=30000 visibility=[Hum_Chart_Period==1]
      Chart item=Hum_Chart period=W refresh=30000 visibility=[Hum_Chart_Period==2]

                        }

Items  


Group Temp_Chart(all)
Number Temp_Chart_period "Temp Chart Period"
//Group Temp_Chart_2 (all)
//Number Temp_Chart_Period_2 "Temp Chart Second Floor Period"
Group Hum_Chart (all)
Number Hum_Chart_period "Hum Chart Period"

Number Temperature_kube "kube Temp [%.1f °C]" <temperature> (FF_kube,Temp_Chart) {mqtt="<[broker:home/kube/temperature:state:default]"}
Number Humidity_kube "kube Hum [%.1f %%]" <humidity> (FF_kube,Hum_Chart) {mqtt="<[broker:home/kube/humidity:state:default]"}

I have changed the persistence strategy but still not getting any results on my graph.

Thanks a lot BK. Learning many things from you.
Finally i learned how to use code fences.:grinning:

Ok - so your sitemaps/items look alright, but there’s one thing missing from teh Chart line in the sitemap -the “service” option. Add it so that your Chart knows which persistence service to use. It’s described here: https://www.openhab.org/docs/configuration/sitemaps.html#element-type-chart and you need it for your specific case when running more than one persistence service (mapdb and rrd4j). Just add a service=“rrd4j” to your Chart line and see what happens!

Also - are you definitely getting good values in your items from the Kube sensor? I.e. if you add those Number items to your sitemap - do you see temperature/humidity values?

BK do you have a PDF instructions for this? I think I want to try this but instead of using a case designing it to fit into a wall box with wall plate so its less noticeable in a room. Is there any way to dim or turn off the screen at night?

@Jarred_Youngblood - I wrote up detailed instructions on my Thingiverse page and the Github repo. Fitting it into the wall box shouldn’t be too much of an issue, but you’d probably want to design your own PCB to house an AC/DC converter for power, and put the DHT sensor up front so it can get proper airflow for measurement.

You definitely can dim the screen, either based on a lux sensor input, or based on time (if you use ESPEasy like I have been doing lately, you can also write time-based rules) or based on an MQTT command from openHAB (based on an Astro sunset event).

That said, for a wall box based controller (with touchscreen), check out this project i found and adapted for openHAB recently (Home Automation Switch Plate) - it’s a fully functional display/controller that fits into a 1-gang wall box, and has a pre-designed PCB for a Wemos D1 and the AC/DC converter. The only thing it’s really missing is a DHT sensor, but you could potentially have a “dumb” sensor hidden somewhere else in the room, and display its temperature/humidity on the HASP (as a bonus, you also get touchscreen control and status display for other openHAB functions).

I had thought of something like you linked but I decided with kids, maybe I just want temp/humidity/motion…something they can’t break lol! I’ve integrated a pi touchscreen in the main hallway wall for larger control and have a wife friendly sitemap for our phones.

My goal with this to tell motion/temp/humidity and then work towards individual room duct control to even out the house. A year ago i started going room to room in the house pulling walls down and replacing insulation with spray-in foam. When I did that I ran all of my electrical in conduit and the main switch is a double gang and one side has a blank plate. I had thought of the AC/DC converter but being that stuff is so cheap and iffy to prevent a house fire i might just run a usb cable up through the conduit and put a outlet in the basement joyce. I don’t need my hobby burning down the house because i used a $3 ebay converter from china.

Do you have a oshpark version of the board? That pcb site I can’t get to work, has an error on country selection. Even tried remoting to my workstation desktop and no luck.

oh and also I did find your github and thingiverse sites. When I get my blank wall plate designed and fitted I’ll send you a link to it.

Good idea with the kids - the touchscreen would have to be pretty locked down to prevent them from making your house go crazy :slight_smile:

Awesome! We’re thinking alike! ^ That is precisely the reason I designed this thing in the first place, and why I added the external sensor/connector in a servo pinout. I’m hoping to eventually control my registers based on some room-balancing, too. If you haven’t seen it already, there’s a great write-up of a solution on this forum, which uses H-bridges and old ventmiser registers (basically replacing the ventmiser controller with a pre-wired ESP8266/Arduino, while keeping the original motor). As you’ve probably heard from anyone you’ve told this idea, you’ll want to monitor the differential pressure on your blower motor when closing vents (the “SAT” range varies, but for my motor, I don’t want it to get past 0.5 inHg. I’ll save you the trouble of finding a good sensor and dealing with analog pins on ESP8266 (don’t bother! :stuck_out_tongue: ) - the MPXV7002DP sensor with an ADS1115 ADC is the way to go!

I share your concerns, but the IRM-03-5 supply aderusha uses in his HASP project is actually a very good unit made by a good brand (used all over the place in household electronics), so I’m not worried about it being in my walls. Much easier than pulling DC cable to every place I’d want to put these :slight_smile:

I’ve shared my breakout board files on Github, including the Eagle .brd file you’ll want to use for OSHPark. Use the v1.1 files for now, as I’m still testing v1.2 - and the version posted doesn’t include the latest changes I made - waiting for those boards now, if they pass my testing, I’ll update the repo.

Awesome - looking forward to seeing what you come up with!!

Plus long runs of dc lose voltage so then you’re guessing at what voltage to supply in the basement so that you get the right voltage at the room. The irm is a very safe component and the HASP is a great place to start. I’m heading towards removing walls to get to ducting to seal mine up and make my solution more effective. I would love to spray foam, too. That’s awesome, keep it up.

With espeasy and openhab you can do nearly anything imaginable! I went a different way for the phones, making little habpanels that almost resemble apps

1 Like

Okay BK i will do that. And yes i am getting temp and humidity values in my openhab dashboard. I have done the testing of it by changing the temperature of sensor and its showing the change as well.I am facing problem in the graphical part only.

Still not getting any value in graph bk. I don’t know where i am wrong but really want to do this.Please help.

Are you using the Habpanelviewer app for this? I haven’t given it a try yet, thinking Habpanel layouts are too big for the phone screen, but yours looks actually usable.

This tells me you’ve got an issue with either persistence or your sitemap/item definition still. Let’s try this - post all three of your config files (.items, .sitemap and .persistence) on Pastebin or something like that (keep your private info out of them), and let us have a look at that. I’m sure it’s something simple like a typo in the configuration or something.

Just a chrome shortcut saved on the desktop with kiosk mode on. I didn’t figure on hp being usable on the phone either. I started setting up imperihome but at the time it broke Google home and I never got off the ground with it. I’m a little surprised it looks as well as it does too! :blush:

1 Like

Anyway to integrate the IRM-03-5 into the backside of your breakout board? I did get some ordered from Oshpark. Should be here in a week.

Hello Bk,

Kindly check the link for the sitemaps, items and persist files.

https://pastebin.com/dEU1tMeq

I have not added the service option to the sitemaps file because I have installed only one persistence service( rrd4j). Please help where I am wrong and what changes are required.

It wouldn’t fit without a redesign of the board, and at that point, might as well make the board bigger and add proper spacing for AC wiring, etc…I definitely wouldn’t recommend hacking something together just to make it fit.

Is that your full persistence file? If so, the problem is you’re not actually defining the persistence strategies, just defining the items/groups you want to persist. Your rrd4j.persist file should look more like this:

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
	// for rrd charts, we need a cron strategy
	everyMinute : "0 * * * * ?"
	everyHour : "0 0 * * * ?"
	everyDay : "0 0 0 * * ?"
	default = everyChange
}

Items {

	Temp_Chart*,Temp_Chart_2*,Hum_Chart* : strategy = everyMinute, restoreOnStartup
	Temp_Chart_Period,Temp_Chart_Period_2,Hum_Chart_Period : strategy = everyChange, restoreOnStartup
}

All your other files look OK to me, so I really think you just have an issue with your persistence description (and I assume you already have the actual persistence service/addon installed :slight_smile:

1 Like

Hi BK,
I am facing one more issue. I am installing 3 DHT sensor at my office in 3 different rooms. In the items files i am using the names like Temp1,Temp2 and Temp3. But in openhab application its showing the same temperature for all the 3 sensors and when i am changing the temperature of any one of 3 sensors its changing for all.
kindly help where i am wrong.

@Neelam_Rani - it sounds to me like you’re using the same MQTT topic for all three sensors. Even though you’re defining three different items, the data is coming from the same MQTT topic, and the three sensors are “fighting” by feeding their data to the same topic.

Double check that first…

1 Like

The issue is fixed BK and now its working fine. Thank you so much for your help.