HowTo: NodeRed – High humidity warning

Especially in rooms in which you “work” much mit water or steam you should always ventilate sufficiently to prevent damage and health hazards caused by mold.

If you are one of the people who like to forget something and also happen to have a humidity sensor in the respective rooms, which also happens to be connected to your NodeRed installation, then you can let yourself be reminded of too high air humidity automatically.

How to do this is described in the following article.

Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section. 
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂


Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/sicherheitshinweise/


Requirements

Helpful Articles:
Of course NodeRed should already be installed so that you can take over this configuration.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.
RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The first configuration
RaspberryPi – Controlling the RaspberryPi via SSH
NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – Install New Nodes

Required tools:
-none-

Required material:

In the following list you will find all the parts you need to implement this article.


Log in to the NodeRed configuration interface

Before you can edit your NodeRed configuration you must - if activated - first log in to the NodeRed configuration interface.

View of the login screen. Here you have to enter the login details that you entered during the configuration of the login. Information about this can be found in the article NodeRed - User Login Setup.

Install necessary nodes

In addition to the standard nodes, this example also uses the nodes “node-red-node-pushbullet” and “node-red-dashboard”. For this example to work, you need to install these nodes. How to install Nodes is described in the article NodeRed – Install New Nodes.


Import Node Code

The core function of this example is to calculate a moving average out of the the last air humidity values ​​and then check if this value exceeds a certain value. In this context, moving average means that the average value is always determined from the last (for example) ten measured values. This has the advantage that one-time peaks of the measured values ​​do not cause an alarm. Only a permanent/long-time increase in humidity causes the value of the moving average to rise above the set limit and thus trigger an alarm.

To import this example into your NodeRed installation, you need to import the node code below. Tips can be found in the article NodeRed – Import and Export Node Code.

Remember to place dashboard nodes on your dashboard after importing. Tips can be found in the article NodeRed – Creating a User Interface with Dashboard Nodes.

You may also need to provide an API key for the push bullet node. This is also described in the article Registering a Pushbullet API Key.

View of the Node configuration in the NodeRed editor.
View the limit setting option in the dashboard.
[{"id":"f73f8a41.7d9278","type":"mqtt in","z":"4131a41e.b9233c","name":"","topic":"bathroomTemp","qos":"2","broker":"ddb40b41.78ae38","x":780,"y":1340,"wires":[["93e1108d.ad9c7"]]},{"id":"93e1108d.ad9c7","type":"smooth","z":"4131a41e.b9233c","name":"","property":"payload","action":"mean","count":"10","round":"","mult":"single","x":960,"y":1340,"wires":[["d7851151.0479b","8465689.bf4d298"]]},{"id":"8465689.bf4d298","type":"debug","z":"4131a41e.b9233c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1150,"y":1280,"wires":[]},{"id":"589714bd.e93cec","type":"pushbullet","z":"4131a41e.b9233c","config":"1788f4a5.0c63bb","pushtype":"note","title":"SmartHome","chan":"","name":"SmartHome","x":1470,"y":1340,"wires":[]},{"id":"d7851151.0479b","type":"function","z":"4131a41e.b9233c","name":"check","func":"msg.payload=msg.payload>context.global.maxHumiBath;\nreturn msg;\n","outputs":1,"noerr":0,"x":1110,"y":1340,"wires":[["6a9e9862.05e698"]]},{"id":"290bb7a0.63d8c8","type":"ui_numeric","z":"4131a41e.b9233c","name":"","label":"Max.Humidity Bathroom","group":"6938a6b5.5f1de8","order":0,"width":0,"height":0,"passthru":true,"topic":"","format":"{{value}}","min":"30","max":"100","step":1,"x":1210,"y":1380,"wires":[["7c2998ea.ef3658"]]},{"id":"dd457329.9d893","type":"inject","z":"4131a41e.b9233c","name":"load StandardValue","topic":"","payload":"70","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":960,"y":1380,"wires":[["290bb7a0.63d8c8"]]},{"id":"7c2998ea.ef3658","type":"function","z":"4131a41e.b9233c","name":"save maxHumiBath","func":"context.global.maxHumiBath=msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":1430,"y":1380,"wires":[[]]},{"id":"6a9e9862.05e698","type":"trigger","z":"4131a41e.b9233c","op1":"Humidity in bathroom is high.","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"false","bytopic":"all","name":"","x":1280,"y":1340,"wires":[["589714bd.e93cec","ee53da08.077d68"]]},{"id":"ee53da08.077d68","type":"ui_toast","z":"4131a41e.b9233c","position":"dialog","displayTime":"25","highlight":"","outputs":1,"ok":"OK","cancel":"","topic":"Information","name":"Information","x":1470,"y":1300,"wires":[[]]},{"id":"ddb40b41.78ae38","type":"mqtt-broker","z":"","name":"Server-Mqtt","broker":"server.fritz.box","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"1788f4a5.0c63bb","type":"pushbullet-config","z":"","name":"FabsPushbullet"},{"id":"6938a6b5.5f1de8","type":"ui_group","z":"","name":"Werte","tab":"fddf98ef.773da8","disp":true,"width":"6","collapse":false},{"id":"fddf98ef.773da8","type":"ui_tab","z":"","name":"Einstellungen","icon":"dashboard"}]

Adjust values

In this configuration, two values determine the function.
On the one hand there is the limit, which determines from which value of the humidity an alarm is issued. This can be set directly via the dashboard node.

On the other hand, by increasing or decreasing the number of values that determine the moving average, you can control how “sluggish” – but more accurate – the alarm responds. If the moving average relates to very few values, changes (and also exceedances of the limit value) are detected more quickly. Unfortunately, even very short-term changes in the measured value, such as measurement errors, can lead to a false-positive triggered alarm.

Experiment with the values a little around and look what is best for your case. In this example, the limit is 70% humidity for ten values on which the moving average is based.

In the configuration of the Smooth-Node you can set in the field “over the most recent … values”, over how many values the moving average is calculated.

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

Fab

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at ko-fi.com

Leave a Reply

Your email address will not be published. Required fields are marked *