you can build your menu in a function node based on flow or global variables everytime you show it.
The menu gets build out of an array that contains an object for every menu item. If you attach the property enabled:“false“ to the object of an entry it gets disabled.
What I do for light switches is to just use one menu entry and just change the icon property either using fa-toggle-off or fa-toggle-on and also changing the payload property accordingly.
Here is an example of booth, the top three entries are light scenes and the fourth one is a general toogle switch for the whole room. If you select a scene i disable that menu object and change the toggle icon to on:
here is the function node that builds the menu:
[{"id":"6689e387.3992ec","type":"function","z":"909b8ee5.d1219","name":"Make Schlafzimmer Menu","func":"var Nachtlicht = {\n text:\"Nachtlicht\",\n icon:\"fa-circle-o\",\n topic:\"Nachtlicht\",\n payload:\"ON\",\n enabled:true,\n payloadType:\"string\"\n}\nvar KleinesSchlafzimmerlicht = {\n text:\"Kleines Schlafzimmerlicht\",\n icon:\"fa-adjust\",\n topic:\"KleinesSchlafzimmerlicht\",\n payload:\"ON\",\n enabled:true,\n payloadType:\"string\"\n}\nvar GrossesSchlafzimmerlicht = {\n text:\"Großes Schlafzimmerlicht\",\n icon:\"fa-circle\",\n topic:\"GrossesSchlafzimmerlicht\",\n payload:\"ON\",\n enabled:true,\n payloadType:\"string\"\n}\nvar Schlafzimmer = {\n text:\"Schlafzimmerlicht\",\n icon:\"fa-toggle-off\",\n topic:\"KleinesSchlafzimmerlicht\",\n payload:\"ON\",\n enabled:true,\n payloadType:\"string\"\n}\nvar Geraete = {\n text:\"Geräte\",\n icon:\"fa-cogs\",\n topic:\"Menu\",\n payload:\"SchlafzimmerMenu\",\n enabled:true,\n payloadType:\"string\"\n}\nvar SchlafzimmerSzenen = flow.get(\"SchlafzimmerSzenen\");\nif(typeof SchlafzimmerSzenen !== undefined){\n if(SchlafzimmerSzenen.Nachtlicht == \"ON\") Nachtlicht.enabled = false;\n if(SchlafzimmerSzenen.KleinesSchlafzimmerlicht == \"ON\") KleinesSchlafzimmerlicht.enabled = false;\n if(SchlafzimmerSzenen.GrossesSchlafzimmerlicht == \"ON\") GrossesSchlafzimmerlicht.enabled = false;\n}\nvar Schlafzimmerlicht = flow.get(\"Schlafzimmerlicht\");\nif(typeof Schlafzimmerlicht !== undefined){\n if(Schlafzimmerlicht == \"ON\"){\n Schlafzimmer.topic = \"Schlafzimmerlicht\";\n Schlafzimmer.icon = \"fa-toggle-on\";\n Schlafzimmer.payload = \"OFF\";\n }\n}\nmsg.menu = [Nachtlicht, KleinesSchlafzimmerlicht, GrossesSchlafzimmerlicht, Schlafzimmer, Geraete];\nreturn msg;","outputs":1,"noerr":0,"x":2250,"y":840,"wires":[["e30ddf34.1d84a8"]]}]
Hope this answers your question, Johannes