Node red - turn on ventilation based on humidity

Hi i’m fresh here with HA and node-red and need little help

I have ventilation in bathroom, it is controled by smart switch and working in inching mode and working for 15 minutes. I have humidity sensor so need to make flow like that:

If humidity is more than 60% - turn on switch - check humidity after 15 minutes

Now im using pool state with refresh rate 15 minutes, but I need wait 15 minutes for first start, and without that, when humidity is rising its turning on all the time ( if switch “turn on” second time in that 15 minutes - it actually turning off ventilation)

I hope i explain that correctly :slight_smile:

So does it have to be inching mode?
Can’t you just use turn on/off instead?

Yeah it must be inching Mode, because it is mechanical ventilation in whole house, and with that impulse from switch it turns more powerfull boost :wink:

Sounds like you just need to check if the switch is on. If you uncheck state to state,

image

it will out put every time the sensor updates and the value is over what is set. Then if the switch is already on it does nothing if the switch is off it turns it on.

But switch is in inching Mode. So it is turned on only for 2 seconds. Only impuls from switch turning ventilation, not ON possition

Then turn on and delay two seconds then turn off and you have the same functionality as the inching mode.
Right?

Edit:
Oh… but you don’t have a sensor that says if the fan is on or not.
Can you mount a sensor to know if the fan is on or not?

It sounds like they will need one if not. If the fan is already on from some other source and the bathroom triggers, it will kick up the speed of the fan.

This will disable the trigger for 15min if the above is not a concern.

[{"id":"261d0ad15e82f79d","type":"trigger-state","z":"f80b6c338afd5483","name":"","server":"","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.bosch_humidity","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":">","comparatorValueDatatype":"num","comparatorValue":"50"}],"inputs":1,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":true,"x":440,"y":160,"wires":[["7e0be3f988eeee6c","095816da9e5d66ac"],[]]},{"id":"7e0be3f988eeee6c","type":"trigger","z":"f80b6c338afd5483","name":"disable trigger for 15 minutes","op1":"disable","op2":"enable","op1type":"str","op2type":"str","duration":"15","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":820,"y":100,"wires":[["261d0ad15e82f79d"]]},{"id":"095816da9e5d66ac","type":"api-call-service","z":"f80b6c338afd5483","name":"turn on fan","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":160,"wires":[[]]}]

This works just perfect :wink: Thx man :slight_smile: Long way for me to learn how it works :wink:

It’s pretty simple. Trigger state nodes can be disabled/enabled by sending the message enable/disable in the payload position. The other trigger node does just that, it first sends the message disable then waits 15 minutes and sends enable.

Hmm I was happy 2 soon… So after it goes “Disable” its stays disable all the time, never turn back to Enable again, I’ve done something wrong.

[{"id":"87eccd2d463baa70","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"261d0ad15e82f79d","type":"trigger-state","z":"87eccd2d463baa70","name":"","server":"","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.bosch_humidity","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":">","comparatorValueDatatype":"num","comparatorValue":"50"}],"inputs":1,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":true,"x":280,"y":220,"wires":[["7e0be3f988eeee6c","095816da9e5d66ac"],[]]},{"id":"7e0be3f988eeee6c","type":"trigger","z":"87eccd2d463baa70","name":"disable trigger for 15 minutes","op1":"disable","op2":"enable","op1type":"str","op2type":"str","duration":"15","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":660,"y":160,"wires":[["261d0ad15e82f79d"]]},{"id":"095816da9e5d66ac","type":"api-call-service","z":"87eccd2d463baa70","name":"turn on fan","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":220,"wires":[[]]}]

Everything seems to be in order. The only thing that would cause this is if nodered restarted while the timer was active.

If you didn’t restart nodered, to make sure it isnt crashing and restarting turn off the watchdog on the addon page. If it crashes it won’t restart. Leave it off for a few days.

This has a different timer that will survive a restart.

[{"id":"261d0ad15e82f79d","type":"trigger-state","z":"87eccd2d463baa70","name":"","server":"6b1110b5.183a4","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.3a_air_sensor_02_humidity","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":">","comparatorValueDatatype":"num","comparatorValue":"50"}],"inputs":1,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"num","enableInput":true,"x":340,"y":260,"wires":[["095816da9e5d66ac","dd6520d0b4dd5e8c","799847f4114857c4"],[]]},{"id":"095816da9e5d66ac","type":"api-call-service","z":"87eccd2d463baa70","name":"turn on fan","server":"6b1110b5.183a4","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":260,"wires":[[]]},{"id":"dd6520d0b4dd5e8c","type":"stoptimer-varidelay","z":"87eccd2d463baa70","duration":"15","durationType":"num","units":"Minute","payloadtype":"num","payloadval":"0","name":"","reporting":"none","persist":true,"ignoretimerpass":false,"x":680,"y":340,"wires":[["95b2e2992ac546f3"],[],[]]},{"id":"95b2e2992ac546f3","type":"change","z":"87eccd2d463baa70","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"enable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":340,"wires":[["261d0ad15e82f79d"]]},{"id":"799847f4114857c4","type":"change","z":"87eccd2d463baa70","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"disable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":200,"wires":[["261d0ad15e82f79d"]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"30"}]

Yeah I used the second one and this is working better, just connect 15min timer node to Humidity output like that:

222

1 Like