Temperature Exception Alerts via Email or SMS

Hello everyone,
I don't have any experience or education before about Node-red (beginner), :slightly_smiling_face:

My project is to measure temperature using (Raspberry Pi 3 B with 1-wire DS18B20 digital temperature sensor) ,
so
I would like get alerts by receiving an email message whenever the sensor value goes out of a specified range,
for example to Sending e-mail notifications when temperature is over 30°C., if it possible directly from the sensor.

Any help would be appreciated a lot.
Thanks in advance.

Node-RED version: v1.2.9
Node.js version: v10.24.0

Take a look at the switch node. You could test the value and eithor ignore it or send it on. You may want to rate limit the number of emails sent depending on how ofter you read the sensor.

1 Like

Is this going into production ? or is this for personal use?

things to look out for and add your own checks if the sensor keeps sending these values

85C - the temperature sensor has either not received an instruction to do a temperature conversion, or it has not had the time or the power to do a conversion. Check for fallty connection in I/0 data line and power line. Check for corosion in connector or inside sensor housing. 3.3v power Might not be stable
0C - Check for too much resistance in line pullup resistor. Check for faulty connection in I/0 data line. Check for corrosion in connector or inside sensor housing. 3.3v power should be stable

This should help you get started - you will need node-red-contrib-string node-red-contrib-string (node) - Node-RED

[{"id":"36ad0ad3.620096","type":"comment","z":"de676095.53412","name":"85C / 0C are temp sensor error codes","info":"","x":190,"y":240,"wires":[]},{"id":"1887872b.13ad89","type":"change","z":"de676095.53412","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"85C - the temperature sensor has either not received an instruction to do a temperature conversion, or it has not had the time or the power to do a conversion. Check for fallty connection in I/0 data line and power line. Check for corosion in connector or inside sensor housing. 3.3v power Might not be stable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":280,"wires":[["daa5ef8b.3b8c6"]]},{"id":"7c8e139e.86f41c","type":"string","z":"de676095.53412","name":"append-topic 0deg","methods":[{"name":"append","params":[{"type":"str","value":" Tempsensor = 0 "}]}],"prop":"topic","propout":"topic","object":"msg","objectout":"msg","x":490,"y":320,"wires":[["c6605520.b18b28"]]},{"id":"a15d1d91.33c87","type":"string","z":"de676095.53412","name":"append-topic 85deg","methods":[{"name":"append","params":[{"type":"str","value":" Tempsensor = 85 "}]}],"prop":"topic","propout":"topic","object":"msg","objectout":"msg","x":500,"y":280,"wires":[["1887872b.13ad89"]]},{"id":"c6605520.b18b28","type":"change","z":"de676095.53412","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"0C - Check for too much resistance in line pullup resistor. Check for faulty connection in I/0 data line. Check for corrosion in connector or inside sensor housing. 3.3v power should be stable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":320,"wires":[["daa5ef8b.3b8c6"]]},{"id":"346c7b4e.106594","type":"switch","z":"de676095.53412","name":"if 85C, if 0C, else","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"85","vt":"num"},{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":130,"y":300,"wires":[["a15d1d91.33c87","439c7e97.27065"],["7c8e139e.86f41c","439c7e97.27065"],["439c7e97.27065"]]},{"id":"daa5ef8b.3b8c6","type":"delay","z":"de676095.53412","name":"Limit 1msg per topic per 1min","pauseType":"timed","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":930,"y":300,"wires":[["f7d14af.d9721b8"]]},{"id":"439c7e97.27065","type":"switch","z":"de676095.53412","name":"if between / = -55 to 125 pass value, else","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"-55","vt":"num","v2":"125","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":200,"y":420,"wires":[["55412ef5.d9cde8"],["c65a9b2d.56d698"]]},{"id":"8493d25c.71ae4","type":"change","z":"de676095.53412","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"-55 or > 125 C - the temperature sensor has most likely recieved electrical interfearance if value is beond operating temp range of -55 to 125 C.  Check for stray AC current from lights or automatic doors. Fans kicking on. High voltage and amp draw loads near sensor or wire. Check the shielded cable was used for install and is not broken or damaged.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":420,"wires":[["89a9d33c.d3095"]]},{"id":"89a9d33c.d3095","type":"delay","z":"de676095.53412","name":"Limit 1msg per topic per 1min","pauseType":"timed","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":970,"y":420,"wires":[["f7d14af.d9721b8"]]},{"id":"c65a9b2d.56d698","type":"string","z":"de676095.53412","name":"append-topic -55 or > 125 C","methods":[{"name":"append","params":[{"type":"str","value":" Tempsensor < -55 or > 125 C"}]}],"prop":"topic","propout":"topic","object":"msg","objectout":"msg","x":520,"y":420,"wires":[["8493d25c.71ae4"]]},{"id":"f826f941.3676c8","type":"comment","z":"de676095.53412","name":"Explain Error and send off to notification","info":"","x":550,"y":240,"wires":[]},{"id":"6b56e9e5.d4acc8","type":"comment","z":"de676095.53412","name":"Temps are outside of reading rang of sensor","info":"","x":210,"y":380,"wires":[]},{"id":"b6dab803.d7b3f8","type":"comment","z":"de676095.53412","name":"Explain Error and send off to notification","info":"","x":550,"y":380,"wires":[]},{"id":"44c72dfd.6602d4","type":"rbe","z":"de676095.53412","name":"block if tmp rate of change > 3 deg C +/-","func":"narrowband","gap":"3.1","start":"","inout":"in","property":"payload","x":500,"y":180,"wires":[["346c7b4e.106594"]]},{"id":"ee57255a.bc71a8","type":"link in","z":"de676095.53412","name":"","links":["45eff11c.bc0b6","458fec0.a339e14","2eb355a0.24059a"],"x":275,"y":180,"wires":[["44c72dfd.6602d4"]]},{"id":"a7aeacdd.dc5e","type":"comment","z":"de676095.53412","name":"Filter out bad results from noisy sensors.","info":"","x":500,"y":140,"wires":[]},{"id":"1366e6ca.66c4c9","type":"comment","z":"de676095.53412","name":"input from sensor --->","info":"","x":140,"y":180,"wires":[]},{"id":"55412ef5.d9cde8","type":"function","z":"de676095.53412","name":"This is where I send my temps to a database ","func":"\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":480,"wires":[[]]},{"id":"f7d14af.d9721b8","type":"e-mail","z":"de676095.53412","server":"smtp.gmail.com","port":"465","secure":true,"name":"","dname":"","x":1240,"y":360,"wires":[]}]

Just play around with what i did. This is not a soulution but a stepping stone to point you in the right direction.

1 Like

also if your stuck in imperial like me you might like this.
Screenshot from 2021-04-18 21-01-52

[{"id":"ab038f48.9092c","type":"function","z":"de676095.53412","name":"to Fahrenheit","func":"var tempc = msg.payload;\n    tempf = tempc * 9/5 + 32;\n    tempf = Math.round(tempf * 10000) / 10000;\n    msg.payload = tempf;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":920,"wires":[[]]}]
1 Like

it's for personal use , first of all i would like to learn, so I'm trying to make my home smart (DIY) , and I've started with the temperature as easy project. (making boiler temperature monitoring system and wanted to get alert mail when there's no hot water :sweat_smile: :

was difficult at the beginning to understand, but step by step.

thank you so much,
sei un grande :hugs:

1 Like

thank you so much, you're right (switch node) was easy solution for my request. :ok_hand:

Hi, I recently created a quick video for a similar scenario (temperature alert):

For alerting I use our own alerting service SIGNL4.

Since this is just a demo I use a simulator for changing the temperature (instead of an actual sensor). I created this using the Node-RED UI nodes. I send an alert when the temperature it too high and close it again when the temperature gets back to normal again.

I hope this helps or gives you some more ideas about what's possible :wink:

2 Likes

thank you sooooooooo much

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.