How to determine source of an event for manual override?

I have a smart switch that controls an exhaust fan. I have a flow that compares outside temp to inside temp and if the outside is cooler than inside it turns the fan on. My issue is this - I want to allow the switch to manually override the automatic if the manual switch is used. Currently if I turn the switch on manually the automatic flow will turn it off as soon as it gets the next temp reading.

Is there a way to determine if a switch was switched manually or via a flow? Or does anyone have any idea how I could store a variable that would tell me if it is in manual mode?

When the switch is switched manually the payload looks identical to a flow switch on.

Give a try to node-red-contrib-smartswitch is working eally well, regarding the override you can set a normal flow node switch write the starte of the sdmartswitch and on the same time write a global variable that enable/disable the flow from the tempreature command coming to set on/off the smart switch with a normal switch node.

Hope I explained properly the idea.

I don’t knwo if this is what u wanted, whenever manual switch is in off then control will be on automatic coming from temp readings, if manual switch is turned on only out will be forced out until the is disabled and will not take care about the auto control until you switch it back off

[{"id":"228825ed.d655aa","type":"smartswitch","z":"c1bcf04c.5b249","name":"switch","topic":"main","timeout":"0","x":570.0000076293945,"y":972.5000152587891,"wires":[["78d7ca31.021be4"]]},{"id":"84033dfb.0b1d4","type":"ui_switch","z":"c1bcf04c.5b249","name":"","label":"Manual on/off override","group":"b2d19f3c.4d5cb","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"state","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":257.5,"y":907.5000133514404,"wires":[["228825ed.d655aa","ac46c31f.f112d"]]},{"id":"b4bb7f24.ec8f9","type":"inject","z":"c1bcf04c.5b249","name":"from temp control on","topic":"state","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":177.5,"y":968.7500152587891,"wires":[["6be9af4.bfe075"]]},{"id":"f6057c54.61746","type":"inject","z":"c1bcf04c.5b249","name":"from temp control off","topic":"state","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":183.75,"y":1012.5000152587891,"wires":[["6be9af4.bfe075"]]},{"id":"6be9af4.bfe075","type":"switch","z":"c1bcf04c.5b249","name":"","property":"override","propertyType":"global","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":380.00000381469727,"y":971.2500152587891,"wires":[["228825ed.d655aa"]]},{"id":"1e9396a7.7738d9","type":"change","z":"c1bcf04c.5b249","name":"global override","rules":[{"t":"set","p":"override","pt":"global","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":662.5000076293945,"y":870.0000133514404,"wires":[[]]},{"id":"ac46c31f.f112d","type":"switch","z":"c1bcf04c.5b249","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":480.00000762939453,"y":891.2500133514404,"wires":[["1e9396a7.7738d9"],["e62a5715.e712f8"]]},{"id":"e62a5715.e712f8","type":"change","z":"c1bcf04c.5b249","name":"global override","rules":[{"t":"set","p":"override","pt":"global","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":665,"y":910,"wires":[[]]},{"id":"78d7ca31.021be4","type":"debug","z":"c1bcf04c.5b249","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":736.25,"y":970,"wires":[]},{"id":"b2d19f3c.4d5cb","type":"ui_group","z":"","name":"Default","tab":"b15f41eb.87518","disp":true,"width":"7","collapse":false},{"id":"b15f41eb.87518","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

if is not exactly this for sure will give you the key to develope urself what u wanted.

Regards

You can also do this without downloading any new nodes.

Create a flow when your switch goes manually to on that sets the value of either a flow or global variable and then use a function or switch node to check that variable before proceeding. Here is a sample flow:

[{"id":"dd1d63f1.819888","type":"switch","z":"1adf39a8.3dc096","name":"Is Manual Mode On?","property":"manual.switch.status","propertyType":"flow","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":460,"y":240,"wires":[["50dc1991.28bbc8"]]},{"id":"6bd17d4e.0e821c","type":"inject","z":"1adf39a8.3dc096","name":"","topic":"Switch Monitor","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":140,"wires":[["bd46cfef.45bcb8"]]},{"id":"bd46cfef.45bcb8","type":"switch","z":"1adf39a8.3dc096","name":"Switch Status","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":140,"wires":[["416a96cc.32f94"],["2d74eeee.ffda82"]]},{"id":"416a96cc.32f94","type":"change","z":"1adf39a8.3dc096","name":"Set Variable To On","rules":[{"t":"set","p":"manual.switch.status","pt":"flow","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":100,"wires":[[]]},{"id":"2d74eeee.ffda82","type":"change","z":"1adf39a8.3dc096","name":"Set Variable To Off","rules":[{"t":"set","p":"manual.switch.status","pt":"flow","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":160,"wires":[[]]},{"id":"fffbc1.43c46c4","type":"inject","z":"1adf39a8.3dc096","name":"Your Temp Automation Trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":240,"wires":[["dd1d63f1.819888"]]},{"id":"50dc1991.28bbc8","type":"debug","z":"1adf39a8.3dc096","name":"Run The Rest of Automation","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":720,"y":240,"wires":[]},{"id":"7ff17896.35ca3","type":"comment","z":"1adf39a8.3dc096","name":"Sets the Flow or Global Variable","info":"","x":210,"y":80,"wires":[]},{"id":"365c7fc1.2c266","type":"comment","z":"1adf39a8.3dc096","name":"Insert this into your flow automation","info":"","x":480,"y":300,"wires":[]}]```

Fantastic - Thank you both - what a great community!! this is the first time I’ve posted and two fast great responses. Thanks again.

I was able to get an acceptable solution using your suggestions. i can now set a variable when the logic triggers the on switch. When I get the indicator that the switch was turned on i check the variable to see if it was triggered by logic or not. If not logic then I set the variable to manual and then set a delay timer to limit how long before I return it to auto.

Thanks!!!

1 Like