Problems with Hiding Groups

Hello,

I would like to hide or show groups in dependence on an active payload.
So if i get an active Payload (in my case every 1200 ms) i want to show the group, if not i want to hide it.

As second i would like to hide Groups in dependence on a msg.payload.value.

Its necessary to hide groups not tabs. Maybe hiding the Widget of the Template would be enough.

With my current state of a solution i can hide/show perfectly with an inject to "Inaktiv-Ausblenden" and "Aktiv-Einblenden".
But it should work automatically without manual injections.

I use the funktion node to have only one input node :slight_smile:
If i use my solution without injections it works not the same way.
Instead of Hiding the group the group is shown and empty except for the word "change".

May be someone can help me with that ?

[{"id":"b16eb9e0.33e118","type":"tab","label":"Ausblenden","disabled":false,"info":""},{"id":"628e92a7.40d13c","type":"ui_template","z":"b16eb9e0.33e118","group":"a6e0b3f6.06a09","name":"ZF W16","order":0,"width":0,"height":0,"format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1080,"y":90,"wires":[[]]},{"id":"8c81d92d.7b50e8","type":"switch","z":"b16eb9e0.33e118","name":"Aktiv?","property":"payload","propertyType":"msg","rules":[{"t":"empty"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":260,"y":150,"wires":[["d67f107c.1e96a"],["b14f9fcd.eecdc"]]},{"id":"79affe3a.5d873","type":"change","z":"b16eb9e0.33e118","name":"Inaktiv-Ausblenden","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"hide\":[\"ZF_W12\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":120,"wires":[["483030d7.f4e59"]]},{"id":"483030d7.f4e59","type":"ui_ui_control","z":"b16eb9e0.33e118","name":"","x":930,"y":120,"wires":[["628e92a7.40d13c"]]},{"id":"b14f9fcd.eecdc","type":"change","z":"b16eb9e0.33e118","name":"Aktiv-Einblenden","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"show\":[\"ZF_W12\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":150,"wires":[["483030d7.f4e59"]]},{"id":"d67f107c.1e96a","type":"trigger","z":"b16eb9e0.33e118","op1":"","op2":"0","op1type":"date","op2type":"str","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":520,"y":120,"wires":[["79affe3a.5d873"]]},{"id":"d12fb1a7.db5e3","type":"function","z":"b16eb9e0.33e118","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":140,"y":90,"wires":[["8c81d92d.7b50e8","628e92a7.40d13c"]]},{"id":"a6e0b3f6.06a09","type":"ui_group","z":"","name":"W16","tab":"c1c3af62.765b1","order":18,"disp":true,"width":"6","collapse":false},{"id":"c1c3af62.765b1","type":"ui_tab","z":"","name":"ZF","icon":"dashboard","order":6,"disabled":false,"hidden":false}]

A stream of input is simulated in which the payload is either empty or having a value of ON (with conditions as already incl in switch node). Or with no payload itself(no msg property as payload)(2nd flow) Hope, it serves the purpose.

[{"id":"3b22e562.33564a","type":"tab","label":"Ausblenden","disabled":false,"info":""},{"id":"47195364.6ee33c","type":"ui_template","z":"3b22e562.33564a","group":"23afabe6.add864","name":"ZF W16","order":0,"width":0,"height":0,"format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":700,"y":120,"wires":[[]]},{"id":"a186b868.4638a8","type":"switch","z":"3b22e562.33564a","name":"Aktiv?","property":"payload","propertyType":"msg","rules":[{"t":"nempty"},{"t":"empty"}],"checkall":"true","repair":false,"outputs":2,"x":180,"y":260,"wires":[["d82e281c.3e58d8"],["fac7ae0c.54c99"]]},{"id":"d002b66d.6a5958","type":"change","z":"3b22e562.33564a","name":"Inaktiv-Ausblenden","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"hide\":[\"ZF_W16\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":220,"wires":[["2ce2aebb.a04dd2"]]},{"id":"2ce2aebb.a04dd2","type":"ui_ui_control","z":"3b22e562.33564a","name":"","x":640,"y":300,"wires":[["47195364.6ee33c"]]},{"id":"fac7ae0c.54c99","type":"change","z":"3b22e562.33564a","name":"Aktiv-Einblenden","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"show\":[\"ZF_W16\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":300,"wires":[["2ce2aebb.a04dd2"]]},{"id":"d82e281c.3e58d8","type":"trigger","z":"3b22e562.33564a","op1":"","op2":"0","op1type":"date","op2type":"str","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":320,"y":220,"wires":[["d002b66d.6a5958"]]},{"id":"ca534dd1.ab61b","type":"function","z":"3b22e562.33564a","name":"","func":"var ran=Math.floor(Math.random()*100)\nvar payload=msg.payload\nif(ran<50){\n   payload=\"\"\n}\nmsg.payload=payload\nreturn msg;","outputs":1,"noerr":0,"x":110,"y":180,"wires":[["a186b868.4638a8","47195364.6ee33c"]]},{"id":"7ac43a90.e98ad4","type":"inject","z":"3b22e562.33564a","name":"","topic":"abc","payload":"ON","payloadType":"str","repeat":"1.2","crontab":"","once":true,"onceDelay":0.1,"x":100,"y":80,"wires":[["ca534dd1.ab61b"]]},{"id":"23afabe6.add864","type":"ui_group","z":"","name":"W16","tab":"d56c7d9b.ed122","order":18,"disp":true,"width":"6","collapse":false},{"id":"d56c7d9b.ed122","type":"ui_tab","z":"","name":"ZF","icon":"dashboard","order":6,"disabled":false,"hidden":false}]

2nf Flow

[{"id":"3b22e562.33564a","type":"tab","label":"Ausblenden","disabled":false,"info":""},{"id":"47195364.6ee33c","type":"ui_template","z":"3b22e562.33564a","group":"23afabe6.add864","name":"ZF W16","order":0,"width":0,"height":0,"format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":700,"y":120,"wires":[[]]},{"id":"a186b868.4638a8","type":"switch","z":"3b22e562.33564a","name":"Aktiv?","property":"payload","propertyType":"msg","rules":[{"t":"null"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":180,"y":260,"wires":[["d82e281c.3e58d8"],["fac7ae0c.54c99"]]},{"id":"d002b66d.6a5958","type":"change","z":"3b22e562.33564a","name":"Inaktiv-Ausblenden","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"hide\":[\"ZF_W16\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":220,"wires":[["2ce2aebb.a04dd2"]]},{"id":"2ce2aebb.a04dd2","type":"ui_ui_control","z":"3b22e562.33564a","name":"","x":640,"y":300,"wires":[["47195364.6ee33c"]]},{"id":"fac7ae0c.54c99","type":"change","z":"3b22e562.33564a","name":"Aktiv-Einblenden","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"show\":[\"ZF_W16\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":300,"wires":[["2ce2aebb.a04dd2"]]},{"id":"d82e281c.3e58d8","type":"trigger","z":"3b22e562.33564a","op1":"","op2":"0","op1type":"date","op2type":"str","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":320,"y":220,"wires":[["d002b66d.6a5958"]]},{"id":"ca534dd1.ab61b","type":"function","z":"3b22e562.33564a","name":"","func":"var ran=Math.floor(Math.random()*100)\nvar payload=msg.payload\nmsg.payload=payload\nif(ran<50){\n   delete msg.payload\n}\n//msg.payload=payload\nreturn msg;","outputs":1,"noerr":0,"x":110,"y":180,"wires":[["a186b868.4638a8","47195364.6ee33c","5a79aa12.e256a4"]]},{"id":"7ac43a90.e98ad4","type":"inject","z":"3b22e562.33564a","name":"","topic":"abc","payload":"ON","payloadType":"str","repeat":"1.2","crontab":"","once":true,"onceDelay":0.1,"x":100,"y":80,"wires":[["ca534dd1.ab61b"]]},{"id":"5a79aa12.e256a4","type":"debug","z":"3b22e562.33564a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":300,"y":380,"wires":[]},{"id":"23afabe6.add864","type":"ui_group","z":"","name":"W16","tab":"d56c7d9b.ed122","order":18,"disp":true,"width":"6","collapse":false},{"id":"d56c7d9b.ed122","type":"ui_tab","z":"","name":"ZF","icon":"dashboard","order":6,"disabled":false,"hidden":false}]

Thanks for your ideas in the Flow.
My Plan wasnt the best. I have to drop the Idea to hide a Tab or Widget.
Instead i will have to reduce the Space needed to Show all nessessary Informations.

Again Thanks!
Chorum

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