Help with automating ventilation

Hi there, I would love to get some suggestions or solutions on how to properly automate my ventilation system. At the moment my ventilation is automated by using a humidity sensor in the bathroom and according to the %RH the ventilation is either on high, medium or off. This works fine but I want to add some functionality but I am unsure on how to properly add this to node-red.
My wishes are the following:

  • Override button to enable or disable medium ventilation (preferably linked to button on Lovelace dashboard)
  • Disable medium ventilation when one of my window sensors has status open
  • Disable medium ventilation if my bathroom sensor is within 5 %RH of my humidty sensor in the hallway
  • If at all possible I would love to set the %RH thresholds used for the switch node by separate inputs by using inject nodes for instance

Thanks

  1. Override button
  • you need to check the status of the override button after your humidity sensor
  • you need have another input trigger which is acting based on the even of your override button
  1. Disable Medium ventilation
  • just check the window status before your ‘ventilation medium’ node , and block the message if the window is open
  1. you can do the threshold handling within a function node in front of your switch and just return OFF,LOW,MEDIUM,HIGH as message for your switch

but as so often … this is just one approach and i’m sure there are lots of brilliant ideas arround

1 Like

Hmm well that should help me along, not sure if I am able to write the function node and configure the other nodes you suggested with my lack of node-red or programming knowledge but it gives me some options to experiment with thanks.

you can export and share your flow here … I’m sure somebody will be able to help you with the function node as it is a straight forward if-then code

This is untested but might get you going in the right direction. I tried to build it without using any custom code. The switch is probably the most complicated part but it’s just a complex if statement. Also I don’t run any fans in my system so wasn’t exactly sure if you need to turn on the fan before setting the speed.

[{"id":"105c4277.96377e","type":"server-state-changed","z":"87dc7051.52b27","name":"Humidity Xiaomi","version":1,"entityidfilter":"sensor.humidity","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":112,"y":432,"wires":[["e5d9beca.7107c"]]},{"id":"e5d9beca.7107c","type":"api-current-state","z":"87dc7051.52b27","name":"Medium Disabled?","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.fan_medium","state_type":"str","state_location":"fan_medium_disabled","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":522,"y":432,"wires":[["4070d96c.aa4d78"]]},{"id":"4070d96c.aa4d78","type":"api-current-state","z":"87dc7051.52b27","name":"high %","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_number.fan_high","state_type":"num","state_location":"fan_high","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":482,"y":480,"wires":[["e8af8a5e.4bea38"]]},{"id":"e8af8a5e.4bea38","type":"api-current-state","z":"87dc7051.52b27","name":"med %","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_number.fan_med","state_type":"num","state_location":"fan_med","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":492,"y":528,"wires":[["218a2955.5f7ae6"]]},{"id":"644f45ce.f858ec","type":"switch","z":"87dc7051.52b27","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"fan_high","vt":"msg"},{"t":"jsonata_exp","v":"(payload > fan_med or $abs((hall - payload)) >= (hall * 0.05)) and fan_medium_disabled = \"off\" and openWindows = 0","vt":"jsonata"},{"t":"lt","v":"fan_med","vt":"msg"}],"checkall":"false","repair":false,"outputs":3,"x":722,"y":480,"wires":[["56b593d4.e5860c"],["4e53ee08.2d13a"],["c82a0bc0.2fbf68"]]},{"id":"c82a0bc0.2fbf68","type":"api-call-service","z":"87dc7051.52b27","name":"Vent Off","service_domain":"","service":"","data":"","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":876,"y":528,"wires":[[]]},{"id":"4e53ee08.2d13a","type":"api-call-service","z":"87dc7051.52b27","name":"Vent Med","service_domain":"","service":"","data":"","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":876,"y":480,"wires":[[]]},{"id":"56b593d4.e5860c","type":"api-call-service","z":"87dc7051.52b27","name":"Vent High","service_domain":"","service":"","data":"","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":876,"y":432,"wires":[[]]},{"id":"218a2955.5f7ae6","type":"api-current-state","z":"87dc7051.52b27","name":"Hall Humidity","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.hall","state_type":"num","state_location":"hall","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":502,"y":576,"wires":[["17175821.c012e8"]]},{"id":"17175821.c012e8","type":"ha-get-entities","z":"87dc7051.52b27","name":"Open Windows","rules":[{"property":"entity_id","logic":"includes","value":"sensor.window1, sensor.window2","valueType":"str"},{"property":"state","logic":"is","value":"open","valueType":"str"}],"output_type":"count","output_empty_results":false,"output_location_type":"msg","output_location":"openWindows","output_results_count":1,"x":512,"y":624,"wires":[["644f45ce.f858ec"]]},{"id":"db4d4c99.d07ac","type":"server-state-changed","z":"87dc7051.52b27","name":"Window Opened","version":1,"entityidfilter":"sensor.window1, sensor.window2","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":112,"y":480,"wires":[["8364f1e9.4c35d"]]},{"id":"8364f1e9.4c35d","type":"api-current-state","z":"87dc7051.52b27","name":"Humidity Xiaomi","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.humidity","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":288,"y":480,"wires":[["e5d9beca.7107c"]]}]

Forgot to state this requires you to make an input_boolean in home assistant for the manual control of the medium fan, this would allow you to control it from lovelace. Also need to make two input_numbers to be able to set the High and Medium thresholds from lovelace.

1 Like

Thanks that looks like a less complicated flow than what I came up with so far and I didnt even include all my functionality, I am kinda surprised its without a function node. Will take a good look at your solution when I have time and see where it gets me.

Well here’s one with a function node then. :wink:

[{"id":"ebbf6d38.adfc6","type":"server-state-changed","z":"87dc7051.52b27","name":"Humidity Xiaomi","version":1,"entityidfilter":"sensor.humidity","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":144,"y":752,"wires":[["b2208856.8a8d18"]]},{"id":"f634acfd.10588","type":"server-state-changed","z":"87dc7051.52b27","name":"Window Opened","version":1,"entityidfilter":"sensor.window1, sensor.window2","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":144,"y":800,"wires":[["b2208856.8a8d18"]]},{"id":"4b858eac.d0fd9","type":"api-call-service","z":"87dc7051.52b27","name":"Ventilation","service_domain":"fan","service":"set_speed","data":"{\"entity_id\":\"fan.bathroom\"}","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":662,"y":752,"wires":[[]]},{"id":"f4d26c92.d14da","type":"function","z":"87dc7051.52b27","name":"","func":"const entities = global.get('homeassistant').homeAssistant.states;\n\nconst humidity = entities[\"sensor.humidity\"].state;\nconst disabled = entities[\"input_boolean.fan_medium\"].state;\nconst high = Number(entities[\"input_number.fan_high\"].state);\nconst med = Number(entities[\"input_number.fan_med\"].state);\nconst hall = Number(entities[\"sensor.hall\"].state);\n\n\nif (humidity > high) {\n    msg.payload = {\n        data: {\n            speed: \"high\"\n        }\n    }    \n} else if (humidity > fan_med && Math.abs(hall - humidity) > hall * 0.05 && disabled === \"off\" && msg.openWindows === 0) {\n    msg.payload = {\n        data: {\n            speed: \"med\"\n        }\n    }\n} else {\n    msg.payload = {\n        service: \"turn_off\"\n    }\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":498,"y":752,"wires":[["4b858eac.d0fd9"]]},{"id":"b2208856.8a8d18","type":"ha-get-entities","z":"87dc7051.52b27","name":"Open Windows","rules":[{"property":"entity_id","logic":"includes","value":"sensor.window1, sensor.window2","valueType":"str"},{"property":"state","logic":"is","value":"open","valueType":"str"}],"output_type":"count","output_empty_results":false,"output_location_type":"msg","output_location":"openWindows","output_results_count":1,"x":336,"y":752,"wires":[["f4d26c92.d14da"]]}]
2 Likes

@Kermit … well done

Looks amazing, not even sure what I want to use. A pure node based flow makes it easier to see what is happening but a function node seems easier to understand for me.
Since the fan itself is connected to a Sonoff 4CH Pro R2 I need to use a switch behind the function node to call the correct turn on switch service.
Thanks again this made me understand more about node-red, and seems if you actually know how node-red works my wishes are easier to implement than expected.

it will get easier with every flow you generate … but be careful as it is getting more and more complex with every flow :rofl:

my light switch journey got crazy:

  1. switch on/off a light via button
  2. Added motion sensor to the flow
  3. Added auto switch-off after specific time (if no new motion was detected)
  4. Added alexa voice support
  5. Added environment lightning check to the flow
  6. Added scheduler to enable/disable light (e.g. dont switch on during day)
  7. Added not-home feature
  8. Added fake-presence (random light on/off when not-home)

Hmm I decided to use the node based flow atm, but ran into a problem with the JSONata Exp in the switch node. Seems $abs subtraction fails as it doesnt recognize payload or hall as a number. Tried to troubleshoot it but failed so far.
Also just noticed that the Open Windows node doesnt work in combination with my sensors, count stays at 0 even when opening windows.

[{"id":"df97dd1d.6fecb","type":"tab","label":"Flow 3","disabled":true,"info":""},{"id":"7224f560.5e184c","type":"server-state-changed","z":"df97dd1d.6fecb","name":"Humidity_Xiaomi","server":"ad59f2ad.671e2","version":1,"entityidfilter":"sensor.humidity_xiaomi","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"num","halt_if_compare":"gte","outputs":1,"output_only_on_state_change":false,"x":80,"y":100,"wires":[["e72444ad.a74ab8"]]},{"id":"e72444ad.a74ab8","type":"api-current-state","z":"df97dd1d.6fecb","name":"Medium Disabled?","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.medium_ventilation_on_off","state_type":"str","state_location":"fan_medium_on_off","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":550,"y":100,"wires":[["78598c07.936334"]]},{"id":"78598c07.936334","type":"api-current-state","z":"df97dd1d.6fecb","name":"high %","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"input_number.vent_high","state_type":"num","state_location":"fan_high","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":510,"y":148,"wires":[["626dddfa.be4804"]]},{"id":"626dddfa.be4804","type":"api-current-state","z":"df97dd1d.6fecb","name":"med %","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"input_number.vent_medium","state_type":"num","state_location":"fan_med","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":520,"y":196,"wires":[["5d1b1360.b9f85c"]]},{"id":"2169c31.436af3c","type":"switch","z":"df97dd1d.6fecb","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"fan_high","vt":"msg"},{"t":"jsonata_exp","v":"(payload > fan_med and $abs((payload - hall)) >= 5) and fan_medium_on_off = \"on\" and openWindows = 0","vt":"jsonata"},{"t":"lt","v":"fan_med","vt":"msg"}],"checkall":"false","repair":false,"outputs":3,"x":290,"y":440,"wires":[["411b69de.cb3338"],["ac0b8599.35dd48"],["b50200b1.f18fc"]]},{"id":"ac0b8599.35dd48","type":"api-call-service","z":"df97dd1d.6fecb","name":"Vent Med","server":"ad59f2ad.671e2","service_domain":"switch","service":"turn_on","data":"{\"entity_id\":\"switch.sonoff_1000739d8d_1\"}","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":520,"y":460,"wires":[[]]},{"id":"411b69de.cb3338","type":"api-call-service","z":"df97dd1d.6fecb","name":"Vent High","server":"ad59f2ad.671e2","service_domain":"switch","service":"turn_on","data":"{\"entity_id\":\"switch.sonoff_1000739d8d_2\"}","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":520,"y":420,"wires":[[]]},{"id":"5d1b1360.b9f85c","type":"api-current-state","z":"df97dd1d.6fecb","name":"Hall Humidity","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.shelly_humidity","state_type":"num","state_location":"hall","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":530,"y":244,"wires":[["24b51272.46189e"]]},{"id":"24b51272.46189e","type":"ha-get-entities","z":"df97dd1d.6fecb","server":"ad59f2ad.671e2","name":"Open Windows","rules":[{"property":"entity_id","logic":"includes","value":"binary_sensor.openclose_5, binary_sensor.openclose_6","valueType":"str"},{"property":"state","logic":"is","value":"true","valueType":"bool"}],"output_type":"count","output_empty_results":false,"output_location_type":"msg","output_location":"openWindows","output_results_count":1,"x":540,"y":292,"wires":[["2169c31.436af3c"]]},{"id":"e3ae0334.1ccff","type":"server-state-changed","z":"df97dd1d.6fecb","name":"Window Opened/Closed","server":"ad59f2ad.671e2","version":1,"entityidfilter":"binary_sensor.openclose_5, binary_sensor.openclose_6","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":110,"y":160,"wires":[["9aefd6bc.4e58b8"]]},{"id":"9aefd6bc.4e58b8","type":"api-current-state","z":"df97dd1d.6fecb","name":"Humidity Xiaomi","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.humidity_xiaomi","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":320,"y":160,"wires":[["e72444ad.a74ab8"]]},{"id":"b50200b1.f18fc","type":"api-call-service","z":"df97dd1d.6fecb","name":"Ventilation Switch 4 On","server":"ad59f2ad.671e2","service_domain":"switch","service":"turn_on","data":"{\"entity_id\":\"switch.sonoff_1000739d8d_4\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":570,"y":500,"wires":[["63a035c9.f3bb7c"]]},{"id":"63a035c9.f3bb7c","type":"delay","z":"df97dd1d.6fecb","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":760,"y":500,"wires":[["2b1131fc.3bce5e"]]},{"id":"2b1131fc.3bce5e","type":"api-call-service","z":"df97dd1d.6fecb","name":"Ventilation Switch 4 Off","server":"ad59f2ad.671e2","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"switch.sonoff_1000739d8d_4\"}","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":950,"y":500,"wires":[[]]},{"id":"ad59f2ad.671e2","type":"server","z":"","name":"Home Assistant"}]

For the windows state use a string comparison not a boolean. It checks against whatever the string value is in HA.

Can you show a full debug dump of the message object after the Open Windows node, mainly curious why the payload and such aren’ t numbers. A solution would be to wrap the variables in the JSONata expression with $number()

Yeah I managed to figure out that windows state part by myself and already changed it to exactly what you now suggested, glad I did that correctly.

The output is as follows:
object
topic: “sensor.humidity_xiaomi”
payload: 68.5
data: object
_msgid: “85a7fd88.30c47”
fan_medium_on_off: “on”
fan_high: 80
fan_med: 65
hall: 54
openWindows: 1

Seems the $abs cant read the payload, or at least when I test the JSONata exp in the switch it says
" The left side of the “-” operator must evaluate to a number" which is payload.
I just added a current state node that just outputs the humidity from the sensor to msg.bathroom and replaced “$abs((payload - hall)) >= 5” with “$abs((bathroom - hall)) >= 5” in the JSONata exp.

I also added a delay before the Open Windows node to make sure the count works when I deploy the flow after changes.

Another thing I noticed is that when the JSONata exp is false but the payload > fan_med, nothing happens but what I want in this situation is that the fan turns off. So I added an otherwise to the switch that does that.

Do you mind sharing this part of your code?

payload > fan_med and $abs((bathroom - hall)) >= 7 and fan_medium_on_off = “on” and openWindows = 0

[{"id":"df30bd06.13a8d","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"1a74bbc5.7bdfb4","type":"server-state-changed","z":"df30bd06.13a8d","name":"Humidity_Xiaomi","server":"ad59f2ad.671e2","version":1,"entityidfilter":"sensor.humidity_xiaomi","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"num","halt_if_compare":"gte","outputs":1,"output_only_on_state_change":true,"x":80,"y":140,"wires":[["3ab32c9.b1389d4"]]},{"id":"3ab32c9.b1389d4","type":"api-current-state","z":"df30bd06.13a8d","name":"Medium On/Off?","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.medium_ventilation_on_off","state_type":"str","state_location":"fan_medium_on_off","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":380,"y":120,"wires":[["a586b3c5.166a"]]},{"id":"a586b3c5.166a","type":"api-current-state","z":"df30bd06.13a8d","name":"high %","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"input_number.vent_high","state_type":"num","state_location":"fan_high","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":350,"y":180,"wires":[["2a328119.1473ce"]]},{"id":"2a328119.1473ce","type":"api-current-state","z":"df30bd06.13a8d","name":"med %","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"input_number.vent_medium","state_type":"num","state_location":"fan_med","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":360,"y":236,"wires":[["46a90a40.cf2db4"]]},{"id":"27d44d51.989c62","type":"switch","z":"df30bd06.13a8d","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"fan_high","vt":"msg"},{"t":"cont","v":"NaN","vt":"str"},{"t":"jsonata_exp","v":"bathroom_light = \"on\"","vt":"jsonata"},{"t":"jsonata_exp","v":"payload > fan_med and $abs((bathroom - hall)) >= 7 and fan_medium_on_off = \"on\" and openWindows = 0","vt":"jsonata"},{"t":"lt","v":"fan_med","vt":"msg"},{"t":"else"}],"checkall":"false","repair":false,"outputs":6,"x":550,"y":420,"wires":[["1108d683.de6529","63ccf00c.a5f5a"],["63ccf00c.a5f5a"],["77ab04f5.23f17c"],["77ab04f5.23f17c","63ccf00c.a5f5a"],["63ccf00c.a5f5a"],["63ccf00c.a5f5a"]]},{"id":"77ab04f5.23f17c","type":"api-call-service","z":"df30bd06.13a8d","name":"Vent Med","server":"ad59f2ad.671e2","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.4chpro_1","data":"{\"entity_id\":\"switch.4chpro_1\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":760,"y":420,"wires":[[]]},{"id":"1108d683.de6529","type":"api-call-service","z":"df30bd06.13a8d","name":"Vent High","server":"ad59f2ad.671e2","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.4chpro_2","data":"{\"entity_id\":\"switch.4chpro_2\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":760,"y":360,"wires":[["20cc7151.d9d2ee"]]},{"id":"46a90a40.cf2db4","type":"api-current-state","z":"df30bd06.13a8d","name":"Hall Humidity","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.shelly_humidity","state_type":"num","state_location":"hall","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":370,"y":284,"wires":[["4e9388d9.3f23b8"]]},{"id":"3484cac7.15f6b6","type":"ha-get-entities","z":"df30bd06.13a8d","server":"5dba05af.0ca1ec","name":"Open Windows","rules":[{"property":"entity_id","logic":"includes","value":"binary_sensor.openclose_5,binary_sensor.openclose_6,binary_sensor.openclose_7","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"count","output_empty_results":true,"output_location_type":"msg","output_location":"openWindows","output_results_count":1,"x":360,"y":500,"wires":[["27d44d51.989c62"]]},{"id":"f3db1103.f9f62","type":"server-state-changed","z":"df30bd06.13a8d","name":"Window Opened/Closed","server":"ad59f2ad.671e2","version":1,"entityidfilter":"binary_sensor.openclose_5,binary_sensor.openclose_6","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":110,"y":300,"wires":[["80481a8e.aefd98"]]},{"id":"80481a8e.aefd98","type":"api-current-state","z":"df30bd06.13a8d","name":"Humidity Xiaomi","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.humidity_xiaomi","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":120,"y":220,"wires":[["3ab32c9.b1389d4"]]},{"id":"63ccf00c.a5f5a","type":"debug","z":"df30bd06.13a8d","name":"Switch","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":720,"y":100,"wires":[]},{"id":"f1762a88.b839e8","type":"api-current-state","z":"df30bd06.13a8d","name":"Bathroom Humidity","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.humidity_xiaomi","state_type":"num","state_location":"bathroom","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":370,"y":380,"wires":[["cb70c2b9.a5f16"]]},{"id":"cb70c2b9.a5f16","type":"delay","z":"df30bd06.13a8d","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":340,"y":440,"wires":[["3484cac7.15f6b6"]]},{"id":"f66d545e.0b0ea8","type":"server-state-changed","z":"df30bd06.13a8d","name":"Medium setting changed","server":"ad59f2ad.671e2","version":1,"entityidfilter":"input_boolean.medium_ventilation_on_off","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":110,"y":360,"wires":[["80481a8e.aefd98"]]},{"id":"7d698532.b664ec","type":"api-call-service","z":"df30bd06.13a8d","name":"Turn off ventilation","server":"ad59f2ad.671e2","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.4chpro_2","data":"{\"entity_id\":\"switch.4chpro_2\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1150,"y":300,"wires":[["80481a8e.aefd98"]]},{"id":"af80544.78924a8","type":"inject","z":"df30bd06.13a8d","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":80,"y":460,"wires":[["80481a8e.aefd98"]]},{"id":"20cc7151.d9d2ee","type":"stoptimer","z":"df30bd06.13a8d","duration":"15","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":940,"y":360,"wires":[["7d698532.b664ec"],[]]},{"id":"2193342.36bfccc","type":"server-state-changed","z":"df30bd06.13a8d","name":"Bathroom Light On?","server":"ad59f2ad.671e2","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.hue_ambiance_ceiling_1","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":90,"y":520,"wires":[["80481a8e.aefd98"],["80481a8e.aefd98"]]},{"id":"4e9388d9.3f23b8","type":"api-current-state","z":"df30bd06.13a8d","name":"Bathroom Light On?","server":"ad59f2ad.671e2","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_ambiance_ceiling_1","state_type":"str","state_location":"bathroom_light","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":380,"y":340,"wires":[["f1762a88.b839e8"]]},{"id":"ad59f2ad.671e2","type":"server","z":"","name":"Home Assistant"},{"id":"5dba05af.0ca1ec","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]