Trying to understand why scope.send is troubled

I am puzzled by this dashboard behavior.Below flow works as expected. A click in a "donut" division (outer part of the circle) will trigger a series of actions.

issue-04

[{"id":"135856ab.68e739","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"2ede2c91.922844","type":"template","z":"135856ab.68e739","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n\n<html>\n\n<head>\n\n<style>\n\n    svg {\n      \n      margin-left: auto;\n      margin-right: auto;\n      display: block;\n    }\n\n    :root {\n        --colourNorth: {{ColourNorth}};\n        --colourEast:  {{ColourEast}};\n        --colourSouth: {{ColourSouth}};\n        --colourWest:  {{ColourWest}};\n    }\n    \n    .myicon {\n        font-family: \"FontAwesome\";\n        font-size: 30px;\n    }\n    \n    #lightNorth {\n        fill: var(--colourNorth, \"dimgray\");\n    }\n    \n    #lightEast {\n        fill: var(--colourEast, \"dimgray\");\n    }\n    \n    #lightSouth {\n        fill: var(--colourSouth, \"dimgray\");\n    }\n    \n    #lightWest {\n        fill: var(--colourWest, \"dimgray\");\n    }\n      \n</style>\n\n</head>\n\n<body>\n\n    <script>\n    let w = 200;\n    let h = 200;\n\n    var svg = d3.select(\"#Switches_G2\")\n        .append(\"svg\")\n        .attr(\"width\", w)\n        .attr(\"height\", h);\n    \nvar arc1 = d3.svg.arc()\n      .innerRadius(40)\n      .outerRadius(60)\n      .startAngle(45 * Math.PI/180) \n      .endAngle(-45 * Math.PI/180); \n  \n  var arc2 = d3.svg.arc()\n      .innerRadius(40)\n      .outerRadius(60)\n      .startAngle(45 * Math.PI/180) \n      .endAngle(135 * Math.PI/180);  \n  \n  var arc3 = d3.svg.arc()\n      .innerRadius(40)\n      .outerRadius(60)\n      .startAngle(135 * Math.PI/180) \n      .endAngle(225 * Math.PI/180);  \n  \n  var arc4 = d3.svg.arc()\n      .innerRadius(40)\n      .outerRadius(60)\n      .startAngle(-45 * Math.PI/180)  \n      .endAngle(-135 * Math.PI/180);    \n\nvar path1 = svg.append('path')\n      .attr('d', arc1)\n      .attr('stroke', 'black')\n      .attr('stroke-width', 3)\n      .attr('transform', 'translate('+ w/2 + ','+ h/2 +')')\n      .attr('id', 'lightNorth');\n  \n  var path2 = svg.append('path')\n      .attr('d', arc2)\n      .attr('stroke', 'black')\n      .attr('stroke-width', 3)\n      .attr('transform', 'translate('+ w/2 + ','+ h/2 +')')\n      .attr('id', 'lightEast');\n  \n  var path3 = svg.append('path')\n      .attr('d', arc3)\n      .attr('stroke', 'black')\n      .attr('stroke-width', 3)\n      .attr('transform', 'translate('+ w/2 + ','+ h/2 +')')\n      .attr('id', 'lightSouth');\n  \n  var path4 = svg.append('path')\n      .attr('d', arc4)\n      .attr('stroke', 'black')\n      .attr('stroke-width', 3)\n      .attr('transform', 'translate('+ w/2 + ','+ h/2 +')')\n      .attr('id', 'lightWest');\n  \n  var innerCircle = svg.append('circle')\n      .attr('cx', w/2)\n      .attr('cy', h/2)\n      .attr('r', 40)\n      .attr('fill', 'dimgray');\n  \n  var textCenter = svg.append('text')\n    .attr('y', 10 + h/2)\n    .attr('x', w/2)\n    .attr('text-anchor', 'middle')\n    .attr('class', 'myicon')\n    .attr('fill', 'yellow')\n    .text('\\uf0eb');\n  \n    </script>\n  \n    <script>\n        (function(scope){\n            d3.selectAll('path').on('click', handleClick);\n            function handleClick(x, y) {\n                scope.send({\"svg\": y});\n                console.log(\"click\");\n            };\n        })(scope);\n  </script>\n  \n  </body>\n  </html>\n  ","output":"str","x":1320,"y":620,"wires":[["5f1d13b8.2adbfc"]]},{"id":"5f1d13b8.2adbfc","type":"ui_template","z":"135856ab.68e739","group":"ef34b1f8.37e22","name":"","order":1,"width":"0","height":"0","format":"","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1480,"y":620,"wires":[["3387667b.de846a"]]},{"id":"21048050.8ef92","type":"ui_switch","z":"135856ab.68e739","name":"","label":"South","tooltip":"","group":"ef34b1f8.37e22","order":3,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"South-ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"South-OFF","offvalueType":"str","officon":"","offcolor":"","x":670,"y":600,"wires":[["7605f55e.ef1a7c"]]},{"id":"bdab098b.060ce8","type":"ui_switch","z":"135856ab.68e739","name":"","label":"East","tooltip":"","group":"ef34b1f8.37e22","order":4,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"East-ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"East-OFF","offvalueType":"str","officon":"","offcolor":"","x":690,"y":720,"wires":[["82b02979.9ec6c8"]]},{"id":"f18cecda.54c9d","type":"ui_switch","z":"135856ab.68e739","name":"","label":"West","tooltip":"","group":"ef34b1f8.37e22","order":5,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"West-ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"West-OFF","offvalueType":"str","officon":"","offcolor":"","x":690,"y":860,"wires":[["49489f7c.b129a"]]},{"id":"911271ba.da531","type":"ui_switch","z":"135856ab.68e739","name":"","label":"North","tooltip":"","group":"ef34b1f8.37e22","order":2,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"North-ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"North-OFF","offvalueType":"str","officon":"","offcolor":"","x":670,"y":480,"wires":[["48257852.2f8538"]]},{"id":"48257852.2f8538","type":"change","z":"135856ab.68e739","name":"Set Global North","rules":[{"t":"set","p":"stateLightColourNorth","pt":"global","to":"payload = \"North-ON\" ? \"lime\" : \"dimgray\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":480,"wires":[["78b0f967.17a418"]]},{"id":"7605f55e.ef1a7c","type":"change","z":"135856ab.68e739","name":"Set Global South","rules":[{"t":"set","p":"stateLightColourSouth","pt":"global","to":"payload = \"South-ON\" ? \"lime\" : \"dimgray\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":600,"wires":[["78b0f967.17a418"]]},{"id":"82b02979.9ec6c8","type":"change","z":"135856ab.68e739","name":"Set Global East","rules":[{"t":"set","p":"stateLightColourEast","pt":"global","to":"payload = \"East-ON\" ? \"lime\" : \"dimgray\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":720,"wires":[["78b0f967.17a418"]]},{"id":"49489f7c.b129a","type":"change","z":"135856ab.68e739","name":"Set Global West","rules":[{"t":"set","p":"stateLightColourWest","pt":"global","to":"payload = \"West-ON\" ? \"lime\" : \"dimgray\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":860,"wires":[["78b0f967.17a418"]]},{"id":"78b0f967.17a418","type":"change","z":"135856ab.68e739","name":"Read ALL Global","rules":[{"t":"set","p":"ColourNorth","pt":"msg","to":"stateLightColourNorth","tot":"global"},{"t":"set","p":"ColourSouth","pt":"msg","to":"stateLightColourSouth","tot":"global"},{"t":"set","p":"ColourEast","pt":"msg","to":"stateLightColourEast","tot":"global"},{"t":"set","p":"ColourWest","pt":"msg","to":"stateLightColourWest","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":620,"wires":[["2ede2c91.922844"]]},{"id":"e159cda1.620ce","type":"change","z":"135856ab.68e739","name":"Read Global North","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourNorth\") = \"lime\" ? \"North-ON\" : \"North-OFF\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":480,"wires":[["911271ba.da531"]]},{"id":"cb6c1aa5.3f5938","type":"change","z":"135856ab.68e739","name":"Read Global South","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourSouth\") = \"lime\" ? \"South-ON\" : \"South-OFF\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":600,"wires":[["21048050.8ef92"]]},{"id":"e02e1b94.578558","type":"change","z":"135856ab.68e739","name":"Read Global East","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourEast\") = \"lime\" ? \"East-ON\" : \"East-OFF\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":720,"wires":[["bdab098b.060ce8"]]},{"id":"4ab046c4.99f488","type":"change","z":"135856ab.68e739","name":"Read Global West","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourWest\") = \"lime\" ? \"West-ON\" : \"West-OFF\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":860,"wires":[["f18cecda.54c9d"]]},{"id":"6533899f.f5cf98","type":"inject","z":"135856ab.68e739","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":150,"y":480,"wires":[["e159cda1.620ce","cb6c1aa5.3f5938","e02e1b94.578558","4ab046c4.99f488"]]},{"id":"88e51b4f.44a278","type":"mqtt in","z":"135856ab.68e739","name":"","topic":"light/south","qos":"2","datatype":"auto","broker":"5210d17b.64d49","x":520,"y":540,"wires":[["21048050.8ef92"]]},{"id":"6114431a.2439bc","type":"mqtt in","z":"135856ab.68e739","name":"","topic":"light/north","qos":"2","datatype":"auto","broker":"5210d17b.64d49","x":520,"y":420,"wires":[["911271ba.da531"]]},{"id":"1511edfa.ac70a2","type":"mqtt in","z":"135856ab.68e739","name":"","topic":"light/east","qos":"2","datatype":"auto","broker":"5210d17b.64d49","x":540,"y":660,"wires":[["bdab098b.060ce8"]]},{"id":"6a536e6.3a9ec9","type":"mqtt in","z":"135856ab.68e739","name":"","topic":"light/west","qos":"2","datatype":"auto","broker":"5210d17b.64d49","x":540,"y":800,"wires":[["f18cecda.54c9d"]]},{"id":"50356687.b33318","type":"mqtt out","z":"135856ab.68e739","name":"","topic":"light/north","qos":"","retain":"","broker":"5210d17b.64d49","x":2040,"y":300,"wires":[]},{"id":"4ee04e31.9189c","type":"inject","z":"135856ab.68e739","name":"North - ON","topic":"","payload":"North-ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1860,"y":300,"wires":[["50356687.b33318"]]},{"id":"64c91cf4.d3ad54","type":"inject","z":"135856ab.68e739","name":"North - OFF","topic":"","payload":"North-OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1830,"y":260,"wires":[["50356687.b33318"]]},{"id":"32c8d832.907718","type":"inject","z":"135856ab.68e739","name":"East - ON","topic":"","payload":"East-ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1880,"y":620,"wires":[["c510f667.c06128"]]},{"id":"672ce262.f2ee6c","type":"inject","z":"135856ab.68e739","name":"East - OFF","topic":"","payload":"East-OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1880,"y":660,"wires":[["c510f667.c06128"]]},{"id":"d13b0b2.e22c5f8","type":"inject","z":"135856ab.68e739","name":"South - ON","topic":"","payload":"South-ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1880,"y":420,"wires":[["4d79d513.2a8a0c"]]},{"id":"bfe24fab.fa6e7","type":"inject","z":"135856ab.68e739","name":"South - OFF","topic":"","payload":"South-OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1870,"y":460,"wires":[["4d79d513.2a8a0c"]]},{"id":"f787748a.f61e08","type":"inject","z":"135856ab.68e739","name":"West - ON","topic":"","payload":"West-ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1900,"y":780,"wires":[["4377b196.fa35d"]]},{"id":"1554093.5f6a2f7","type":"inject","z":"135856ab.68e739","name":"West - OFF","topic":"","payload":"West-OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1890,"y":820,"wires":[["4377b196.fa35d"]]},{"id":"c510f667.c06128","type":"mqtt out","z":"135856ab.68e739","name":"","topic":"light/east","qos":"","retain":"","broker":"5210d17b.64d49","x":2080,"y":700,"wires":[]},{"id":"4d79d513.2a8a0c","type":"mqtt out","z":"135856ab.68e739","name":"","topic":"light/south","qos":"","retain":"","broker":"5210d17b.64d49","x":2070,"y":500,"wires":[]},{"id":"4377b196.fa35d","type":"mqtt out","z":"135856ab.68e739","name":"","topic":"light/west","qos":"","retain":"","broker":"5210d17b.64d49","x":2080,"y":860,"wires":[]},{"id":"3387667b.de846a","type":"switch","z":"135856ab.68e739","name":"","property":"svg","propertyType":"msg","rules":[{"t":"eq","v":"7","vt":"num"},{"t":"eq","v":"9","vt":"num"},{"t":"eq","v":"8","vt":"num"},{"t":"eq","v":"10","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":1630,"y":620,"wires":[["912843f.baf3dc"],["32c6ab95.c35954"],["ac222730.400898"],["e278faf9.55f938"]]},{"id":"912843f.baf3dc","type":"change","z":"135856ab.68e739","name":"Toggle North","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourNorth\") = \"lime\" ? \"North-OFF\" : \"North-ON\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1830,"y":340,"wires":[["50356687.b33318"]]},{"id":"32c6ab95.c35954","type":"change","z":"135856ab.68e739","name":"Toggle South","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourSouth\") = \"lime\" ? \"South-OFF\" : \"South-ON\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1870,"y":500,"wires":[["4d79d513.2a8a0c"]]},{"id":"ac222730.400898","type":"change","z":"135856ab.68e739","name":"Toggle East","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourEast\") = \"lime\" ? \"East-OFF\" : \"East-ON\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1870,"y":700,"wires":[["c510f667.c06128"]]},{"id":"e278faf9.55f938","type":"change","z":"135856ab.68e739","name":"Toggle East","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourWest\") = \"lime\" ? \"West-OFF\" : \"West-ON\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1890,"y":860,"wires":[["4377b196.fa35d"]]},{"id":"bca05980.570b18","type":"catch","z":"135856ab.68e739","name":"","scope":null,"uncaught":false,"x":760,"y":120,"wires":[["b69c25d2.a3d7d8"]]},{"id":"b69c25d2.a3d7d8","type":"debug","z":"135856ab.68e739","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":960,"y":120,"wires":[]},{"id":"a7469756.4c05a8","type":"ui_ui_control","z":"135856ab.68e739","name":"","events":"all","x":760,"y":180,"wires":[["12bfd856.e6beb8"]]},{"id":"12bfd856.e6beb8","type":"debug","z":"135856ab.68e739","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":970,"y":180,"wires":[]},{"id":"ef34b1f8.37e22","type":"ui_group","z":"","name":"G2","tab":"83378e2d.3c5ab","order":3,"disp":false,"width":"16","collapse":false},{"id":"5210d17b.64d49","type":"mqtt-broker","z":"","name":"HIVE","broker":"broker.hivemq.com","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"83378e2d.3c5ab","type":"ui_tab","z":"","name":"Switches","icon":"dashboard","disabled":false,"hidden":false}]

Now, if i just split the widgets into different dashboard tabs (set of four switches in an dashboard tab and widget in another dashboard tab) the flow stops working as expected. Below flow has been modified that way.

[{"id":"135856ab.68e739","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"2ede2c91.922844","type":"template","z":"135856ab.68e739","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n\n<html>\n\n<head>\n\n<style>\n\n    svg {\n      \n      margin-left: auto;\n      margin-right: auto;\n      display: block;\n    }\n\n    :root {\n        --colourNorth: {{ColourNorth}};\n        --colourEast:  {{ColourEast}};\n        --colourSouth: {{ColourSouth}};\n        --colourWest:  {{ColourWest}};\n    }\n    \n    .myicon {\n        font-family: \"FontAwesome\";\n        font-size: 30px;\n    }\n    \n    #lightNorth {\n        fill: var(--colourNorth, \"dimgray\");\n    }\n    \n    #lightEast {\n        fill: var(--colourEast, \"dimgray\");\n    }\n    \n    #lightSouth {\n        fill: var(--colourSouth, \"dimgray\");\n    }\n    \n    #lightWest {\n        fill: var(--colourWest, \"dimgray\");\n    }\n      \n</style>\n\n</head>\n\n<body>\n\n    <script>\n    let w = 200;\n    let h = 200;\n\n    var svg = d3.select(\"#Widget_G1\")\n        .append(\"svg\")\n        .attr(\"width\", w)\n        .attr(\"height\", h);\n    \nvar arc1 = d3.svg.arc()\n      .innerRadius(40)\n      .outerRadius(60)\n      .startAngle(45 * Math.PI/180) \n      .endAngle(-45 * Math.PI/180); \n  \n  var arc2 = d3.svg.arc()\n      .innerRadius(40)\n      .outerRadius(60)\n      .startAngle(45 * Math.PI/180) \n      .endAngle(135 * Math.PI/180);  \n  \n  var arc3 = d3.svg.arc()\n      .innerRadius(40)\n      .outerRadius(60)\n      .startAngle(135 * Math.PI/180) \n      .endAngle(225 * Math.PI/180);  \n  \n  var arc4 = d3.svg.arc()\n      .innerRadius(40)\n      .outerRadius(60)\n      .startAngle(-45 * Math.PI/180)  \n      .endAngle(-135 * Math.PI/180);    \n\nvar path1 = svg.append('path')\n      .attr('d', arc1)\n      .attr('stroke', 'black')\n      .attr('stroke-width', 3)\n      .attr('transform', 'translate('+ w/2 + ','+ h/2 +')')\n      .attr('id', 'lightNorth');\n  \n  var path2 = svg.append('path')\n      .attr('d', arc2)\n      .attr('stroke', 'black')\n      .attr('stroke-width', 3)\n      .attr('transform', 'translate('+ w/2 + ','+ h/2 +')')\n      .attr('id', 'lightEast');\n  \n  var path3 = svg.append('path')\n      .attr('d', arc3)\n      .attr('stroke', 'black')\n      .attr('stroke-width', 3)\n      .attr('transform', 'translate('+ w/2 + ','+ h/2 +')')\n      .attr('id', 'lightSouth');\n  \n  var path4 = svg.append('path')\n      .attr('d', arc4)\n      .attr('stroke', 'black')\n      .attr('stroke-width', 3)\n      .attr('transform', 'translate('+ w/2 + ','+ h/2 +')')\n      .attr('id', 'lightWest');\n  \n  var innerCircle = svg.append('circle')\n      .attr('cx', w/2)\n      .attr('cy', h/2)\n      .attr('r', 40)\n      .attr('fill', 'dimgray');\n  \n  var textCenter = svg.append('text')\n    .attr('y', 10 + h/2)\n    .attr('x', w/2)\n    .attr('text-anchor', 'middle')\n    .attr('class', 'myicon')\n    .attr('fill', 'yellow')\n    .text('\\uf0eb');\n  \n    </script>\n  \n    <script>\n        (function(scope){\n            d3.selectAll('path').on('click', handleClick);\n            function handleClick(x, y) {\n                scope.send({\"svg\": y});\n                console.log(\"click\");\n            };\n        })(scope);\n  </script>\n  \n  </body>\n  </html>\n  ","output":"str","x":1320,"y":620,"wires":[["5f1d13b8.2adbfc"]]},{"id":"5f1d13b8.2adbfc","type":"ui_template","z":"135856ab.68e739","group":"7f65aa.40390a58","name":"","order":1,"width":"0","height":"0","format":"","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1480,"y":620,"wires":[["3387667b.de846a"]]},{"id":"21048050.8ef92","type":"ui_switch","z":"135856ab.68e739","name":"","label":"South","tooltip":"","group":"ef34b1f8.37e22","order":3,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"South-ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"South-OFF","offvalueType":"str","officon":"","offcolor":"","x":670,"y":600,"wires":[["7605f55e.ef1a7c"]]},{"id":"bdab098b.060ce8","type":"ui_switch","z":"135856ab.68e739","name":"","label":"East","tooltip":"","group":"ef34b1f8.37e22","order":4,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"East-ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"East-OFF","offvalueType":"str","officon":"","offcolor":"","x":690,"y":720,"wires":[["82b02979.9ec6c8"]]},{"id":"f18cecda.54c9d","type":"ui_switch","z":"135856ab.68e739","name":"","label":"West","tooltip":"","group":"ef34b1f8.37e22","order":5,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"West-ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"West-OFF","offvalueType":"str","officon":"","offcolor":"","x":690,"y":860,"wires":[["49489f7c.b129a"]]},{"id":"911271ba.da531","type":"ui_switch","z":"135856ab.68e739","name":"","label":"North","tooltip":"","group":"ef34b1f8.37e22","order":2,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"North-ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"North-OFF","offvalueType":"str","officon":"","offcolor":"","x":670,"y":480,"wires":[["48257852.2f8538"]]},{"id":"48257852.2f8538","type":"change","z":"135856ab.68e739","name":"Set Global North","rules":[{"t":"set","p":"stateLightColourNorth","pt":"global","to":"payload = \"North-ON\" ? \"lime\" : \"dimgray\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":480,"wires":[["78b0f967.17a418"]]},{"id":"7605f55e.ef1a7c","type":"change","z":"135856ab.68e739","name":"Set Global South","rules":[{"t":"set","p":"stateLightColourSouth","pt":"global","to":"payload = \"South-ON\" ? \"lime\" : \"dimgray\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":600,"wires":[["78b0f967.17a418"]]},{"id":"82b02979.9ec6c8","type":"change","z":"135856ab.68e739","name":"Set Global East","rules":[{"t":"set","p":"stateLightColourEast","pt":"global","to":"payload = \"East-ON\" ? \"lime\" : \"dimgray\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":720,"wires":[["78b0f967.17a418"]]},{"id":"49489f7c.b129a","type":"change","z":"135856ab.68e739","name":"Set Global West","rules":[{"t":"set","p":"stateLightColourWest","pt":"global","to":"payload = \"West-ON\" ? \"lime\" : \"dimgray\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":860,"wires":[["78b0f967.17a418"]]},{"id":"78b0f967.17a418","type":"change","z":"135856ab.68e739","name":"Read ALL Global","rules":[{"t":"set","p":"ColourNorth","pt":"msg","to":"stateLightColourNorth","tot":"global"},{"t":"set","p":"ColourSouth","pt":"msg","to":"stateLightColourSouth","tot":"global"},{"t":"set","p":"ColourEast","pt":"msg","to":"stateLightColourEast","tot":"global"},{"t":"set","p":"ColourWest","pt":"msg","to":"stateLightColourWest","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":620,"wires":[["2ede2c91.922844"]]},{"id":"e159cda1.620ce","type":"change","z":"135856ab.68e739","name":"Read Global North","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourNorth\") = \"lime\" ? \"North-ON\" : \"North-OFF\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":480,"wires":[["911271ba.da531"]]},{"id":"cb6c1aa5.3f5938","type":"change","z":"135856ab.68e739","name":"Read Global South","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourSouth\") = \"lime\" ? \"South-ON\" : \"South-OFF\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":600,"wires":[["21048050.8ef92"]]},{"id":"e02e1b94.578558","type":"change","z":"135856ab.68e739","name":"Read Global East","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourEast\") = \"lime\" ? \"East-ON\" : \"East-OFF\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":720,"wires":[["bdab098b.060ce8"]]},{"id":"4ab046c4.99f488","type":"change","z":"135856ab.68e739","name":"Read Global West","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourWest\") = \"lime\" ? \"West-ON\" : \"West-OFF\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":860,"wires":[["f18cecda.54c9d"]]},{"id":"6533899f.f5cf98","type":"inject","z":"135856ab.68e739","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":150,"y":480,"wires":[["e159cda1.620ce","cb6c1aa5.3f5938","e02e1b94.578558","4ab046c4.99f488"]]},{"id":"88e51b4f.44a278","type":"mqtt in","z":"135856ab.68e739","name":"","topic":"light/south","qos":"2","datatype":"auto","broker":"5210d17b.64d49","x":520,"y":540,"wires":[["21048050.8ef92"]]},{"id":"6114431a.2439bc","type":"mqtt in","z":"135856ab.68e739","name":"","topic":"light/north","qos":"2","datatype":"auto","broker":"5210d17b.64d49","x":520,"y":420,"wires":[["911271ba.da531"]]},{"id":"1511edfa.ac70a2","type":"mqtt in","z":"135856ab.68e739","name":"","topic":"light/east","qos":"2","datatype":"auto","broker":"5210d17b.64d49","x":540,"y":660,"wires":[["bdab098b.060ce8"]]},{"id":"6a536e6.3a9ec9","type":"mqtt in","z":"135856ab.68e739","name":"","topic":"light/west","qos":"2","datatype":"auto","broker":"5210d17b.64d49","x":540,"y":800,"wires":[["f18cecda.54c9d"]]},{"id":"50356687.b33318","type":"mqtt out","z":"135856ab.68e739","name":"","topic":"light/north","qos":"","retain":"","broker":"5210d17b.64d49","x":2040,"y":300,"wires":[]},{"id":"4ee04e31.9189c","type":"inject","z":"135856ab.68e739","name":"North - ON","topic":"","payload":"North-ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1860,"y":300,"wires":[["50356687.b33318"]]},{"id":"64c91cf4.d3ad54","type":"inject","z":"135856ab.68e739","name":"North - OFF","topic":"","payload":"North-OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1830,"y":260,"wires":[["50356687.b33318"]]},{"id":"32c8d832.907718","type":"inject","z":"135856ab.68e739","name":"East - ON","topic":"","payload":"East-ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1880,"y":620,"wires":[["c510f667.c06128"]]},{"id":"672ce262.f2ee6c","type":"inject","z":"135856ab.68e739","name":"East - OFF","topic":"","payload":"East-OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1880,"y":660,"wires":[["c510f667.c06128"]]},{"id":"d13b0b2.e22c5f8","type":"inject","z":"135856ab.68e739","name":"South - ON","topic":"","payload":"South-ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1880,"y":420,"wires":[["4d79d513.2a8a0c"]]},{"id":"bfe24fab.fa6e7","type":"inject","z":"135856ab.68e739","name":"South - OFF","topic":"","payload":"South-OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1870,"y":460,"wires":[["4d79d513.2a8a0c"]]},{"id":"f787748a.f61e08","type":"inject","z":"135856ab.68e739","name":"West - ON","topic":"","payload":"West-ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1900,"y":780,"wires":[["4377b196.fa35d"]]},{"id":"1554093.5f6a2f7","type":"inject","z":"135856ab.68e739","name":"West - OFF","topic":"","payload":"West-OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1890,"y":820,"wires":[["4377b196.fa35d"]]},{"id":"c510f667.c06128","type":"mqtt out","z":"135856ab.68e739","name":"","topic":"light/east","qos":"","retain":"","broker":"5210d17b.64d49","x":2080,"y":700,"wires":[]},{"id":"4d79d513.2a8a0c","type":"mqtt out","z":"135856ab.68e739","name":"","topic":"light/south","qos":"","retain":"","broker":"5210d17b.64d49","x":2070,"y":500,"wires":[]},{"id":"4377b196.fa35d","type":"mqtt out","z":"135856ab.68e739","name":"","topic":"light/west","qos":"","retain":"","broker":"5210d17b.64d49","x":2080,"y":860,"wires":[]},{"id":"3387667b.de846a","type":"switch","z":"135856ab.68e739","name":"","property":"svg","propertyType":"msg","rules":[{"t":"eq","v":"7","vt":"num"},{"t":"eq","v":"9","vt":"num"},{"t":"eq","v":"8","vt":"num"},{"t":"eq","v":"10","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":1630,"y":620,"wires":[["912843f.baf3dc"],["32c6ab95.c35954"],["ac222730.400898"],["e278faf9.55f938"]]},{"id":"912843f.baf3dc","type":"change","z":"135856ab.68e739","name":"Toggle North","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourNorth\") = \"lime\" ? \"North-OFF\" : \"North-ON\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1830,"y":340,"wires":[["50356687.b33318"]]},{"id":"32c6ab95.c35954","type":"change","z":"135856ab.68e739","name":"Toggle South","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourSouth\") = \"lime\" ? \"South-OFF\" : \"South-ON\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1870,"y":500,"wires":[["4d79d513.2a8a0c"]]},{"id":"ac222730.400898","type":"change","z":"135856ab.68e739","name":"Toggle East","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourEast\") = \"lime\" ? \"East-OFF\" : \"East-ON\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1870,"y":700,"wires":[["c510f667.c06128"]]},{"id":"e278faf9.55f938","type":"change","z":"135856ab.68e739","name":"Toggle East","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"stateLightColourWest\") = \"lime\" ? \"West-OFF\" : \"West-ON\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1890,"y":860,"wires":[["4377b196.fa35d"]]},{"id":"bca05980.570b18","type":"catch","z":"135856ab.68e739","name":"","scope":null,"uncaught":false,"x":760,"y":120,"wires":[["b69c25d2.a3d7d8"]]},{"id":"b69c25d2.a3d7d8","type":"debug","z":"135856ab.68e739","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":960,"y":120,"wires":[]},{"id":"a7469756.4c05a8","type":"ui_ui_control","z":"135856ab.68e739","name":"","events":"all","x":760,"y":180,"wires":[["12bfd856.e6beb8"]]},{"id":"12bfd856.e6beb8","type":"debug","z":"135856ab.68e739","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":970,"y":180,"wires":[]},{"id":"7f65aa.40390a58","type":"ui_group","z":"","name":"G1","tab":"c778dcf4.f24d","order":3,"disp":false,"width":"8","collapse":false},{"id":"ef34b1f8.37e22","type":"ui_group","z":"","name":"G2","tab":"83378e2d.3c5ab","order":3,"disp":false,"width":"16","collapse":false},{"id":"5210d17b.64d49","type":"mqtt-broker","z":"","name":"HIVE","broker":"broker.hivemq.com","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"c778dcf4.f24d","type":"ui_tab","z":"","name":"Widget","icon":"dashboard","disabled":false,"hidden":false},{"id":"83378e2d.3c5ab","type":"ui_tab","z":"","name":"Switches","icon":"dashboard","disabled":false,"hidden":false}]

A quick test in the troubled flow shows that the click handling event is executed. The console.log statement is executed at each mouse click but not the scope.send statement. Below screenshot shows what is reported in dev tools console after I clicked five times. There are no errors reported, only the clicking events.
issue-02

This is the bit of code that manages the click event.

    <script>
        (function(scope){
            d3.selectAll('path').on('click', handleClick);
            function handleClick(x, y) {
                scope.send({"svg": y});
                console.log("click");
            };
        })(scope);
  </script>

I have almost zero knowledge on Angular. I wonder if someone can test these flows and confirm if the issue is reproducible.

Well it works as expected for me

but in your switch node you are waiting slightly different numbers
image

1 Like

Hi @hotNipi, you nailed it !

I was not expecting that the change could generate such side effect.
Thank you very much indeed !!