Retain slider data

I'm using the code below in a function to control heat on and heat off. It works for one on/off cycle but not a second one unless you move the slider input. I send a sync msg every 30 seconds that triggers the remote temperature sensors to report their temps. Is there a way to retain the set temperature or possibly trigger it with the sync pulse as well.

m = msg.payload;
t = msg.topic;
t2 = 'testTopic';
if (t == 'set_hi')
{H = m;}
{L = (m - 1.5)}
if (t == 'temp_fla')
{temp_fla = parseFloat(m)}
if (temp_fla < L)
{
return {topic: t2, payload: "relay 6 on" };
}
else if (temp_fla > H )
{
return {topic: t2, payload: "relay 6 off"};
}

[{"id":"fd273802.758b68","type":"function","z":"273f3321.930bdc","name":"","func":"m = msg.payload;\nt = msg.topic;\nt2 = 'testTopic';\nif (t == 'set_hi')\n{H = m;}\n{L = (m - 1.5)}\nif (t == 'temp_fla')\n{temp_fla = parseFloat(m)}\nif (temp_fla < L)\n{\nreturn {topic: t2, payload: \"relay 6 on\" };\n}\nelse if (temp_fla > H )\n{\nreturn {topic: t2, payload: \"relay 6 off\"};\n}","outputs":1,"noerr":0,"x":550,"y":860,"wires":[["73cbdf7c.a619a","30e07356.73b74c"]]},{"id":"30e07356.73b74c","type":"debug","z":"273f3321.930bdc","name":"test2","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":750,"y":820,"wires":[]},{"id":"73cbdf7c.a619a","type":"mqtt out","z":"273f3321.930bdc","name":"test","topic":"","qos":"","retain":"","broker":"a0daec91.c9a4e","x":750,"y":900,"wires":[]},{"id":"4a27bc0c.52da04","type":"debug","z":"273f3321.930bdc","name":"temps","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":370,"y":880,"wires":[]},{"id":"614af900.a64888","type":"ui_switch","z":"273f3321.930bdc","name":"","label":"Auto Heat","tooltip":"","group":"374e9b2e.f2f1a4","order":8,"width":"4","height":1,"passthru":true,"decouple":"false","topic":"gate","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":140,"y":700,"wires":[["d6576ffa.9e274","731c9867.c9b218"]]},{"id":"d6576ffa.9e274","type":"function","z":"273f3321.930bdc","name":"control","func":"if (msg.topic === \"gate\") {\n    context.pass = (msg.payload === true) ? true : false;\n    return null;  // exit out early as it's just the control\n}\nif (context.pass) {\n    return msg; // if enabled pass msg\n}\nreturn null; // or drop it","outputs":1,"noerr":0,"x":410,"y":780,"wires":[["85450665.2c5138","fd273802.758b68"]]},{"id":"85450665.2c5138","type":"debug","z":"273f3321.930bdc","name":"test1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":750,"y":740,"wires":[]},{"id":"731c9867.c9b218","type":"debug","z":"273f3321.930bdc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":490,"y":700,"wires":[]},{"id":"c5f7fa6f.63ad18","type":"mqtt in","z":"273f3321.930bdc","name":"","topic":"temp_fla","qos":"2","datatype":"auto","broker":"a0daec91.c9a4e","x":140,"y":880,"wires":[["d6576ffa.9e274","4a27bc0c.52da04"]]},{"id":"a95266e5.2f4048","type":"ui_slider","z":"273f3321.930bdc","name":"set high","label":"set high","tooltip":"","group":"c297bd45.20f95","order":1,"width":"6","height":"1","passthru":true,"outs":"end","topic":"set_hi","min":"65","max":"75","step":".1","x":140,"y":760,"wires":[["d6576ffa.9e274"]]},{"id":"cf0007a9.9b0568","type":"ui_slider","z":"273f3321.930bdc","name":"set low","label":"set low","tooltip":"","group":"c297bd45.20f95","order":1,"width":"6","height":"1","passthru":true,"outs":"end","topic":"set_lo","min":"65","max":"75","step":".1","x":140,"y":820,"wires":[["d6576ffa.9e274"]]},{"id":"a0daec91.c9a4e","type":"mqtt-broker","z":"","name":"pi4_mqtt","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"374e9b2e.f2f1a4","type":"ui_group","z":"","name":"Group 2","tab":"98d496.1ca73b68","order":2,"disp":true,"width":16,"collapse":false},{"id":"c297bd45.20f95","type":"ui_group","z":"","name":"Group 3","tab":"98d496.1ca73b68","order":3,"disp":true,"width":"9","collapse":false},{"id":"98d496.1ca73b68","type":"ui_tab","z":"273f3321.930bdc","name":"Tab 1","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

Have you looked at Context? Working with context : Node-RED

Thanks... that did the trick