ESP8266 Node MCU - Temp, Contact, Water Sensor

Great to see some other ESP8266 users :slight_smile: Are you just polling the ESP8266 from ST then?

I didn’t write the original code, but the esp sends an update if the contact sensor or temp state is changed. You can also refresh temp from the app. I wanted to get the ability to refresh the sensor state from the app, but I just haven’t been able to get it right. I’m not a dev and this is about as much code as I get into at this point. I’m still learning right now.

Just as someone else said, it is AWESOME to see another ESP8266 fan working with ST. I have ESP-01’s and ESP12E’s all over the house and have been relying on IFTTT recipes for some of my REED sensor notifcations and rules, which has worked flawlessly I have to admit. But…integrating them with ST would add a whole new level of geeky goodness! I’ll definitely keep an eye out on this site and add to it as I start ‘playing’.

I didn’t think devices could send data to the ST hub unless OAUTH was setup via a SmartApp (separate from the DH). Quick glance at this code seems to send data directly to the ST hub.

Can you post link to the code you used, I’m just curious if there is more discussion of OAUTH there.

Thanks!

I think these integrations with the ESPs directly end up responding to a web request and the data is pushed to the ST server then. Its not pushed from the ESP to ST as much as requested from the ESP.

Take a look at the sendnotify section of the arduino, it sure appears to send an update. If you look at the device handler, the parser seems to handle the incoming messages. I can confirm that if I open the sensor, smartthings is updated immediately, no delay whatsoever. I do know that if the mac is not specified, you do not get the updates at all. Only the refresh pulls will work in that case.

Take a look at this thread. The current code is similar, but I have noticed a few slight changes as he updates it from time to time in GitHub.

The code I based mine on was from another member that had it saved, but this is the base for it all. I think there is another thread about temperature as well under his profile.

That’s incorrect. The NodeMCU pushes data to ST hub. There’s no polling necessary in this case.

I stand corrected. As I look closer, I see the push. Sorry for the misinformation.

No need to be sorry on this thread! I think it’s awesome to have a discussion where we can all learn and validate our thoughts.

This is GREAT! I fired up one of my NODEMCU’s last night and created the device with the dummy temp reading and all is working nicely. I plan on adding real-deal sensors to it over the Christmas break and will let you know how all goes. Thank you again for sharing your progress with us…this really is VERY COOL! Hope all have a most excellent Holiday!

Good to hear. Were you able to get DHT11’s working with it? I was going to work adding support for it today, but my “real” job needs me :slight_smile:

That’ll be my next move…getting the DHT11 fired up on it. I started working on the sketch last night and hope to have it running in the next day or two.

I took a first stab at DHT11 support, haven’t been able to get the the device handler yet. New esp code is in my github link. I doubt I’ll have time to do much with it anymore today. Seems to work for me though.

The code looks real good, you added the Humidity to it I see as well. I had not gotten that far so very cool. I’ll load up your code as well and go from there. If I make any progress on the device handler, etc…I’ll share it here as well.

would you be doing a detailed write up for noobs like me? thanks in advance

My schedule won’t allow time to be much more detailed than what I was already. I’d be more than happy to answer any questions though! Good luck!

Nice one, but how do I get the temperature in Celsius ©?

in file smartthings_DHT_DHCP.ino in line 166 instead temp = dht.readTemperature(true); you should use temp = dht.readTemperature();

You might also want to check out @ogiewon’s ST_Anything. It’s a whole bunch of different sensors pre-built with a ton of different options for each. Also it allows you to mix/match across different boards. I started to work on the very beginning of something similar but am SOOO glad I found his instead. He’s even got integration of the new ESP-32’s.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.