No output in the worldmap


#1

Hello,

I'm trying to show several locations in the worldmap. When i restarted the node red and the Rasspberrypi and deployed the below there is nothing in the worldmap.

It is hard to discover the issue in my flow mentioned below. Im not sure what is the mistake or what has happened here. I'm kindly looking for an idea.

Thank you.

[{"id":"8ce5c474.f6d0e8","type":"tab","label":"SStation map 2 ","disabled":false,"info":"\n\n"},{"id":"67e095cd.f1c0dc","type":"ui_switch","z":"8ce5c474.f6d0e8","name":"","label":"SS01","tooltip":"","group":"68efa007.e75a9","order":1,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"1111/SS/status/SS1","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":50,"y":40,"wires":[["6217a42c.6ffbcc","9bac73ac.b7c1b"]],"outputLabels":["1"]},{"id":"6217a42c.6ffbcc","type":"mqtt out","z":"8ce5c474.f6d0e8","name":"pub status/SS1 ","topic":"","qos":"0","retain":"","broker":"1be77637.6214ea","x":220,"y":20,"wires":[]},{"id":"acc2839d.c0372","type":"mqtt in","z":"8ce5c474.f6d0e8","name":"sub SS/status/","topic":"1111/SS/status/#","qos":"0","broker":"1be77637.6214ea","x":100,"y":140,"wires":[["941c2c01.c9dbc"]]},{"id":"9bac73ac.b7c1b","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":210,"y":87,"wires":[]},{"id":"a0bf3b1f.f423e8","type":"ui_switch","z":"8ce5c474.f6d0e8","name":"","label":"SS02","tooltip":"","group":"68efa007.e75a9","order":2,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"1111/SS/status/SS2","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":390,"y":20,"wires":[["a482bed.5dba24","9483e55b.e3c4e8"]],"outputLabels":["1"]},{"id":"a482bed.5dba24","type":"mqtt out","z":"8ce5c474.f6d0e8","name":"pub status/SS2","topic":"","qos":"0","retain":"","broker":"1be77637.6214ea","x":620,"y":40,"wires":[]},{"id":"9483e55b.e3c4e8","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":490,"y":80,"wires":[]},{"id":"576b194b.761908","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":310,"y":120,"wires":[]},{"id":"2a98de8a.c54082","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","x":380,"y":280,"wires":[]},{"id":"58f4f309.7cfffc","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":120,"wires":[]},{"id":"c38084e7.9c75c8","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":280,"wires":[]},{"id":"36a3a16e.fd867e","type":"function","z":"8ce5c474.f6d0e8","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":160,"wires":[["4ec266c4.0ebde8","a820df19.965d6"]]},{"id":"ccba9eb6.c9e5a","type":"function","z":"8ce5c474.f6d0e8","name":"OFF","func":"var SS1 = global.get('SS1');\nSS1.iconColor=\"red\";\nSS1.icon =\"close\";\nmsg.payload = SS1;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":200,"wires":[["aeccd8e3.76a808","a820df19.965d6"]]},{"id":"e9eba09a.c9483","type":"switch","z":"8ce5c474.f6d0e8","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":160,"wires":[["58f4f309.7cfffc","36a3a16e.fd867e"],["c38084e7.9c75c8","ccba9eb6.c9e5a"]]},{"id":"4ec266c4.0ebde8","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":160,"wires":[]},{"id":"aeccd8e3.76a808","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":193,"wires":[]},{"id":"10f36f46.2d3d51","type":"inject","z":"8ce5c474.f6d0e8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":90,"y":340,"wires":[["aa1a3da6.2d6dd"]]},{"id":"8d63178b.304bb8","type":"ui_template","z":"8ce5c474.f6d0e8","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":"aa1a3da6.2d6dd","type":"template","z":"8ce5c474.f6d0e8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src=\"../worldmap\" height=450px width =500px ></iframe>","x":240,"y":340,"wires":[["8d63178b.304bb8"]]},{"id":"7c3fb4bf.45947c","type":"function","z":"8ce5c474.f6d0e8","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  =  {\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\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":330,"y":440,"wires":[["482a280c.704918","49b513a2.ef201c"]]},{"id":"9c062e6b.69cc7","type":"worldmap in","z":"8ce5c474.f6d0e8","name":"","path":"/worldmap","x":60,"y":400,"wires":[["e3985f72.32e4a","93d0c7a0.8ad848"]]},{"id":"e3985f72.32e4a","type":"switch","z":"8ce5c474.f6d0e8","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":195,"y":448,"wires":[["7c3fb4bf.45947c","2c34d7c8.8a9638"]]},{"id":"482a280c.704918","type":"worldmap","z":"8ce5c474.f6d0e8","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":"93d0c7a0.8ad848","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":155,"y":508,"wires":[]},{"id":"2c34d7c8.8a9638","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":335,"y":508,"wires":[]},{"id":"49b513a2.ef201c","type":"debug","z":"8ce5c474.f6d0e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":515,"y":428,"wires":[]},{"id":"a820df19.965d6","type":"worldmap","z":"8ce5c474.f6d0e8","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":"941c2c01.c9dbc","type":"switch","z":"8ce5c474.f6d0e8","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":[["576b194b.761908","e9eba09a.c9483"],["2a98de8a.c54082"]]},{"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}]

#2

How is this different from your post here?


#3

In that flow - I extended solution and tried previously and nicely worked but today it didn't time to time different results as mentioned. but always a same error occurred.

Here - there is no error in any place & newly created the flow from the beginning to end once again to figure out the issue and encountered nothing in the world map.


#4

If you mean that markers do not show up on the map every so often then I can second that. Over the last week or so I have found that this is hit or miss. Haven't looked into the issue yet, it is just something I noticed.


#5

well...I thought something wrong in my flows which I could not figure out clearly as Im completely new to nodered / javascript .
I have shared the flows i used.


#6

Well you should only have one worldmap out node (per endpoint url - in this case /worldmap) - and just wire everything to that.

Secondly for some reason there does indeed seem to be a slight timing problem with the initialisation of those points... so I have added a tiny delay and that seems to have fixed it for now... I'll use this as a test case to fix the real problem later...

[{"id":"35a545b7.512bea","type":"ui_switch","z":"59b767c7.ce9858","name":"","label":"SS01","tooltip":"","group":"6e89f4fb.532aac","order":1,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"1111/SS/status/SS1","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":70,"y":40,"wires":[["3008bc98.ec11b4","f3422357.664cd"]],"outputLabels":["1"]},{"id":"3008bc98.ec11b4","type":"mqtt out","z":"59b767c7.ce9858","name":"pub status/SS1 ","topic":"","qos":"0","retain":"","broker":"e03edd89.f2b83","x":240,"y":40,"wires":[]},{"id":"68e674db.2e37dc","type":"mqtt in","z":"59b767c7.ce9858","name":"sub SS/status/","topic":"1111/SS/status/#","qos":"0","broker":"e03edd89.f2b83","x":100,"y":160,"wires":[["8e33e8b.e1da018"]]},{"id":"f3422357.664cd","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":230,"y":100,"wires":[]},{"id":"d6088e9b.83216","type":"ui_switch","z":"59b767c7.ce9858","name":"","label":"SS02","tooltip":"","group":"6e89f4fb.532aac","order":2,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"1111/SS/status/SS2","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":430,"y":40,"wires":[["395d6a38.f64d56","fc747e26.4765c"]],"outputLabels":["1"]},{"id":"395d6a38.f64d56","type":"mqtt out","z":"59b767c7.ce9858","name":"pub status/SS2","topic":"","qos":"0","retain":"","broker":"e03edd89.f2b83","x":660,"y":40,"wires":[]},{"id":"fc747e26.4765c","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":100,"wires":[]},{"id":"e6426c46.eff37","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":310,"y":140,"wires":[]},{"id":"d75f759a.fb7638","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","x":380,"y":300,"wires":[]},{"id":"248a062c.09848a","type":"debug","z":"59b767c7.ce9858","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":140,"wires":[]},{"id":"3976f396.0e7c8c","type":"debug","z":"59b767c7.ce9858","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":300,"wires":[]},{"id":"f000826.eae6c8","type":"function","z":"59b767c7.ce9858","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":180,"wires":[["4a0495be.34975c","b6e12df6.f987e"]]},{"id":"a7b24923.e1a108","type":"function","z":"59b767c7.ce9858","name":"OFF","func":"var SS1 = global.get('SS1');\nSS1.iconColor=\"red\";\nSS1.icon =\"close\";\nmsg.payload = SS1;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":220,"wires":[["3740249d.636cdc","b6e12df6.f987e"]]},{"id":"3309db38.4492a4","type":"switch","z":"59b767c7.ce9858","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":390,"y":180,"wires":[["248a062c.09848a","f000826.eae6c8"],["3976f396.0e7c8c","a7b24923.e1a108"]]},{"id":"4a0495be.34975c","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":180,"wires":[]},{"id":"3740249d.636cdc","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":213,"wires":[]},{"id":"80c933fb.9aafb","type":"inject","z":"59b767c7.ce9858","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":110,"y":360,"wires":[["efed7b7f.a99358"]]},{"id":"d0e8a0ce.f2eff","type":"ui_template","z":"59b767c7.ce9858","group":"a7459054.3eb6f","name":"","order":2,"width":"10","height":"8","format":"<div ng-bind-html=\"msg.payload | trusted\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":440,"y":360,"wires":[[]]},{"id":"efed7b7f.a99358","type":"template","z":"59b767c7.ce9858","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src=\"../worldmap\" height=450px width =500px ></iframe>","x":280,"y":360,"wires":[["d0e8a0ce.f2eff"]]},{"id":"9505c554.6afce8","type":"function","z":"59b767c7.ce9858","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  =  {\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\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":450,"y":420,"wires":[["fb776b3f.eb1158","f4320c06.91363"]]},{"id":"58bf2445.568f4c","type":"worldmap in","z":"59b767c7.ce9858","name":"","path":"/worldmap","x":100,"y":420,"wires":[["2d4673c2.cca1bc","d24a4997.35ea28"]]},{"id":"2d4673c2.cca1bc","type":"switch","z":"59b767c7.ce9858","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":270,"y":420,"wires":[["9505c554.6afce8","b6ce54a0.61b768"]]},{"id":"d24a4997.35ea28","type":"debug","z":"59b767c7.ce9858","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":155,"y":528,"wires":[]},{"id":"b6ce54a0.61b768","type":"debug","z":"59b767c7.ce9858","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":370,"y":520,"wires":[]},{"id":"fb776b3f.eb1158","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":520,"wires":[]},{"id":"b6e12df6.f987e","type":"worldmap","z":"59b767c7.ce9858","name":"","lat":"","lon":"","zoom":"10","layer":"","cluster":"0","maxage":"","usermenu":"show","layers":"hide","panit":"true","panlock":"false","zoomlock":"false","path":"/worldmap","x":780,"y":360,"wires":[]},{"id":"8e33e8b.e1da018","type":"switch","z":"59b767c7.ce9858","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":220,"wires":[["e6426c46.eff37","3309db38.4492a4"],["d75f759a.fb7638"]]},{"id":"5a4ec984.e7f048","type":"inject","z":"59b767c7.ce9858","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":110,"y":320,"wires":[["9505c554.6afce8"]]},{"id":"f4320c06.91363","type":"delay","z":"59b767c7.ce9858","name":"","pauseType":"delay","timeout":"0.25","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":630,"y":420,"wires":[["b6e12df6.f987e"]]},{"id":"6e89f4fb.532aac","type":"ui_group","z":"","name":"SS Status ON/OFF","tab":"49a3ca1e.67a4d4","order":3,"disp":true,"width":"6","collapse":false},{"id":"e03edd89.f2b83","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":"a7459054.3eb6f","type":"ui_group","z":"","name":"Map","tab":"49a3ca1e.67a4d4","order":1,"disp":true,"width":"10","collapse":false},{"id":"49a3ca1e.67a4d4","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

#7

Ok- I have fixed the timing issue in version v1.5.20 of worldmap now on npm.


#8

Hello,

Thank you very much for all the support. :relieved:

I'm trying the first solution you mentioned with the delay and now encountered the error which i have mentioned in the old thread.

"TypeError: Cannot set property 'iconColor' of undefined"

Due to this now the color change is not visible :frowning:
I'm trying to figure out the issue at the moment and always says. Seems like my array is not correct or something :thinking: But it worked previously... and im thinking about the issue here ...

So since the timing issue has been fixed isn't it necessary to try the delay element option ?

Besides I'm asking for guidance as I'm scared about continuing in this path and this is my first attempt in nodered. Once the color changes of the icons are fixed i'm going to map the track of a vehicle on top of this map using GPS module data and worldmap track node. Is there any other more suitable option for that in nodered ?


#9

Another thing , how to know the worldmap version im working :roll_eyes: I didnt notice a version while working. I mean is it the default map appears usually or i wanna change the map to this version v1.5.20 ?


#10

Here a a new version of your flow where I have made the function a bit more generic so it should work for any switch 1 to 6 (when you create/add them. (see below)

If you go to menu - manage palette you can then search for worldmap and see the version number. Once yuo update you may need to stop and restart Node-RED

[{"id":"35a545b7.512bea","type":"ui_switch","z":"59b767c7.ce9858","name":"","label":"SS01","tooltip":"","group":"6e89f4fb.532aac","order":1,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"1111/SS/status/SS1","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":90,"y":40,"wires":[["3008bc98.ec11b4","f3422357.664cd"]],"outputLabels":["1"]},{"id":"3008bc98.ec11b4","type":"mqtt out","z":"59b767c7.ce9858","name":"pub status/SS1 ","topic":"","qos":"0","retain":"","broker":"e03edd89.f2b83","x":260,"y":40,"wires":[]},{"id":"68e674db.2e37dc","type":"mqtt in","z":"59b767c7.ce9858","name":"sub SS/status/","topic":"1111/SS/status/#","qos":"0","datatype":"auto","broker":"e03edd89.f2b83","x":120,"y":200,"wires":[["3309db38.4492a4","e6426c46.eff37"]]},{"id":"f3422357.664cd","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":250,"y":100,"wires":[]},{"id":"d6088e9b.83216","type":"ui_switch","z":"59b767c7.ce9858","name":"","label":"SS02","tooltip":"","group":"6e89f4fb.532aac","order":2,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"1111/SS/status/SS2","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":430,"y":40,"wires":[["395d6a38.f64d56","fc747e26.4765c"]],"outputLabels":["1"]},{"id":"395d6a38.f64d56","type":"mqtt out","z":"59b767c7.ce9858","name":"pub status/SS2","topic":"","qos":"0","retain":"","broker":"e03edd89.f2b83","x":660,"y":40,"wires":[]},{"id":"fc747e26.4765c","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":100,"wires":[]},{"id":"e6426c46.eff37","type":"debug","z":"59b767c7.ce9858","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":290,"y":260,"wires":[]},{"id":"248a062c.09848a","type":"debug","z":"59b767c7.ce9858","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":160,"wires":[]},{"id":"3976f396.0e7c8c","type":"debug","z":"59b767c7.ce9858","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":280,"wires":[]},{"id":"f000826.eae6c8","type":"function","z":"59b767c7.ce9858","name":"ON","func":"var ss = msg.topic.split('/')[3];\nnode.warn(ss)\nvar SS = global.get(ss);\nSS.iconColor=\"green\";\nSS.icon =\"check\";\nmsg.payload = SS;\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":200,"wires":[["4a0495be.34975c","b6e12df6.f987e"]]},{"id":"a7b24923.e1a108","type":"function","z":"59b767c7.ce9858","name":"OFF","func":"var ss = msg.topic.split('/')[3];\nnode.warn(ss)\nvar SS = global.get(ss);\nSS.iconColor=\"red\";\nSS.icon =\"close\";\nmsg.payload = SS;\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":240,"wires":[["3740249d.636cdc","b6e12df6.f987e"]]},{"id":"3309db38.4492a4","type":"switch","z":"59b767c7.ce9858","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":310,"y":200,"wires":[["248a062c.09848a","f000826.eae6c8"],["3976f396.0e7c8c","a7b24923.e1a108"]]},{"id":"4a0495be.34975c","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":200,"wires":[]},{"id":"3740249d.636cdc","type":"debug","z":"59b767c7.ce9858","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":240,"wires":[]},{"id":"80c933fb.9aafb","type":"inject","z":"59b767c7.ce9858","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":110,"y":440,"wires":[["efed7b7f.a99358"]]},{"id":"d0e8a0ce.f2eff","type":"ui_template","z":"59b767c7.ce9858","group":"a7459054.3eb6f","name":"","order":2,"width":"10","height":"8","format":"<div ng-bind-html=\"msg.payload | trusted\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":480,"y":440,"wires":[[]]},{"id":"efed7b7f.a99358","type":"template","z":"59b767c7.ce9858","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src=\"../worldmap\" height=450px width =500px ></iframe>","x":300,"y":440,"wires":[["d0e8a0ce.f2eff"]]},{"id":"9505c554.6afce8","type":"function","z":"59b767c7.ce9858","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:\"blue\",\n    extrainfo:\"Hello ! this is station 1\"\n};\nglobal.set(\"SS1\",SS1);\n\nvar SS2  =  {\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:\"blue\"\n};\nglobal.set(\"SS2\",SS2);\n\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};\nglobal.set(\"SS3\",SS3);\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};\nglobal.set(\"SS4\",SS4);\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};\nglobal.set(\"SS5\",SS5);\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};\nglobal.set(\"SS6\",SS6);\n\nmsg.payload = [SS1,SS2,SS3,SS4,SS5,SS6];\n\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":380,"wires":[["fb776b3f.eb1158","b6e12df6.f987e"]]},{"id":"58bf2445.568f4c","type":"worldmap in","z":"59b767c7.ce9858","name":"","path":"/worldmap","x":100,"y":380,"wires":[["2d4673c2.cca1bc"]]},{"id":"2d4673c2.cca1bc","type":"switch","z":"59b767c7.ce9858","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":290,"y":380,"wires":[["9505c554.6afce8"]]},{"id":"fb776b3f.eb1158","type":"debug","z":"59b767c7.ce9858","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":380,"wires":[]},{"id":"b6e12df6.f987e","type":"worldmap","z":"59b767c7.ce9858","name":"","lat":"","lon":"","zoom":"10","layer":"","cluster":"0","maxage":"","usermenu":"show","layers":"hide","panit":"true","panlock":"false","zoomlock":"false","path":"/worldmap","x":780,"y":300,"wires":[]},{"id":"6e89f4fb.532aac","type":"ui_group","z":"","name":"SS Status ON/OFF","tab":"49a3ca1e.67a4d4","order":3,"disp":true,"width":"6","collapse":false},{"id":"e03edd89.f2b83","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":"a7459054.3eb6f","type":"ui_group","z":"","name":"Map","tab":"49a3ca1e.67a4d4","order":1,"disp":true,"width":"10","collapse":false},{"id":"49a3ca1e.67a4d4","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

#11

Yess... it is working :smiley: and I'm very much thankful for the support in modifying the flow. I have learnt a lot of new things from this. :relaxed:

In my palette (this is my rasspberrypi )there is no v1.5.20 :thinking: But in windows there is v1.5.20. Currently in both windows and RasspberryPi Im working with v1.5.18.


#12

you may need to stop / restart Node-RED and refresh your browser - so that it downloads the latest list from the web store.


#13

Yeh... successfully upgraded.:smiley: Thank you very much again...


#14

Thanks for finding that tiny bug.


#15

you're welcome. :blush: