I've searched this forum and the flows library and drawing a blank to this simple problem.
Using a momentary pushbutton, I can toggle the output on/off with each push.
Now I would like to add a timer to turn off the light if someone leaves it on.
The trigger node works for this function but the push button will have to be pressed twice to turn the light back on if the trigger node turned it off.
Trying to find a way to eliminate the extra button push to get back in sync with the output.
[{"id":"6c4e53bf.97148c","type":"subflow","name":"Toggle 1/0","info":"","category":"","in":[{"x":60,"y":180,"wires":[{"id":"5047f5ea.66c1ec"}]}],"out":[{"x":780,"y":160,"wires":[{"id":"82ff5a1a.efefc8","port":0},{"id":"26637948.29d256","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"7347b78.8b23848","type":"switch","z":"6c4e53bf.97148c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":180,"wires":[["82ff5a1a.efefc8"],["26637948.29d256"]]},{"id":"82ff5a1a.efefc8","type":"change","z":"6c4e53bf.97148c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"str"},{"t":"set","p":"next","pt":"flow","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":140,"wires":[[]]},{"id":"26637948.29d256","type":"change","z":"6c4e53bf.97148c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"str"},{"t":"set","p":"next","pt":"flow","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":200,"wires":[[]]},{"id":"5047f5ea.66c1ec","type":"function","z":"6c4e53bf.97148c","name":"get next value","func":"msg.payload = flow.get(\"next\")||0;\nreturn msg;","outputs":1,"noerr":0,"x":200,"y":180,"wires":[["7347b78.8b23848"]]},{"id":"63d63c99.01ce24","type":"rpi-gpio out","z":"29688e2c.d40952","name":"Inside Lights 1","pin":"12","set":"","level":"0","freq":"","out":"out","x":700,"y":160,"wires":[]},{"id":"f843202a.e1d73","type":"subflow:6c4e53bf.97148c","z":"29688e2c.d40952","name":"","env":[],"x":470,"y":140,"wires":[["63d63c99.01ce24"]]},{"id":"a358c971.574ff8","type":"ui_button","z":"29688e2c.d40952","name":"","group":"d95eee3.582311","order":0,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":290,"y":160,"wires":[["f843202a.e1d73","a6df00a9.c7179"]]},{"id":"a6df00a9.c7179","type":"trigger","z":"29688e2c.d40952","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":480,"y":180,"wires":[["63d63c99.01ce24"]]},{"id":"d95eee3.582311","type":"ui_group","z":"","name":"Default","tab":"943e4ae0.008958","disp":true,"width":"6","collapse":false},{"id":"943e4ae0.008958","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]