Numeric input state

Hi everyone !

I am working on a project, and i have some problem ... I want to set a numeric input state to disable or enable with a switch but hold the value . Could someone help me?The saved value is stored on a file and load from there with the load/save button .... The method i want to use is working with the switch ui element ,but not with the input .

[{"id":"1de98200.aa1a7e","type":"file in","z":"f332f131.f2472","name":"","filename":"\\Users\\user\\.node-red\\data\\test.log","format":"lines","chunk":false,"sendError":false,"x":280,"y":180,"wires":[["37982fa.67cb4d"]]},{"id":"3d7161a8.175a9e","type":"inject","z":"f332f131.f2472","name":"LOAD LAST STATE","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":100,"wires":[["1de98200.aa1a7e"]]},{"id":"42bd7ec5.08603","type":"ui_button","z":"f332f131.f2472","name":"","group":"c5238e7d.2a1a","order":4,"width":"12","height":"1","passthru":false,"label":"Load ","tooltip":"previous Save","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":130,"y":240,"wires":[["1de98200.aa1a7e"]]},{"id":"37982fa.67cb4d","type":"json","z":"f332f131.f2472","name":"","property":"payload","action":"","pretty":false,"x":530,"y":180,"wires":[["5ba8b736.eb25b8","eeff6a7e.31a7b8"]]},{"id":"5ba8b736.eb25b8","type":"change","z":"f332f131.f2472","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.6","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":220,"wires":[["b84b7468.110108"]]},{"id":"b84b7468.110108","type":"ui_switch","z":"f332f131.f2472","name":"","label":"Auto mode","tooltip":"Off=manual,On =Auto","group":"c5238e7d.2a1a","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"auto","onvalueType":"str","onicon":"","oncolor":"","offvalue":"manual","offvalueType":"str","officon":"","offcolor":"","x":730,"y":300,"wires":[["95143eee.5a048"]]},{"id":"95143eee.5a048","type":"switch","z":"f332f131.f2472","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"auto","vt":"str"},{"t":"eq","v":"manual","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":870,"y":300,"wires":[["c845b1ca.6d95e","e04dc781.81b0f8"],["e8b8996b.e9b908","fc2e4fe9.b9fc3"]]},{"id":"c845b1ca.6d95e","type":"change","z":"f332f131.f2472","name":"Manual_en_f","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":60,"wires":[[]]},{"id":"e8b8996b.e9b908","type":"change","z":"f332f131.f2472","name":"Manual_en_t","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":100,"wires":[[]]},{"id":"e04dc781.81b0f8","type":"change","z":"f332f131.f2472","name":"Auto_en_t","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":320,"wires":[["f266cb28.d99508"]]},{"id":"fc2e4fe9.b9fc3","type":"change","z":"f332f131.f2472","name":"Auto_en_f","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":280,"wires":[["f266cb28.d99508"]]},{"id":"f266cb28.d99508","type":"ui_numeric","z":"f332f131.f2472","name":"","label":"Temperature:","tooltip":"","group":"829d8d43.00e61","order":0,"width":0,"height":0,"passthru":true,"topic":"","format":"{{value}} &deg","min":"-20","max":"50","step":1,"x":1190,"y":160,"wires":[["25c06473.8dd63c"]]},{"id":"eeff6a7e.31a7b8","type":"change","z":"f332f131.f2472","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.7","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":160,"wires":[["f266cb28.d99508"]]},{"id":"25c06473.8dd63c","type":"change","z":"f332f131.f2472","name":"","rules":[{"t":"set","p":"Data.7","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1430,"y":160,"wires":[[]]},{"id":"8a80c398.e75f","type":"ui_button","z":"f332f131.f2472","name":"","group":"c5238e7d.2a1a","order":3,"width":"12","height":"1","passthru":false,"label":"Save","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":110,"y":540,"wires":[["c204ad26.afd74"]]},{"id":"7fb2fdfc.5c7da4","type":"file","z":"f332f131.f2472","name":"","filename":"\\Users\\user\\.node-red\\data\\test.log","appendNewline":false,"createDir":false,"overwriteFile":"true","x":560,"y":460,"wires":[[]]},{"id":"2e8e95b8.4b140a","type":"json","z":"f332f131.f2472","name":"","property":"payload","action":"","pretty":false,"x":330,"y":460,"wires":[["7fb2fdfc.5c7da4","7897386b.1e4348"]]},{"id":"c204ad26.afd74","type":"function","z":"f332f131.f2472","name":"","func":"var msg={};\nmsg.payload=global.get(\"Data\");\nreturn msg;","outputs":1,"noerr":0,"x":190,"y":460,"wires":[["2e8e95b8.4b140a"]]},{"id":"8fd8dec7.15476","type":"inject","z":"f332f131.f2472","name":"SAVE CURRENT STATE","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":380,"wires":[["c204ad26.afd74"]]},{"id":"7897386b.1e4348","type":"debug","z":"f332f131.f2472","name":"SAVE","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":490,"y":520,"wires":[]},{"id":"c5238e7d.2a1a","type":"ui_group","z":"","name":"MANUAL/AUTO","tab":"52b04880.62c1d8","order":1,"disp":false,"width":"24","collapse":false},{"id":"829d8d43.00e61","type":"ui_group","z":"","name":"Auto Controll","tab":"52b04880.62c1d8","order":4,"disp":true,"width":"6","collapse":false},{"id":"52b04880.62c1d8","type":"ui_tab","z":"","name":"Control","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

You have a big flow there.I'm not sure I understand what tthe issue is.

Is it the fact that the temperature starts at -20, but if you prss the inject node toset it to 20 and then when you hit the auto save button it goes back to -20?

Yes , if i hit the save and then the load button it goes back to -20 ,it works , if i delete this part : image
In my project there will be 2 mode (auto and a manual) controlling tab. I want to save the input data and then load it back

If you just disconnect the wires to the Auto_en_t nodes it seems to work fine.

No , it not works for me. The Temperature input node will not be enabled at all.

I updated the code , and the topic to be clear.

I am still looking for some help :confused: I modified the code what was in the first comment to be simply .Could someone give me some help about it? I have no ide how to solve it ...

Ok, I figured out what is happening and it all revolves around a line in the description of the numeric ui node:

Any input messages will be converted to a number, the min value will be used if conversion fails, and it will update the user interface. If the value changes, it will also be passed to the output.

Now go and add a debug node to the output of every node that sends something to your Temperature ui node . What do you see?