Tracking visibility status of a node

Hi. I have created three switch toggles (ui-switch) to control the visibility of three groups (B, Y, and Dev). Each group makes an HTTP GET request to a server and displays the values of two variables (A and B) on two text nodes. Based on the value of variable A, I use then, the audio-out node to play a .wav sound hosted on the web also using HTTP GET. Is there a way that I can check in a function if a group is visible, and if it is not, not to play the sound or even not to make the HTTP request to play the audio?

Here is the code just in case:

[{"id":"0ff5107726251a7b","type":"ui_switch","z":"af973086eb22abf7","name":"","label":"B","tooltip":"","group":"9967f535930bde14","order":3,"width":3,"height":1,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"{\"group\":{\"show\":[\"Dashboard_Blue\"]}}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"group\":{\"hide\":[\"Dashboard_Blue\"]}}","offvalueType":"json","officon":"","offcolor":"","animate":false,"className":"","x":1070,"y":160,"wires":[["4161f1cbf1b491ec"]]},{"id":"d0cdd265512356d6","type":"ui_switch","z":"af973086eb22abf7","name":"","label":"Y","tooltip":"","group":"9967f535930bde14","order":2,"width":3,"height":1,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"{\"group\":{\"show\":[\"Dashboard_Yellow\"]}}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"group\":{\"hide\":[\"Dashboard_Yellow\"]}}","offvalueType":"json","officon":"","offcolor":"","animate":false,"className":"","x":1070,"y":200,"wires":[["4161f1cbf1b491ec"]]},{"id":"e81f690a506457e3","type":"ui_switch","z":"af973086eb22abf7","name":"","label":"R","tooltip":"","group":"9967f535930bde14","order":1,"width":3,"height":1,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"","onvalueType":"json","onicon":"","oncolor":"","offvalue":"","offvalueType":"json","officon":"","offcolor":"","animate":false,"className":"","x":1070,"y":240,"wires":[["4161f1cbf1b491ec"]]},{"id":"bf91250ea47f8d98","type":"ui_switch","z":"af973086eb22abf7","name":"","label":"Dev","tooltip":"","group":"9967f535930bde14","order":4,"width":3,"height":1,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"{\"group\":{\"show\":[\"Dashboard_Dev\"]}}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"group\":{\"hide\":[\"Dashboard_Dev\"]}}","offvalueType":"json","officon":"","offcolor":"","animate":false,"className":"","x":1070,"y":280,"wires":[["4161f1cbf1b491ec"]]},{"id":"4161f1cbf1b491ec","type":"ui_ui_control","z":"af973086eb22abf7","name":"","events":"all","x":1260,"y":220,"wires":[[]]},{"id":"791bca6e1658bdf1","type":"comment","z":"af973086eb22abf7","name":"Toggles to make groups visible","info":"","x":1150,"y":100,"wires":[]},{"id":"4e76df42e55de63f","type":"inject","z":"af973086eb22abf7","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"6","crontab":"","once":true,"onceDelay":"0.20","topic":"","payload":"","payloadType":"date","x":90,"y":980,"wires":[["85c8daa2ccc414e8"]]},{"id":"2c23d8a49ddad178","type":"http request","z":"af973086eb22abf7","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.0.75/code","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":390,"y":880,"wires":[[]]},{"id":"c8a905611e1d6e33","type":"json","z":"af973086eb22abf7","name":"","property":"payload","action":"","pretty":false,"x":570,"y":880,"wires":[[]]},{"id":"7a415a86f93310f1","type":"change","z":"af973086eb22abf7","name":"Code","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.code","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":920,"wires":[["5fb3ee0d69a81bde"]]},{"id":"8f218f33931e2770","type":"debug","z":"af973086eb22abf7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1150,"y":900,"wires":[]},{"id":"85c8daa2ccc414e8","type":"function","z":"af973086eb22abf7","name":"","func":"source = Math.round(Math.random()*10);\ncode = Math.round((Math.random()*30)+0);\n\nmsg.payload = {\n    source, code\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":980,"wires":[["7a415a86f93310f1","2fd3f7c4bede209d"]]},{"id":"08ed86aacd811aa9","type":"ui_text","z":"af973086eb22abf7","group":"2b7cad2b43afc9b8","order":2,"width":0,"height":0,"name":"","label":"Code Blue_Puppet","format":"{{msg.payload}}","layout":"row-spread","className":"","x":1170,"y":940,"wires":[]},{"id":"5fb3ee0d69a81bde","type":"rbe","z":"af973086eb22abf7","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":870,"y":920,"wires":[["08ed86aacd811aa9","d6b81f1c0459ea2e"]]},{"id":"2fd3f7c4bede209d","type":"change","z":"af973086eb22abf7","name":"Source","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.source","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":840,"wires":[["146f0a14fa8f9b2c"]]},{"id":"146f0a14fa8f9b2c","type":"rbe","z":"af973086eb22abf7","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":870,"y":840,"wires":[["9cf214c84060a29e"]]},{"id":"a5e1b6e52c6727f2","type":"debug","z":"af973086eb22abf7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1150,"y":860,"wires":[]},{"id":"9cf214c84060a29e","type":"ui_text","z":"af973086eb22abf7","group":"2b7cad2b43afc9b8","order":1,"width":0,"height":0,"name":"","label":"Source Blue_Puppet","format":"{{msg.payload}}","layout":"row-spread","className":"","x":1180,"y":820,"wires":[]},{"id":"8a8ee83993d94625","type":"comment","z":"af973086eb22abf7","name":"Read from Puppet","info":"","x":110,"y":920,"wires":[]},{"id":"d6b81f1c0459ea2e","type":"function","z":"af973086eb22abf7","name":"","func":"var codeVal = msg.payload;\n\nmsg.url = \"http://nonmyth.danielecheverri.co/numbers/\"+codeVal+\".wav\";\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":980,"wires":[["1d0e69fce9194438"]]},{"id":"1d0e69fce9194438","type":"http request","z":"af973086eb22abf7","name":"Download m3","method":"GET","ret":"bin","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"credentials":{},"x":900,"y":1020,"wires":[["486ca02fa1e797ce"]]},{"id":"486ca02fa1e797ce","type":"ui_audio","z":"af973086eb22abf7","name":"BlueOut","group":"2b7cad2b43afc9b8","voice":"","always":true,"x":1140,"y":1020,"wires":[]},{"id":"9967f535930bde14","type":"ui_group","name":"Toggles","tab":"e562a4a.39a9e58","order":1,"disp":false,"width":6,"collapse":false,"className":""},{"id":"2b7cad2b43afc9b8","type":"ui_group","name":"Blue","tab":"e562a4a.39a9e58","order":3,"disp":true,"width":6,"collapse":false,"className":""},{"id":"e562a4a.39a9e58","type":"ui_tab","name":"Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.