Can I override a group switch's press behaviour to issue [group topic]?

  • Platform information:
    • Hardware: Raspberry Pi Model B Rev 2
    • OS: Openhabian
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: openHAB 2.5.7-1 (Release Build)

Right now, I have a Switch to control a group of MQTT-controlled tasmota smart sockets, connected to lights. When toggling this switch, all four of these lights will be toggled one by one.

I much prefer the MQTT ‘group topic’ behaviour: if I send cmnd/sfeerlampen/POWER toggle, all lights will be toggled at once.

Is there a way to override a group switch’s action yet still keep the nice ‘OR(ON,OFF)’ behaviour of the switch and icons? In other words, I want to have openhab emit cmnd/sfeerlampen/POWER toggle when hitting the switch but I also want it to keep showing the ‘calculated group state’.

items.conf:

Group:Switch:OR(ON,OFF) sfeerlampen "Sfeerlampen"

Switch woonkamerlamp_muur "Woonkamerlamp muur" (sfeerlampen) { channel="mqtt:topic:apparaten:woonkamerlamp_muur", ga="Light", autoupdate="false" }
Switch woonkamerlamp_kast "Woonkamerlamp muur" (sfeerlampen)  { channel="mqtt:topic:apparaten:woonkamerlamp_kast", ga="Light", autoupdate="false" }
Switch marokkaanse_lamp_klein "Marokkaanse lamp klein" (sfeerlampen)  { channel="mqtt:topic:apparaten:marokkaanse_lamp_klein", ga="Light", synonyms="kleine marokkaanse lamp", autoupdate="false"}
Switch marokkaanse_lamp_groot "Marokkaanse lamp groot" (sfeerlampen)  { channel="mqtt:topic:apparaten:marokkaanse_lamp_groot", ga="Light", synonyms="grote marokkaanse lamp", autoupdate="false"}

sitemap.conf:

Switch item=sfeerlampen label="Sfeerlampen [MAP(switch.map):%s]" icon="light"
Switch item=woonkamerlamp_muur label="Woonkamerlamp muur [MAP(switch.map):%s]" icon="light"
Switch item=woonkamerlamp_kast label="Woonkamerlamp kast [MAP(switch.map):%s]" icon="light"
Switch item=marokkaanse_lamp_klein label="Marokkaanse lamp klein [MAP(switch.map):%s]" icon="light"
Switch item=marokkaanse_lamp_groot label="Marokkaanse lamp groot [MAP(switch.map):%s]" icon="light"

No. If you send a command to a Group, it is distributed to all members, no option.

You can make a dummy Item. A rule can listen for commands to that Item from the UI, and do what you like with it - maybe an MQTT Action in this case.
Meantime, another rule can listen for state changes on your real Group Item and copy them to the dummy Item for display…

That’s a nice workaround.

For those reading this topic later on: I ended up upgrading my Raspberry Pi 1 to a Raspberry Pi 4 which made a big difference. Now, all lights are toggled (almost) at once.