Close few selected groups

I'm trying to send command witch should close the selected groups, but that work with very strange way. After deploy a flow and send close order, one of selected groups is closed the rest remains still open (not always the same?!).


[{"id":"c40faf1bff6843bd","type":"tab","label":"Flow","disabled":false,"info":"# Shows Examples from [Vega Example Gallery](https://vega.github.io/vega/examples/).\n\n- press button of inject node to initialize dropdown menu\n- examples are displayed on **Example 2 - Vega** tab.\n- "},{"id":"06e9c33550b7b4f3","type":"ui_numeric","z":"c40faf1bff6843bd","name":"zone 2","label":"","tooltip":"","group":"d70a6485ad08e874","order":2,"width":5,"height":1,"wrap":false,"passthru":false,"topic":"","topicType":"str","format":"{{msg.payload}} %","min":"0","max":"100","step":"1","className":"","x":870,"y":140,"wires":[[]]},{"id":"90268785ce46502e","type":"ui_numeric","z":"c40faf1bff6843bd","name":"zone 3","label":"","tooltip":"","group":"59d5f7c28adb7156","order":3,"width":5,"height":1,"wrap":false,"passthru":false,"topic":"","topicType":"str","format":"{{msg.payload}} %","min":"0","max":"100","step":"1","className":"","x":870,"y":180,"wires":[[]]},{"id":"b9a776cc8934d208","type":"ui_numeric","z":"c40faf1bff6843bd","name":"zone 1","label":"","tooltip":"","group":"b87e85fbe518f1ce","order":1,"width":5,"height":1,"wrap":false,"passthru":false,"topic":"","topicType":"str","format":"{{msg.payload}} %","min":"0","max":"100","step":"1","className":"","x":870,"y":100,"wires":[[]]},{"id":"fa734bf9a72fbded","type":"inject","z":"c40faf1bff6843bd","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":250,"y":40,"wires":[["0e0b85f4748e7862"]]},{"id":"39b39830f382f375","type":"debug","z":"c40faf1bff6843bd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":690,"y":140,"wires":[]},{"id":"0e0b85f4748e7862","type":"function","z":"c40faf1bff6843bd","name":"Close all groups","func":"msg.payload = {\"group\":{\"close\":[\n    \"MyGroups_GroupA\",\n    \"MyGroups_GroupB\",\n    \"MyGroups_GroupC\"\n\n]}};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":40,"wires":[["39b39830f382f375","36dde214bdaa18ef"]]},{"id":"36dde214bdaa18ef","type":"ui_ui_control","z":"c40faf1bff6843bd","name":"","events":"all","x":880,"y":40,"wires":[[]]},{"id":"d70a6485ad08e874","type":"ui_group","name":"GroupB","tab":"30414ecef55d0256","order":8,"disp":true,"width":"5","collapse":true,"className":"TempCtrlGroupSettings"},{"id":"59d5f7c28adb7156","type":"ui_group","name":"GroupC","tab":"30414ecef55d0256","order":9,"disp":true,"width":"5","collapse":true,"className":"TempCtrlGroupSettings"},{"id":"b87e85fbe518f1ce","type":"ui_group","name":"GroupA","tab":"30414ecef55d0256","order":7,"disp":true,"width":"5","collapse":true,"className":"TempCtrlGroupSettings"},{"id":"30414ecef55d0256","type":"ui_tab","name":"MyGroups","icon":"dashboard","order":12,"disabled":false,"hidden":false}]

Node-RED version: v2.0.6
Node.js version: v16.13.0
Dashboard version 3.0.4

Best regards,
Krzysztof

the flow you provided is only one node not the entire flow

I'm sorry, I've edited my post and put the whole flow.

You hide tabs, not close them

msg.payload = {"group":{"close":[
    "MyGroups_GroupA",
    "MyGroups_GroupB",
    "MyGroups_GroupC"

]}};

should be

msg.payload = {"group":{"hide":[
    "MyGroups_GroupA",
    "MyGroups_GroupB",
    "MyGroups_GroupC"

]}};

Yes, but I don't want to hide the groups, I want to close selected groups.
According to instruction, this should be possible:

C o

Both show/hide and open/close work for me. Here is an example flow:

[{"id":"a5f14c91df0bdd4f","type":"ui_numeric","z":"4c53afb80e3324a8","name":"zone 2","label":"","tooltip":"","group":"93c0ae27724e30ac","order":2,"width":5,"height":1,"wrap":false,"passthru":false,"topic":"","topicType":"str","format":"{{msg.payload}} %","min":"0","max":"100","step":"1","className":"","x":770,"y":220,"wires":[[]]},{"id":"26acbf9803f0bf82","type":"ui_numeric","z":"4c53afb80e3324a8","name":"zone 3","label":"","tooltip":"","group":"6d362c521372c2da","order":3,"width":5,"height":1,"wrap":false,"passthru":false,"topic":"","topicType":"str","format":"{{msg.payload}} %","min":"0","max":"100","step":"1","className":"","x":770,"y":260,"wires":[[]]},{"id":"6b277beaad37b8c5","type":"ui_numeric","z":"4c53afb80e3324a8","name":"zone 1","label":"","tooltip":"","group":"b87e85fbe518f1ce","order":1,"width":5,"height":1,"wrap":false,"passthru":false,"topic":"","topicType":"str","format":"{{msg.payload}} %","min":"0","max":"100","step":"1","className":"","x":770,"y":180,"wires":[[]]},{"id":"d16906d2cc3c7ede","type":"inject","z":"4c53afb80e3324a8","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":120,"wires":[["b269e00d16d197b8"]]},{"id":"b269e00d16d197b8","type":"function","z":"4c53afb80e3324a8","name":"Close all groups","func":"msg.payload = {\"group\":{\"close\":[\n    \"MyGroups_GroupA\",\n    \"MyGroups_GroupB\",\n    \"MyGroups_GroupC\"\n\n]}};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":120,"wires":[["07044d4ff8890f49"]]},{"id":"07044d4ff8890f49","type":"ui_ui_control","z":"4c53afb80e3324a8","name":"","events":"all","x":760,"y":80,"wires":[[]]},{"id":"3c86a2a18c2aec09","type":"inject","z":"4c53afb80e3324a8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"42","payloadType":"num","x":370,"y":220,"wires":[["6b277beaad37b8c5","a5f14c91df0bdd4f","26acbf9803f0bf82"]]},{"id":"3ef4b10f748b09e9","type":"function","z":"4c53afb80e3324a8","name":"hide all groups","func":"msg.payload = {\"group\":{\"hide\":[\"MyGroups_GroupA\",\"MyGroups_GroupB\",\"MyGroups_GroupC\"]}};\n\n\nreturn msg;\n\n\n//{\"group\": {\"hide\": [\"tab_name_group_name_with_underscores\"] \"focus\": true}}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":40,"wires":[["07044d4ff8890f49"]]},{"id":"4ecc4d8fab5c7eb0","type":"inject","z":"4c53afb80e3324a8","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":40,"wires":[["3ef4b10f748b09e9"]]},{"id":"de2acf12c568357e","type":"function","z":"4c53afb80e3324a8","name":"show all groups","func":"msg.payload = {\"group\":{\"show\":[\"MyGroups_GroupA\",\"MyGroups_GroupB\",\"MyGroups_GroupC\"]}};\n\n\nreturn msg;\n\n\n//{\"group\": {\"hide\": [\"tab_name_group_name_with_underscores\"] \"focus\": true}}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":80,"wires":[["07044d4ff8890f49"]]},{"id":"effdcb6f5b185818","type":"inject","z":"4c53afb80e3324a8","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":80,"wires":[["de2acf12c568357e"]]},{"id":"5dcf1fbab82ec1fb","type":"inject","z":"4c53afb80e3324a8","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":160,"wires":[["46c06bc1fbe4c03c"]]},{"id":"46c06bc1fbe4c03c","type":"function","z":"4c53afb80e3324a8","name":"open all groups","func":"msg.payload = {\"group\":{\"open\":[\n    \"MyGroups_GroupA\",\n    \"MyGroups_GroupB\",\n    \"MyGroups_GroupC\"\n\n]}};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":160,"wires":[["07044d4ff8890f49"]]},{"id":"93c0ae27724e30ac","type":"ui_group","name":"GroupB","tab":"30414ecef55d0256","order":8,"disp":true,"width":"5","collapse":true,"className":"TempCtrlGroupSettings"},{"id":"6d362c521372c2da","type":"ui_group","name":"GroupC","tab":"30414ecef55d0256","order":9,"disp":true,"width":"5","collapse":true,"className":"TempCtrlGroupSettings"},{"id":"b87e85fbe518f1ce","type":"ui_group","name":"GroupA","tab":"30414ecef55d0256","order":7,"disp":true,"width":"5","collapse":true,"className":"TempCtrlGroupSettings"},{"id":"30414ecef55d0256","type":"ui_tab","name":"MyGroups","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Make sure to clear your browser cache.

if this doesn't work for you, please stop/start node-red and copy the startup log and paste it to a response.

I've tested your code:

  • show / hide works on all groups
  • close / open work only on GroupA, after clear cache and cookies close / open doesn't work at all.
    I've tested my code on three PC with the same result (tested browsers Edge and Chrome).

Log from node-red:

12 Nov 12:42:04 - [info]

Welcome to Node-RED
===================

12 Nov 12:42:04 - [info] Node-RED version: v2.1.3
12 Nov 12:42:04 - [info] Node.js  version: v16.13.0
12 Nov 12:42:04 - [info] Windows_NT 10.0.19043 x64 LE
12 Nov 12:42:05 - [info] Loading palette nodes
12 Nov 12:42:06 - [info] Dashboard version 3.1.1 started at /ui
12 Nov 12:42:06 - [info] Settings file  : C:\Users\K***k\.node-red\settings.js
12 Nov 12:42:06 - [info] Context store  : 'default' [module=memory]
12 Nov 12:42:06 - [info] User directory : \Users\K***k\.node-red
12 Nov 12:42:06 - [warn] Projects disabled : editorTheme.projects.enabled=false
12 Nov 12:42:06 - [info] Flows file     : \Users\K***k\.node-red\flows.json
12 Nov 12:42:06 - [info] Server now running at http://127.0.0.1:1880/
12 Nov 12:42:06 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

12 Nov 12:42:06 - [info] Starting flows
12 Nov 12:42:06 - [info] Started flows

Interesting I upgraded my dashboard to 3.1.1 (I was on 3.1.0) and it still works but I'm running on macOS.

Can you test with FireFox?

[edit: I've asked someone I know who uses NR to try the flow on his windows cmputer and see what happens]

I had time checking "close" function and confirmed it does not work.
Dashboard 3.1.1, Node-RED 2.1.3
Node-RED runs on RPI3b.
Use Google chrome at another computer. None of the groups are closed. So it is different from Krzysztof's symptom.

"Hide" function always works. But if you hide something and there are data coming in to the hided group, system resource is still used, which is not desired.

A solution is to hide the group and use function node or simple gate node to shutdown the input to the group and output from the group.

@davidz @Krzysztof @dceejay

Ok, I've finally reproduced this and open/close does not work in FireFox or Chrome but does work on one of my Mac's in Safari but not the other! It also doesn't work running NR on an RPI 3 Model B Rev 1.2 (buster) Node-red v2.0.6, Node.js v14.17.6 dashboard v3.0.4 and using my Mac M1 with Safari

I'll open an issue with more details in GitHub.

It also doesn't work running NR on an RPI 3 Model B Rev 1.2 (buster) Node-red v2.0.6, Node.js v14.17.6 dashboard v3.0.4 and using my Mac M1 with Safari (the same machine it works

2 Likes

What happens if you close/open manually first ?

Whoo, it starts workin in all cases!

@Krzysztof @davidz can you two see if Dave's suggestin gets it working for you? Manually close the groups and see if open/close start working.

Yes!, after first manually close and open groups, commands from server starts working (but only with groups which was first manually closed / open)!

Umm, what if a user turns off/on the system?

Or get a fresh system?

Or change to a new web browser?

This isn't intended as a solution, just a test to see if you are seeing the same problem as others. In which case I am sure a fix will be along shortly.

The problem occur after change a browser (open dashboard on new client) or after clear cache on used browser.

I am wondering if its a browser "safety" thing. A bit like not playing audio until allowed.

Maybe the solution of that problem is just add option to start server / client with default closed group. After open a closed group by a user the safety will be unlock.

When I've founding the way of open / close metod, I found a lot of similar topics, when people just wanted start application with closed group.
For example, I have a tab with settings of my application. On this page is a lot of groups, after load the page user see a big mess, but if the same tab is open with closed all groups, then user can in easy way navigated to demand setting.

@Colin Yes it is good to have this feature in future releases.
@Krzysztof It is good to manage different types of groups and truly turn off the groups (shutdown inputs and outputs), instead of just hiding them.