How to update the iconColor of the worldmap location with a Switch?

Hello,

I'm trying to change the pre-marked location iconColor with the input receiving via MQTT. All the relevant messages are receiving correctly to the correct locations which I have checked them using debug node.

But sadly it doesn't work properly. Global variables are updating properly but to witness the color change I have to inject. That is not what I expect. I want to change the icon color directly from the Switch. I couldn't figure out the correct way to solve this issue in my flow though I tried several times. :tired_face:

I think that this is may be due to the Inject node which is there before the worldmap node. But I'm not sure the way to fix this. :thinking:

This is my first complex (to me) flow in node-red. :slightly_smiling_face: Kindly help me. I have shared the export of my working flow below.

Thank you.

[{"id":"72b5a119.cca8a","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"d6a1111a.387b1","type":"ui_switch","z":"72b5a119.cca8a","name":"","label":"switch","tooltip":"","group":"5dfea3d9.7d09bc","order":0,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"emspe3593/SS/status/SS1","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":70,"y":40,"wires":[["a6dc2b31.af70c8","5f121ea6.03851"]],"outputLabels":["1"]},{"id":"a6dc2b31.af70c8","type":"debug","z":"72b5a119.cca8a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":210,"y":100,"wires":[]},{"id":"70518ccc.f9f994","type":"debug","z":"72b5a119.cca8a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":230,"y":140,"wires":[]},{"id":"ea4c0462.6706e8","type":"debug","z":"72b5a119.cca8a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":140,"wires":[]},{"id":"3138505f.2a054","type":"debug","z":"72b5a119.cca8a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":230,"y":260,"wires":[]},{"id":"5f121ea6.03851","type":"mqtt out","z":"72b5a119.cca8a","name":"pub","topic":"","qos":"0","retain":"","broker":"e62d40f1.a1cc8","x":190,"y":40,"wires":[]},{"id":"657f8222.11dbdc","type":"mqtt in","z":"72b5a119.cca8a","name":"sub","topic":"emspe3593/SS/+/SS1","qos":"0","broker":"e62d40f1.a1cc8","x":70,"y":140,"wires":[["70518ccc.f9f994","957e6ed5.75f69"]]},{"id":"83c4040e.036408","type":"worldmap","z":"72b5a119.cca8a","name":"","lat":"","lon":"","zoom":"11","layer":"OSM","cluster":"4","maxage":"","usermenu":"hide","layers":"hide","panit":"true","panlock":"false","path":"","x":450,"y":340,"wires":[]},{"id":"f492d89c.45f538","type":"function","z":"72b5a119.cca8a","name":"Add SS1","func":"var SS1 = global.get('SS1');//define global var for SS1\nSS1  =  {\n    name:\"SS1 : Kurunegala\", \n    lat:7.486944, \n    lon:80.365045,\n    icon:\"tag\",\n    iconColor:\"dark\",\n    extrainfo:\"Hello ! this is station 1\"\n};\n//msg.payload= SS1;\nglobal.set('SS1',SS1);\n\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":340,"wires":[["83c4040e.036408","e29a212e.2f80e"]]},{"id":"957e6ed5.75f69","type":"switch","z":"72b5a119.cca8a","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":210,"y":180,"wires":[["ea4c0462.6706e8","78df71b9.1fc4e"],["3138505f.2a054","cf753cb4.e564b"]]},{"id":"e29a212e.2f80e","type":"debug","z":"72b5a119.cca8a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":400,"wires":[]},{"id":"78df71b9.1fc4e","type":"function","z":"72b5a119.cca8a","name":"ON","func":"var SS1 = global.get('SS1');\nvar list = Object.keys(SS1.iconColor=\"green\");\n//node.log(\"red works\");\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":180,"wires":[["d656ca6e.084718","83c4040e.036408"]]},{"id":"d656ca6e.084718","type":"debug","z":"72b5a119.cca8a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":180,"wires":[]},{"id":"698b9a81.2b7064","type":"inject","z":"72b5a119.cca8a","name":"","topic":"","payload":"SS1","payloadType":"global","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":340,"wires":[["f492d89c.45f538"]]},{"id":"cf753cb4.e564b","type":"function","z":"72b5a119.cca8a","name":"OFF","func":"var SS1 = global.get('SS1');\nvar list = Object.keys(SS1.iconColor=\"red\");\n//node.log(\"red works\");\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":220,"wires":[["a82d7842.51a948","83c4040e.036408"]]},{"id":"a82d7842.51a948","type":"debug","z":"72b5a119.cca8a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":220,"wires":[]},{"id":"c7cca944.996168","type":"inject","z":"72b5a119.cca8a","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":90,"y":460,"wires":[["132ee5fe.51100a"]]},{"id":"e14bad09.53754","type":"ui_template","z":"72b5a119.cca8a","group":"5dfea3d9.7d09bc","name":"","order":2,"width":"6","height":"8","format":"<div ng-bind-html=\"msg.payload | trusted\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":440,"y":460,"wires":[[]]},{"id":"132ee5fe.51100a","type":"template","z":"72b5a119.cca8a","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src=\"../worldmap\" height=450px width =500px ></iframe>","x":240,"y":460,"wires":[["e14bad09.53754"]]},{"id":"5dfea3d9.7d09bc","type":"ui_group","z":"","name":"ON/OFF","tab":"8a224921.f40138","disp":false,"width":"6","collapse":false},{"id":"e62d40f1.a1cc8","type":"mqtt-broker","z":"","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"8a224921.f40138","type":"ui_tab","z":"","name":"Station Status","icon":"dashboard","disabled":false,"hidden":false}]

As per the info tab on the right - the worldmap expect a msg.payload in that contains the correct properties... so you need to move your global object (SS1) to msg.payload .

Secondly, your functions don't actually update the SS1 object at all.

[{"id":"b23ac93d.e59928","type":"ui_switch","z":"7faf16f4.f02bf8","name":"","label":"switch","tooltip":"","group":"20eb736d.1f02ec","order":0,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"emspe3593/SS/status/SS1","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":70,"y":40,"wires":[["4e011ec0.8eb96","95ce1724.802e78"]],"outputLabels":["1"]},{"id":"4e011ec0.8eb96","type":"debug","z":"7faf16f4.f02bf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":210,"y":100,"wires":[]},{"id":"eeb9de6.917d32","type":"debug","z":"7faf16f4.f02bf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":230,"y":140,"wires":[]},{"id":"e78f29e.162a6d8","type":"debug","z":"7faf16f4.f02bf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":140,"wires":[]},{"id":"9bc1813.553228","type":"debug","z":"7faf16f4.f02bf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":230,"y":260,"wires":[]},{"id":"95ce1724.802e78","type":"mqtt out","z":"7faf16f4.f02bf8","name":"pub","topic":"","qos":"0","retain":"","broker":"8f24b48d.99d0f8","x":190,"y":40,"wires":[]},{"id":"8dfc8023.8f859","type":"mqtt in","z":"7faf16f4.f02bf8","name":"sub","topic":"emspe3593/SS/+/SS1","qos":"0","broker":"8f24b48d.99d0f8","x":70,"y":140,"wires":[["eeb9de6.917d32","d4385da2.dbddc"]]},{"id":"82fefb36.15c118","type":"worldmap","z":"7faf16f4.f02bf8","name":"","lat":"","lon":"","zoom":"11","layer":"OSM","cluster":"4","maxage":"","usermenu":"hide","layers":"hide","panit":"true","panlock":"false","path":"","x":590,"y":340,"wires":[]},{"id":"879eaf11.b2089","type":"function","z":"7faf16f4.f02bf8","name":"Add SS1","func":"var SS1 = global.get('SS1');//define global var for SS1\nSS1  =  {\n    name:\"SS1 : Kurunegala\", \n    lat:7.486944, \n    lon:80.365045,\n    icon:\"tag\",\n    iconColor:\"dark\",\n    extrainfo:\"Hello ! this is station 1\"\n};\nmsg.payload= SS1;\nglobal.set('SS1',SS1);\n\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":340,"wires":[["c6c91d2b.18c3d","82fefb36.15c118"]]},{"id":"d4385da2.dbddc","type":"switch","z":"7faf16f4.f02bf8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":210,"y":180,"wires":[["e78f29e.162a6d8","bbb39752.ca0988"],["9bc1813.553228","f187557b.a73df8"]]},{"id":"c6c91d2b.18c3d","type":"debug","z":"7faf16f4.f02bf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":400,"wires":[]},{"id":"bbb39752.ca0988","type":"function","z":"7faf16f4.f02bf8","name":"ON","func":"var SS1 = global.get('SS1');\nSS1.iconColor=\"green\";\n\nmsg.payload = SS1;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":180,"wires":[["76542416.e6cdcc","82fefb36.15c118"]]},{"id":"76542416.e6cdcc","type":"debug","z":"7faf16f4.f02bf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":180,"wires":[]},{"id":"3a1f35f0.b7a14a","type":"inject","z":"7faf16f4.f02bf8","name":"","topic":"","payload":"SS1","payloadType":"global","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":340,"wires":[["879eaf11.b2089"]]},{"id":"f187557b.a73df8","type":"function","z":"7faf16f4.f02bf8","name":"OFF","func":"var SS1 = global.get('SS1');\nSS1.iconColor=\"red\";\nmsg.payload = SS1;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":220,"wires":[["d957b425.c60ac8","82fefb36.15c118"]]},{"id":"d957b425.c60ac8","type":"debug","z":"7faf16f4.f02bf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":220,"wires":[]},{"id":"1bda9066.f8f03","type":"inject","z":"7faf16f4.f02bf8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":90,"y":460,"wires":[["35864007.be8b5"]]},{"id":"2d26c3e0.29e6ec","type":"ui_template","z":"7faf16f4.f02bf8","group":"20eb736d.1f02ec","name":"","order":2,"width":"6","height":"8","format":"<div ng-bind-html=\"msg.payload | trusted\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":440,"y":460,"wires":[[]]},{"id":"35864007.be8b5","type":"template","z":"7faf16f4.f02bf8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src=\"../worldmap\" height=450px width =500px ></iframe>","x":240,"y":460,"wires":[["2d26c3e0.29e6ec"]]},{"id":"20eb736d.1f02ec","type":"ui_group","z":"","name":"ON/OFF","tab":"a3d58218.904ef","disp":false,"width":"6","collapse":false},{"id":"8f24b48d.99d0f8","type":"mqtt-broker","z":"","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"a3d58218.904ef","type":"ui_tab","z":"","name":"Station Status","icon":"dashboard","disabled":false,"hidden":false}]

Though you may not need to use global context at all unless you need to for some reason not stated. The MQTT broker can retain the value of the switch - and that can be used to set the iconColor when it connects and changes.

1 Like

Hello @dceejay,

Thank you very much for the kind support with the explanation and the simulation. :relieved:
I understood the requirement of msg.payload for worldmap. Also I think I have wrongly used the function Object.keys(). Well... now it is clear Thank you again !! :relaxed:

Actually, my requirement is initially there will be a location marked with 'black color' (At the moment I cannot fix the black color in the initial stage. well.. I'm trying it. ) and when a switch in a remote location change the status to on/off, that status should be indicated by the change of the icon color. That's why I defined the location (SS1) as global thinking that it is essential to access within any flow. Well seems like it is not required. I will try without global.

Hello @dceejay,

I extended the work and it worked nicely. But today when i deployed after restarting the nodered my flow was not working. No output in the map.

Then I tried the above flow you mentioned again . But I encountered the same issue no outputs in the map and in the debug panel there is an error as

" 2/6/2019, 11:17:12 AMnode: ON
function : (error)
"TypeError: Cannot set property 'iconColor' of undefined"

I'm trying to figure out the issue but seems like it is difficult since it worked nicely previous day but now it is not. :disappointed_relieved:
Any idea about it ?

My attempts :

X :

[{"id":"82268f12.9659a","type":"tab","label":"Initial Test ","disabled":false,"info":"\n\n"},{"id":"819aa18.b8de76","type":"ui_switch","z":"82268f12.9659a","name":"","label":"SS1","tooltip":"","group":"68efa007.e75a9","order":1,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"23/SS/status/SS1","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":50,"y":40,"wires":[["669dd7ec.a86f48","c396a63a.3f5538"]],"outputLabels":["1"]},{"id":"669dd7ec.a86f48","type":"mqtt out","z":"82268f12.9659a","name":"pub status/SS1 ","topic":"","qos":"0","retain":"","broker":"1be77637.6214ea","x":220,"y":40,"wires":[]},{"id":"f5ec465.1d0e7b8","type":"mqtt in","z":"82268f12.9659a","name":"sub SS/status/","topic":"23/SS/status/#","qos":"0","broker":"1be77637.6214ea","x":85,"y":173,"wires":[["ad4e84df.f4a7b8"]]},{"id":"c396a63a.3f5538","type":"debug","z":"82268f12.9659a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":210,"y":87,"wires":[]},{"id":"e7453aa1.9b8178","type":"ui_switch","z":"82268f12.9659a","name":"","label":"SS2","tooltip":"","group":"68efa007.e75a9","order":2,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"23/SS/status/SS2","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":370,"y":40,"wires":[["f7840ff8.3aa02","de5c409c.c972c"]],"outputLabels":["1"]},{"id":"f7840ff8.3aa02","type":"mqtt out","z":"82268f12.9659a","name":"pub status/SS2","topic":"","qos":"0","retain":"","broker":"1be77637.6214ea","x":560,"y":40,"wires":[]},{"id":"de5c409c.c972c","type":"debug","z":"82268f12.9659a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":550,"y":85,"wires":[]},{"id":"11692030.2c52f","type":"debug","z":"82268f12.9659a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":390,"y":140,"wires":[]},{"id":"2f461ffd.adb4f","type":"debug","z":"82268f12.9659a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","x":380,"y":280,"wires":[]},{"id":"38848344.840bfc","type":"debug","z":"82268f12.9659a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":140,"wires":[]},{"id":"1fee19ef.12e7e6","type":"debug","z":"82268f12.9659a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":280,"wires":[]},{"id":"db9d02d.9ff3c","type":"function","z":"82268f12.9659a","name":"ON","func":"var SS1 = global.get('SS1');\nSS1.iconColor=\"green\";\nSS1.icon =\"check\";\nmsg.payload = SS1;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":176,"wires":[["afe55f15.10498","9be5e541.668728"]]},{"id":"145e2fbc.ef9af","type":"function","z":"82268f12.9659a","name":"OFF","func":"var SS1 = global.get('SS1');\nSS1.iconColor=\"red\";\nSS1.icon =\"close\";\nmsg.payload = SS1;\nreturn msg;","outputs":1,"noerr":0,"x":569,"y":195,"wires":[["dd0cfd2e.0af8e","9be5e541.668728"]]},{"id":"c8c5f26d.ad8cd","type":"switch","z":"82268f12.9659a","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":370,"y":184,"wires":[["38848344.840bfc","db9d02d.9ff3c"],["1fee19ef.12e7e6","145e2fbc.ef9af"]]},{"id":"77aa8b73.e49924","type":"function","z":"82268f12.9659a","name":"ON","func":"var SS2 = global.get('SS2');\nSS2.iconColor=\"green\";\nSS2.icon =\"check\";\nmsg.payload = SS2;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":229,"wires":[["3de597af.55da58","9be5e541.668728"]]},{"id":"311a06fa.d14bca","type":"function","z":"82268f12.9659a","name":"OFF","func":"var SS2 = global.get('SS2');\nSS2.iconColor=\"red\";\nSS2.icon =\"close\";\nmsg.payload = SS2;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":244,"wires":[["44f4ce54.dc60b","9be5e541.668728"]]},{"id":"583ddcc6.f94824","type":"switch","z":"82268f12.9659a","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":370,"y":230,"wires":[["77aa8b73.e49924"],["311a06fa.d14bca"]]},{"id":"afe55f15.10498","type":"debug","z":"82268f12.9659a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":160,"wires":[]},{"id":"dd0cfd2e.0af8e","type":"debug","z":"82268f12.9659a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":193,"wires":[]},{"id":"44f4ce54.dc60b","type":"debug","z":"82268f12.9659a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":260,"wires":[]},{"id":"3de597af.55da58","type":"debug","z":"82268f12.9659a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":227,"wires":[]},{"id":"97883e0.57735c","type":"inject","z":"82268f12.9659a","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":90,"y":340,"wires":[["b55f529b.f98a7"]]},{"id":"f74ec9ac.f37cf8","type":"ui_template","z":"82268f12.9659a","group":"ab709f07.10b4c","name":"","order":2,"width":"10","height":"8","format":"<div ng-bind-html=\"msg.payload | trusted\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":400,"y":340,"wires":[[]]},{"id":"b55f529b.f98a7","type":"template","z":"82268f12.9659a","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src=\"../worldmap\" height=450px width =500px ></iframe>","x":240,"y":340,"wires":[["f74ec9ac.f37cf8"]]},{"id":"f56f2276.b945","type":"function","z":"82268f12.9659a","name":"Add SS (1:6)","func":"var SS1  =  {\n    name:\"SS1 : Kurunegala\", \n    lat:7.486944, \n    lon:80.365045,\n    icon:\"tag\",\n    iconColor:\"dark\",\n    extrainfo:\"Hello ! this is station 1\"\n};\n\nvar SS2 = global.get('SS2');//define global var for SS1\n\nSS2  =  {\n    name:\"SS2 : Mallawapitiya\", \n    lat:7.473803,\t\n    lon:80.390385,\n    icon:\"tag\",\n    extrainfo:\"Hello ! this is station 2\",\n    iconColor:\"dark\",\n   \n};\n//msg.payload= SS2;\nvar SS3 = {\n    name:\"SS3 : Pilessa\", \n    lat:7.453491,\t\n    lon:80.418123,\n    icon:\"tag\",\n    iconColor:\"blue\",\n    extrainfo:\"Hello ! this is station 3\"\n};\n\t\nvar SS4 = {\n    name:\"SS4 : Mawatagama\", \n    lat:7.432725,\t\n    lon:80.446576,\n    icon:\"tag\",\n    iconColor:\"blue\",\n    extrainfo:\"Hello ! this is station 4\"\n};\n\t\nvar SS5 = {\n    name:\"SS5 : Galagedara\", \n    lat:7.372298,\t\n    lon:80.526042,\n    icon:\"tag\",\n    iconColor:\"blue\",\n    extrainfo:\"Hello ! this is station 5\"\n};\n\t\nvar SS6 = {\n    name:\"SS6 : Barigama\", \n    lat:7.327693,\t\n    lon:80.577552,\n    icon:\"tag\",\n    iconColor:\"blue\",\n    extrainfo:\"Hello ! this is station 6\"\n};\n\n\nmsg.payload = [SS1,SS2,SS3,SS4,SS5,SS6];\n\nreturn msg;","outputs":1,"noerr":0,"x":335,"y":448,"wires":[["c826c53b.edc118","1fb9ded2.013851"]]},{"id":"2ef979dd.ff4986","type":"worldmap in","z":"82268f12.9659a","name":"","path":"/worldmap","x":65,"y":448,"wires":[["5d285fbe.84071","8cf717c0.645548"]]},{"id":"5d285fbe.84071","type":"switch","z":"82268f12.9659a","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":195,"y":448,"wires":[["f56f2276.b945","24b6094d.2a10e6"]]},{"id":"c826c53b.edc118","type":"worldmap","z":"82268f12.9659a","name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"hide","panit":"false","panlock":"false","zoomlock":"false","path":"/worldmap","x":505,"y":468,"wires":[]},{"id":"8cf717c0.645548","type":"debug","z":"82268f12.9659a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":155,"y":508,"wires":[]},{"id":"24b6094d.2a10e6","type":"debug","z":"82268f12.9659a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":335,"y":508,"wires":[]},{"id":"1fb9ded2.013851","type":"debug","z":"82268f12.9659a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":515,"y":428,"wires":[]},{"id":"9be5e541.668728","type":"worldmap","z":"82268f12.9659a","name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"hide","panit":"false","panlock":"false","zoomlock":"false","path":"/worldmap","x":755,"y":307,"wires":[]},{"id":"bc69d794.ffef78","type":"comment","z":"82268f12.9659a","name":"Adding SS","info":"","x":60,"y":400,"wires":[]},{"id":"b755dada.a12728","type":"comment","z":"82268f12.9659a","name":"Interface","info":"","x":60,"y":280,"wires":[]},{"id":"ad4e84df.f4a7b8","type":"switch","z":"82268f12.9659a","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"SS1","vt":"str"},{"t":"cont","v":"SS2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":230,"y":173,"wires":[["11692030.2c52f","c8c5f26d.ad8cd"],["2f461ffd.adb4f","583ddcc6.f94824"]]},{"id":"68efa007.e75a9","type":"ui_group","z":"","name":"SS Status ON/OFF","tab":"65663d20.ddb014","order":3,"disp":true,"width":"6","collapse":false},{"id":"1be77637.6214ea","type":"mqtt-broker","z":"","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"ab709f07.10b4c","type":"ui_group","z":"","name":"Map","tab":"65663d20.ddb014","order":1,"disp":true,"width":"10","collapse":false},{"id":"65663d20.ddb014","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

** Previously nicely worked but now nothing in the map , instead the above error msg in debug panel.

Y : tried a simply version (Broker is in another machine)

[{"id":"ddb0a547.bce2c8","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"d921164b.cbf558","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":210,"y":60,"wires":[]},{"id":"c66e2745.17a158","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":430,"y":40,"wires":[]},{"id":"48ec3e7a.23df6","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":330,"y":180,"wires":[]},{"id":"2f362446.1b6bcc","type":"mqtt in","z":"ddb0a547.bce2c8","name":"sub","topic":"2353/SS/status/#","qos":"0","broker":"e9cb029.64a23","x":50,"y":60,"wires":[["d921164b.cbf558","ab6ab36b.4966b"]]},{"id":"f5dc8ac1.f1d318","type":"worldmap","z":"ddb0a547.bce2c8","name":"","lat":"","lon":"","zoom":"11","layer":"OSM","cluster":"4","maxage":"","usermenu":"hide","layers":"hide","panit":"true","panlock":"false","path":"","x":770,"y":260,"wires":[]},{"id":"43baf701.a170f8","type":"function","z":"ddb0a547.bce2c8","name":"Add SS1","func":"var SS1 = global.get('SS1');//define global var for SS1\nSS1  =  {\n    name:\"SS1 : Kurunegala\", \n    lat:7.486944, \n    lon:80.365045,\n    icon:\"tag\",\n    iconColor:\"dark\",\n    extrainfo:\"Hello ! this is station 1\"\n};\nmsg.payload= SS1;\nglobal.set('SS1',SS1);\n\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":480,"wires":[["a05adf62.d7049"]]},{"id":"a05adf62.d7049","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":410,"y":480,"wires":[]},{"id":"ae4fd92e.b9db58","type":"function","z":"ddb0a547.bce2c8","name":"ON","func":"var SS1 = global.get('SS1');\nSS1.iconColor=\"green\";\nSS1.icon =\"check\";\nmsg.payload = SS1;\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":80,"wires":[["4662c489.b7763c","f5dc8ac1.f1d318"]]},{"id":"4662c489.b7763c","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":80,"wires":[]},{"id":"eb9273a2.36f45","type":"inject","z":"ddb0a547.bce2c8","name":"","topic":"","payload":"SS1","payloadType":"global","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":480,"wires":[["43baf701.a170f8"]]},{"id":"699c2810.28fa08","type":"function","z":"ddb0a547.bce2c8","name":"OFF","func":"var SS1 = global.get('SS1');\nSS1.iconColor=\"red\";\nSS1.icon =\"close\";\nmsg.payload = SS1;\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":100,"wires":[["f75d24ea.de1f38","f5dc8ac1.f1d318"]]},{"id":"f75d24ea.de1f38","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":120,"wires":[]},{"id":"d5555746.9375c8","type":"inject","z":"ddb0a547.bce2c8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":110,"y":360,"wires":[["51f24e32.f06a4"]]},{"id":"bd3ff9bb.ec64c8","type":"ui_template","z":"ddb0a547.bce2c8","group":"cd4dbee1.d0a2d","name":"","order":2,"width":"6","height":"8","format":"<div ng-bind-html=\"msg.payload | trusted\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":420,"y":360,"wires":[[]]},{"id":"51f24e32.f06a4","type":"template","z":"ddb0a547.bce2c8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src=\"../worldmap\" height=450px width =500px ></iframe>","x":260,"y":360,"wires":[["bd3ff9bb.ec64c8"]]},{"id":"2853aaca.7b9086","type":"function","z":"ddb0a547.bce2c8","name":"Add SS1","func":"var SS1 = global.get('SS1')\nSS1  =  {\n    name:\"SS1 : Kurunegala\", \n    lat:7.486944, \n    lon:80.365045,\n    icon:\"tag\",\n    iconColor:\"dark\",\n    extrainfo:\"Hello ! this is station 1\"\n};\nmsg.payload = SS1;\n\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":540,"wires":[["521bb48f.04f77c","8040b50e.458768"]]},{"id":"c5dfcbd4.9fdd78","type":"worldmap in","z":"ddb0a547.bce2c8","name":"","path":"/worldmap","x":100,"y":540,"wires":[["624c0380.97089c","b3268f.99b9d97"]]},{"id":"624c0380.97089c","type":"switch","z":"ddb0a547.bce2c8","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"},{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":250,"y":540,"wires":[["2853aaca.7b9086","a4bd8801.40fc38"],["80f5b29a.51f71"]]},{"id":"521bb48f.04f77c","type":"worldmap","z":"ddb0a547.bce2c8","name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","path":"/worldmap","x":640,"y":540,"wires":[]},{"id":"255041eb.4e5afe","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":490,"y":220,"wires":[]},{"id":"a4bd8801.40fc38","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":410,"y":700,"wires":[]},{"id":"8040b50e.458768","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":620,"wires":[]},{"id":"9f4c52f7.2518f","type":"comment","z":"ddb0a547.bce2c8","name":"Interface","info":"","x":80,"y":320,"wires":[]},{"id":"ab6ab36b.4966b","type":"switch","z":"ddb0a547.bce2c8","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"SS1","vt":"str"},{"t":"cont","v":"SS2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":209,"y":102,"wires":[["c66e2745.17a158","1d6f01ca.807b6e"],["48ec3e7a.23df6","ea628ff0.69422"]]},{"id":"1d6f01ca.807b6e","type":"switch","z":"ddb0a547.bce2c8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":350,"y":100,"wires":[["b16c71e9.ee268","ae4fd92e.b9db58"],["b16c71e9.ee268","699c2810.28fa08"]]},{"id":"ea628ff0.69422","type":"switch","z":"ddb0a547.bce2c8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":350,"y":140,"wires":[["255041eb.4e5afe","3a7d0eab.0be992"],["255041eb.4e5afe","460111ad.81964"]]},{"id":"b16c71e9.ee268","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":610,"y":40,"wires":[]},{"id":"3a7d0eab.0be992","type":"function","z":"ddb0a547.bce2c8","name":"ON","func":"var SS2 = global.get('SS2');\nSS2.iconColor=\"green\";\nSS2.icon =\"check\";\nmsg.payload = SS2;\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":160,"wires":[["dcb529ee.872878"]]},{"id":"460111ad.81964","type":"function","z":"ddb0a547.bce2c8","name":"OFF","func":"var SS2 = global.get('SS2');\nSS2.iconColor=\"red\";\nSS2.icon =\"close\";\nmsg.payload = SS2;\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":180,"wires":[["9c6f929f.53484"]]},{"id":"9c6f929f.53484","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":200,"wires":[]},{"id":"dcb529ee.872878","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":160,"wires":[]},{"id":"b3268f.99b9d97","type":"debug","z":"ddb0a547.bce2c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":310,"y":640,"wires":[]},{"id":"80f5b29a.51f71","type":"function","z":"ddb0a547.bce2c8","name":"Add SS1","func":"var SS2 = global.get('SS2');//define global var for SS1\n\nSS2  =  {\n    name:\"SS2 : Mallawapitiya\", \n    lat:7.473803,\t\n    lon:80.390385,\n    icon:\"tag\",\n    extrainfo:\"Hello ! this is station 2\",\n    iconColor:\"dark\",\n   \n};\nmsg.payload= SS2;\n\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":580,"wires":[["521bb48f.04f77c"]]},{"id":"e9cb029.64a23","type":"mqtt-broker","z":"","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"cd4dbee1.d0a2d","type":"ui_group","z":"","name":"ON/OFF","tab":"2b6413f3.81bebc","disp":false,"width":"6","collapse":false},{"id":"2b6413f3.81bebc","type":"ui_tab","z":"","name":"Station Status","icon":"dashboard","disabled":false,"hidden":false}]

*** This is working only for SS1 , mapped the SS2 as well but not functioning :frowning: . No color change the same error message in debug pannel. I tried in various ways but again the issue is as SS2 unidentified.

Previously worked output :

Kindly help me to figure out what has happened. :frowning:

Thank you.