I have project, but when I do deployed counter reset to 0, but timer switch not reset.
- I would like when I do deployed value counter not change
- timer switch reset counter per times
[{"id":"7f5ecbe2.d53fe4","type":"comment","z":"38efc9c1.772896","name":"Licznik T-element","info":"","x":380,"y":240,"wires":[]},{"id":"e09a7ab7.3a8b48","type":"Datahub Subscribe","z":"38efc9c1.772896","name":"T_element","natc":"747c3a22.736474","topicname":"devicehub.raw.80E89505-B9A2-433B-9E6B-F68AA6BE933A.C6824DD5-A222-4218-B2CD-36F92E41403E","x":300,"y":340,"wires":[["feb21a3d.c68468"]]},{"id":"4d294fa6.8e39","type":"inject","z":"38efc9c1.772896","name":"Power on reset","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":1100,"y":280,"wires":[["59309fe9.aec7c","83fd1130.4599e"]]},{"id":"59309fe9.aec7c","type":"function","z":"38efc9c1.772896","name":"Reset Variable","func":"flow.set('count', function(err, count) {\n if (err) {\n node.error(err, msg);\n } else {\n // initialise the counter to 0 if it doesn't exist already\n count = count || 0;\n count += 1;\n // store the value back\n context.set('count',count, function(err) {\n if (err) {\n node.error(err, msg);\n } else {\n // make it part of the outgoing msg object\n msg.count = count;\n // send the message\n node.status({fill:\"blue\",shape:\"dot\",text: msg.payload});\n return msg;\n }\n });\n }\n});","outputs":1,"noerr":0,"x":1225,"y":220,"wires":[[]]},{"id":"83fd1130.4599e","type":"ui_gauge","z":"38efc9c1.772896","name":"KIL1","group":"17f4b089.05562f","order":1,"width":"0","height":"0","gtype":"gage","title":"","label":"people","format":"{{value}}","min":0,"max":"1000","colors":["#ff0000","#ffff00","#008000"],"seg1":"500","seg2":"800","x":1240,"y":340,"wires":[]},{"id":"b40856dd.d76258","type":"timerswitch","z":"38efc9c1.772896","name":"","ontopic":"","offtopic":"","onpayload":"0","offpayload":"1","disabled":false,"schedules":[{"on_h":"13","on_m":"00","on_s":"00","off_h":"13","off_m":"00","off_s":"01","valid":true},{"on_h":"21","on_m":"00","on_s":"00","off_h":"21","off_m":"00","off_s":"01","valid":true},{"on_h":"05","on_m":"00","on_s":"00","off_h":"05","off_m":"00","off_s":"01","valid":true}],"x":1100,"y":180,"wires":[["59309fe9.aec7c"]]},{"id":"e77a21a1.3780e","type":"json","z":"38efc9c1.772896","name":"JSON to Object","property":"payload","action":"obj","pretty":false,"x":460,"y":340,"wires":[["f64e53f7.cb911","d700ad09.0ee73"]]},{"id":"d700ad09.0ee73","type":"function","z":"38efc9c1.772896","name":"NewName_SL","func":" const myObj = msg.payload;\n const text = myObj.tagName;\n \n\t\tif(text.startsWith(\"0#\") == true){\n\t\t\n\t\t\t//dla wartości 0#\n\t\t\t const restText = text.substr(\"0#\".length);\n\t\t myObj.tagName = restText;\n\t\t\tmyObj.value = myObj.value/1;\n\t\t\tmsg.payload = myObj;\n\t\t return msg;\n\t\t\t}\n else if(text.startsWith(\"1#\") == true){\n\t\t\n\t\t\t//dla wartości 1# - dzielenie wartości przez 10\n\t\t \tconst restText = text.substr(\"1#\".length);\n\t\t myObj.tagName = restText;\n\t\t\tmyObj.value = myObj.value/10;\n\t\t\tmsg.payload = myObj;\n\t\t return msg;\n\t\t\t}\n\t\telse if(text.startsWith(\"2#\") == true){\n\t\t\n\t\t\t//dla wartości 2# - dzielenie wartości przez 100\n\t\t \tconst restText = text.substr(\"2#\".length);\n\t\t myObj.tagName = restText;\n\t\t\tmyObj.value = myObj.value/100;\n\t\t\tmsg.payload = myObj;\n\t\t return msg;\n\t\t\t}\n\t\telse if(text.startsWith(\"3#\") == true){\n\t\t\n\t\t\t//dla wartości 3# - dzielenie wartości przez 1000\n\t\t \tconst restText = text.substr(\"3#\".length);\n\t\t myObj.tagName = restText;\n\t\t\tmyObj.value = myObj.value/1000;\n\t\t\tmsg.payload = myObj;\n\t\t return msg;\n\t\t\t}\n\t\telse if(text.startsWith(\"#\", 1 ) == false){\n\t\t\n\t\t\t//brak przedrostka\n\t\t\tmsg.payload = myObj;\n\t\t\treturn msg;\n\t\t }","outputs":1,"noerr":0,"x":585,"y":340,"wires":[["a658672c.9f8ea8","4608966f.5ac0f8"]]},{"id":"a658672c.9f8ea8","type":"function","z":"38efc9c1.772896","name":"TagTab","func":"const myObj = msg.payload;\nconst val = JSON.parse(myObj.value);\nconst top = myObj.tagName;\n\n msg.topic = \"KIL1/SK\";\n msg.payload = val;\n return msg;","outputs":1,"noerr":0,"x":705,"y":340,"wires":[["c4c99983.720748"]]},{"id":"4608966f.5ac0f8","type":"debug","z":"38efc9c1.772896","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":780,"y":260,"wires":[]},{"id":"feb21a3d.c68468","type":"rbe","z":"38efc9c1.772896","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload","x":385,"y":340,"wires":[["e77a21a1.3780e"]]},{"id":"f31ca097.59c4a","type":"function","z":"38efc9c1.772896","name":"counter_MQTT","func":"const myObj = msg.payload;\nconst tmp = \"Licznik_T_element\";\n\n //aby wyswietlac dane tylko z danego sterownika do MQTT\nmsg.topic = \"KIL1/SK\";\n\nlet text = {};\nlet text1 = {};\n\n\n let mykey = tmp; \n text[mykey] = myObj;\n \n text1 = JSON.stringify([text]);\n let obiekt = JSON.parse(text1);\n \n msg.payload = obiekt;\n // send the message\n node.status({fill:\"blue\",shape:\"dot\",text: msg.payload});\n return msg;","outputs":1,"noerr":0,"x":885,"y":180,"wires":[["2c57d3c9.96387c"]]},{"id":"f64e53f7.cb911","type":"debug","z":"38efc9c1.772896","name":"","active":false,"console":"false","complete":"false","x":560,"y":260,"wires":[]},{"id":"c4c99983.720748","type":"function","z":"38efc9c1.772896","name":"contex count","func":"flow.get('count', function(err, count) {\n if (err) {\n node.error(err, msg);\n } else {\n // initialise the counter to 0 if it doesn't exist already\n count = flow.get(\"count\") || 0;\n count += msg.payload;\n count = Math.max(count,0);\n // store the value back\n flow.set(\"count\", count);\n context.set('count',count, function(err) {\n if (err) {\n node.error(err, msg);\n } else {\n // make it part of the outgoing msg object\n msg.payload=count;\n // send the message\n node.status({fill:\"blue\",shape:\"dot\",text: msg.payload});\n //return msg;\n }\n });\n }\n});\n\n\n//msg.payload;\n//return msg;","outputs":1,"noerr":0,"x":805,"y":340,"wires":[["f31ca097.59c4a","83fd1130.4599e"]]},{"id":"cff667d.e46b898","type":"debug","z":"38efc9c1.772896","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1060,"y":100,"wires":[]},{"id":"2c57d3c9.96387c","type":"rbe","z":"38efc9c1.772896","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload","x":965,"y":180,"wires":[["cff667d.e46b898"]]},{"id":"747c3a22.736474","type":"Datahub Connect","z":"","ipadd":"127.0.0.1","port":"4222"},{"id":"17f4b089.05562f","type":"ui_group","z":"","name":"Shot","tab":"4249a244.3fe8ac","order":4,"disp":true,"width":"6","collapse":false},{"id":"4249a244.3fe8ac","type":"ui_tab","z":"","name":"HOME","icon":"dashboard","order":1,"disabled":false,"hidden":false}]