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