Punch Through
Published © MIT

Email temperature warning system using Node-RED

Connect your Bean to the internet without writing complex server software. Use Node-RED instead!

IntermediateProtip6,010
Email temperature warning system using Node-RED

Things used in this project

Software apps and online services

node-red
Punch Through bean loader

Story

Read more

Code

Code snippet #1

Plain text
[{"id":"ffdc6b93.002398","type":"bean","name":"Yeezus","uuid":"","connectiontype":"timeout","connectiontimeout":"10"},{"id":"6d624520.929dbc","type":"bean temp","name":"Bean temp","bean":"ffdc6b93.002398","x":419,"y":157,"z":"40301a3c.bfcfe4","wires":[["1f2344c7.e0dcbb"]]},{"id":"d2aa7661.2d5588","type":"inject","name":"1 min interval","topic":"","payload":"","payloadType":"date","repeat":"1320","crontab":"","once":false,"x":265,"y":157,"z":"40301a3c.bfcfe4","wires":[["6d624520.929dbc"]]},{"id":"1f2344c7.e0dcbb","type":"function","name":"temp threshold","func":"context.previousTemp = context.previousTemp || 0;\nvar temp = msg.payload;\n\nvar upperThreshold = 26;\nvar lowerThreshold = 20;\n\n// Check if the new temp is different from the previous\nif (context.previousTemp != temp){\n\tif ( temp >= upperThreshold){\n\t\tmsg.payload = \"It's too hot! Current temperature is \" + String(temp) + \"°C\";\n\t\treturn msg;\n\t}\n\telse if ( temp <= lowerThreshold){\n\t\tmsg.payload = \"It's too cold! Current temperature is \" + String(temp) + \"°C\";\n\t\treturn msg;\n\t}\n}","outputs":1,"x":583,"y":157,"z":"40301a3c.bfcfe4","wires":[["1e8256cb.e17da9"]]},{"id":"1e8256cb.e17da9","type":"e-mail","server":"smtp.gmail.com","port":"465","name":"EMAIL","dname":"Email","x":729.8889465332031,"y":156.88888549804688,"z":"40301a3c.bfcfe4","wires":[]}]

Credits

Punch Through

Punch Through

16 projects • 39 followers
We’ve been building connected products since 2009. Our diverse team has expertise in every layer from hardware to software to web.
Contact

Comments

Add projectSign up / Login