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}]