Home Assistant Switch/Light Based flow based Manual, App or Automation

I am trying to set up a automation to control my bathroom fans, I will add if humidity is high then turn fan on until humidity returns to normal. My concern is if anyone in my family manually turns the fan on or via the app then I want it to run for 30 min.

I was able to figure out that when a switch/light is toggled the following ways the msg.payload contains the user id of how the device was turned on:

data.new_state.context.user_id

Manual Toggle switch the user_id is: null

App Toggle: user_id is: user who was logged in

Automation: user_id is: Supervisor

I was able to identify the users id from the file located @ \config.storage\auth .

My problem that I need to over come is if the humidity level is low and the user manually or app toggles the switch/light I don't want the flow to turn off the switch before 30 mins because the humility level reports normal level automatically.

Looking for suggestions to improve

Thanks

John

[{"id":"9414156b7cd7edf2","type":"server-state-changed","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.kitchen_island_dimmer","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":190,"y":1580,"wires":[["bed0a69ed916ce9d"]]},{"id":"bed0a69ed916ce9d","type":"switch","z":"eec1079e31761542","name":"Get User ID","property":"data.new_state.context.user_id","propertyType":"msg","rules":[{"t":"null"},{"t":"eq","v":"a14866021bce4d6eb4a71eafd19c6393","vt":"str"},{"t":"eq","v":"6a0947a3e14b4431ab2419d92c3becb0","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":450,"y":1580,"wires":[["39de9672864d8adc"],["5aeb8c7c79249f62"],["5aeb8c7c79249f62"],["a10519f0a2abd4ca"]],"outputLabels":["If UserTurned on/off(Not Null)","","",""]},{"id":"97e521f55830f414","type":"comment","z":"eec1079e31761542","name":"","info":"","x":100,"y":1480,"wires":[]},{"id":"a10519f0a2abd4ca","type":"switch","z":"eec1079e31761542","name":"Off triggered by Service/Automation","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":760,"y":1640,"wires":[["1859d52df86477d0"]]},{"id":"39de9672864d8adc","type":"switch","z":"eec1079e31761542","name":"On triggered by Swtich","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":720,"y":1520,"wires":[["1859d52df86477d0"]]},{"id":"780639dfd5ed1e48","type":"switch","z":"eec1079e31761542","name":"On triggered by Home Assistant User","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":770,"y":1580,"wires":[["1859d52df86477d0"]]},{"id":"b1f5a9aabb5e38a1","type":"api-call-service","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.kitchen_island_dimmer"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1510,"y":1520,"wires":[[]]},{"id":"1859d52df86477d0","type":"api-call-service","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.kitchen_island_dimmer"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1230,"y":1520,"wires":[["c3e22abb6a15f201"]]},{"id":"c3e22abb6a15f201","type":"delay","z":"eec1079e31761542","name":"","pauseType":"rate","timeout":"30","timeoutUnits":"minutes","rate":"1","nbRateUnits":"30","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":1340,"y":1660,"wires":[[]]},{"id":"5aeb8c7c79249f62","type":"junction","z":"eec1079e31761542","x":580,"y":1580,"wires":[["780639dfd5ed1e48"]]},{"id":"1be55532db11a10e","type":"junction","z":"eec1079e31761542","x":1440,"y":1660,"wires":[["b1f5a9aabb5e38a1"]]},{"id":"c33123cf.c144e","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]

I've managed to find an easy solution in hubitat, but I'd be very curious how to do this in Node-RED too.

Here is Version 0.2

First part is the same, Second part compares Master Bathroom Humidity to Master Bedroom Humidity, If the level go high then the fan turns on for at least 30 minutes or until humidity returns to low.

If the App User or Switch is used then the fan runs for 15 mins then turns off.

"[{"id":"9414156b7cd7edf2","type":"server-state-changed","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.master_bathroom_switch_l2","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":1540,"wires":[["bed0a69ed916ce9d"]]},{"id":"bed0a69ed916ce9d","type":"switch","z":"eec1079e31761542","name":"Get User ID","property":"data.new_state.context.user_id","propertyType":"msg","rules":[{"t":"null"},{"t":"eq","v":"a14866021bce4d6eb4a71eafd19c6393","vt":"str"},{"t":"eq","v":"6a0947a3e14b4431ab2419d92c3becb0","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":510,"y":1540,"wires":[["39de9672864d8adc"],["5aeb8c7c79249f62"],["5aeb8c7c79249f62"],["a10519f0a2abd4ca"]],"outputLabels":["If UserTurned on/off(Not Null)","","",""]},{"id":"97e521f55830f414","type":"comment","z":"eec1079e31761542","name":"Master Bathroom Humilty Fan","info":"","x":140,"y":1480,"wires":},{"id":"a10519f0a2abd4ca","type":"switch","z":"eec1079e31761542","name":"Off triggered by Service/Automation","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":780,"y":1580,"wires":[["6ec2efbfc8e3c8be"],]},{"id":"39de9672864d8adc","type":"switch","z":"eec1079e31761542","name":"On triggered by Swtich ","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":740,"y":1500,"wires":[["c3e22abb6a15f201"]]},{"id":"780639dfd5ed1e48","type":"switch","z":"eec1079e31761542","name":"On triggered by Home Assistant User","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":790,"y":1540,"wires":[["c3e22abb6a15f201"]]},{"id":"b1f5a9aabb5e38a1","type":"api-call-service","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":,"deviceId":,"entityId":["switch.master_bathroom_switch_l2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":,"queue":"none","x":1600,"y":1540,"wires":[]},{"id":"c3e22abb6a15f201","type":"delay","z":"eec1079e31761542","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"30","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":1130,"y":1500,"wires":[["6067e0f54f1a0cdf"]]},{"id":"06f048bde834d5d7","type":"ha-wait-until","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":1,"outputs":1,"entityId":"input_text.master_bathroom","entityIdFilterType":"exact","property":"state","comparator":"is","value":"humidity_low","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":1300,"y":1580,"wires":[["6067e0f54f1a0cdf"]]},{"id":"19499fc08a8404da","type":"server-state-changed","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.master_bedroom_humidity","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":1660,"wires":[["21cf8b7f.cb70a4"]]},{"id":"cf6fc929bf8b8018","type":"api-call-service","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":,"deviceId":,"entityId":["switch.master_bathroom_switch_l2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":,"queue":"none","x":1440,"y":1660,"wires":[]},{"id":"21cf8b7f.cb70a4","type":"smooth","z":"eec1079e31761542","name":"","property":"payload","action":"mean","count":"5","round":"","mult":"single","x":500,"y":1660,"wires":[["5a86f71c.b62ea8"]]},{"id":"2712565b.cad90a","type":"smooth","z":"eec1079e31761542","name":"","property":"payload","action":"mean","count":"2","round":"","mult":"single","reduce":false,"x":500,"y":1720,"wires":[["f429a2ba.72f8"]]},{"id":"5a86f71c.b62ea8","type":"change","z":"eec1079e31761542","name":"","rules":[{"t":"set","p":"sensor","pt":"msg","to":"bedroom","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1660,"wires":[["79da652e48bbfce8"]]},{"id":"f429a2ba.72f8","type":"change","z":"eec1079e31761542","name":"","rules":[{"t":"set","p":"sensor","pt":"msg","to":"shower","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1720,"wires":[["79da652e48bbfce8"]]},{"id":"825b867e11f81776","type":"server-state-changed","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.master_bathroom_humidity","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":1720,"wires":[["2712565b.cad90a"]]},{"id":"47177232479a5b26","type":"switch","z":"eec1079e31761542","name":"On triggered by Swtich","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"humidity_high","vt":"str"},{"t":"eq","v":"humidity_low","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1200,"y":1660,"wires":[["cf6fc929bf8b8018"],]},{"id":"6821f545b8aab5dc","type":"api-call-service","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":,"deviceId":,"entityId":["input_text.master_bathroom"],"data":"{"value":"{{payload}}"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":,"queue":"none","x":1200,"y":1700,"wires":[]},{"id":"6ec2efbfc8e3c8be","type":"delay","z":"eec1079e31761542","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"10","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":1090,"y":1580,"wires":[["06f048bde834d5d7"]]},{"id":"79da652e48bbfce8","type":"function","z":"eec1079e31761542","name":"","func":"var hum_bedroom = flow.get('hum_bedroom')||30;\nvar hum_shower = flow.get('hum_shower')||30;\nvar sensor = msg.sensor;\nvar delta = 10; //set to the desired threshold level\n\nswitch(sensor){\n case "bedroom":\n flow.set("hum_bedroom", msg.payload);\n break\n \n case "shower":\n flow.set("hum_shower", msg.payload);\n break\n}\n\nif (hum_shower > hum_bedroom + delta){\n msg.payload = "humidity_high";\n}\nelse{\n msg.payload = "humidity_low";\n}\n\nnode.status({\n text: msg.payload+ " Shower RH%: "+hum_shower.toString()+' '+"Bedroom RH%: "+hum_bedroom.toString()\n});\n\nflow.set("status", msg)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":,"x":880,"y":1700,"wires":[["47177232479a5b26","6821f545b8aab5dc"]]},{"id":"349e47940ce701c9","type":"comment","z":"eec1079e31761542","name":"Humilty Compare Master Bath/Bedroom","info":"","x":170,"y":1600,"wires":},{"id":"5aeb8c7c79249f62","type":"junction","z":"eec1079e31761542","x":620,"y":1540,"wires":[["780639dfd5ed1e48"]]},{"id":"6067e0f54f1a0cdf","type":"junction","z":"eec1079e31761542","x":1420,"y":1540,"wires":[["b1f5a9aabb5e38a1"]]},{"id":"c33123cf.c144e","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]"

Attempt 0.2 Works well

[{"id":"9414156b7cd7edf2","type":"server-state-changed","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.master_bathroom_switch_l2","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":1540,"wires":[["bed0a69ed916ce9d"]]},{"id":"bed0a69ed916ce9d","type":"switch","z":"eec1079e31761542","name":"Get User ID","property":"data.new_state.context.user_id","propertyType":"msg","rules":[{"t":"null"},{"t":"eq","v":"a14866021bce4d6eb4a71eafd19c6393","vt":"str"},{"t":"eq","v":"6a0947a3e14b4431ab2419d92c3becb0","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":510,"y":1540,"wires":[["39de9672864d8adc"],["5aeb8c7c79249f62"],["5aeb8c7c79249f62"],["a10519f0a2abd4ca"]],"outputLabels":["If UserTurned on/off(Not Null)","","",""]},{"id":"97e521f55830f414","type":"comment","z":"eec1079e31761542","name":"Master Bathroom Humilty Fan","info":"","x":140,"y":1480,"wires":[]},{"id":"a10519f0a2abd4ca","type":"switch","z":"eec1079e31761542","name":"Off triggered by Service/Automation","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":780,"y":1580,"wires":[["6ec2efbfc8e3c8be"],[]]},{"id":"39de9672864d8adc","type":"switch","z":"eec1079e31761542","name":"On triggered by Swtich                            ","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":740,"y":1500,"wires":[["c3e22abb6a15f201"]]},{"id":"780639dfd5ed1e48","type":"switch","z":"eec1079e31761542","name":"On triggered by Home Assistant User","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":790,"y":1540,"wires":[["c3e22abb6a15f201"]]},{"id":"b1f5a9aabb5e38a1","type":"api-call-service","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.master_bathroom_switch_l2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1600,"y":1540,"wires":[[]]},{"id":"c3e22abb6a15f201","type":"delay","z":"eec1079e31761542","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"30","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":1130,"y":1500,"wires":[["6067e0f54f1a0cdf"]]},{"id":"06f048bde834d5d7","type":"ha-wait-until","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":1,"outputs":1,"entityId":"input_text.master_bathroom","entityIdFilterType":"exact","property":"state","comparator":"is","value":"humidity_low","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":1300,"y":1580,"wires":[["6067e0f54f1a0cdf"]]},{"id":"19499fc08a8404da","type":"server-state-changed","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.master_bedroom_humidity","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":1660,"wires":[["21cf8b7f.cb70a4"]]},{"id":"cf6fc929bf8b8018","type":"api-call-service","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.master_bathroom_switch_l2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1440,"y":1660,"wires":[[]]},{"id":"21cf8b7f.cb70a4","type":"smooth","z":"eec1079e31761542","name":"","property":"payload","action":"mean","count":"5","round":"","mult":"single","x":500,"y":1660,"wires":[["5a86f71c.b62ea8"]]},{"id":"2712565b.cad90a","type":"smooth","z":"eec1079e31761542","name":"","property":"payload","action":"mean","count":"2","round":"","mult":"single","reduce":false,"x":500,"y":1720,"wires":[["f429a2ba.72f8"]]},{"id":"5a86f71c.b62ea8","type":"change","z":"eec1079e31761542","name":"","rules":[{"t":"set","p":"sensor","pt":"msg","to":"bedroom","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1660,"wires":[["79da652e48bbfce8"]]},{"id":"f429a2ba.72f8","type":"change","z":"eec1079e31761542","name":"","rules":[{"t":"set","p":"sensor","pt":"msg","to":"shower","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1720,"wires":[["79da652e48bbfce8"]]},{"id":"825b867e11f81776","type":"server-state-changed","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.master_bathroom_humidity","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":1720,"wires":[["2712565b.cad90a"]]},{"id":"47177232479a5b26","type":"switch","z":"eec1079e31761542","name":"On triggered by Swtich","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"humidity_high","vt":"str"},{"t":"eq","v":"humidity_low","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1200,"y":1660,"wires":[["cf6fc929bf8b8018"],[]]},{"id":"6821f545b8aab5dc","type":"api-call-service","z":"eec1079e31761542","name":"","server":"c33123cf.c144e","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.master_bathroom"],"data":"{\"value\":\"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1200,"y":1700,"wires":[[]]},{"id":"6ec2efbfc8e3c8be","type":"delay","z":"eec1079e31761542","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"10","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":1090,"y":1580,"wires":[["06f048bde834d5d7"]]},{"id":"79da652e48bbfce8","type":"function","z":"eec1079e31761542","name":"","func":"var hum_bedroom = flow.get('hum_bedroom')||30;\nvar hum_shower = flow.get('hum_shower')||30;\nvar sensor = msg.sensor;\nvar delta = 10; //set to the desired threshold level\n\nswitch(sensor){\n    case \"bedroom\":\n        flow.set(\"hum_bedroom\", msg.payload);\n        break\n        \n    case \"shower\":\n        flow.set(\"hum_shower\", msg.payload);\n        break\n}\n\nif (hum_shower > hum_bedroom + delta){\n    msg.payload = \"humidity_high\";\n}\nelse{\n    msg.payload = \"humidity_low\";\n}\n\nnode.status({\n    text: msg.payload+ \" Shower RH%: \"+hum_shower.toString()+' '+\"Bedroom RH%: \"+hum_bedroom.toString()\n});\n\nflow.set(\"status\", msg)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":1700,"wires":[["47177232479a5b26","6821f545b8aab5dc"]]},{"id":"349e47940ce701c9","type":"comment","z":"eec1079e31761542","name":"Humilty Compare Master Bath/Bedroom","info":"","x":170,"y":1600,"wires":[]},{"id":"5aeb8c7c79249f62","type":"junction","z":"eec1079e31761542","x":620,"y":1540,"wires":[["780639dfd5ed1e48"]]},{"id":"6067e0f54f1a0cdf","type":"junction","z":"eec1079e31761542","x":1420,"y":1540,"wires":[["b1f5a9aabb5e38a1"]]},{"id":"c33123cf.c144e","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]