Group of switches doesn't turn off

  • Platform information:
    • Hardware: _ Raspberry Pi 4 Model B Rev 1.1 4 GiB RAM_
    • OS: Raspbian GNU/Linux 11 (bullseye)
    • Java Runtime Environment: OpenJDK Runtime Environment (build 17.0.9+9-Raspbian-1deb11u1rpt1)
    • openHAB version: 4.0.4
  • Issue of the topic: please be detailed explaining your issue
    Hey, I am starting again trying to setup some light switches with OpenHab 4. I had some experience with OH2, but didn’t do much the last couple of years. So, I am a bit lost now.
    I just wanted to set up some christmas lights and am using wall plug switches (MQTT and Z-Wave). The hardware and integration is working, I can switch on and off the single items. My plan is to switch them on in the morning at a fixed time, off after sunrise and the on again in the afternoon at sunset and the off at a fixed time in the evening.
    So I just made a group switch item (type Group, semantic class Point_Control_Switch, names “Stimmungslichter”) and defined some switches as its members.
    When I turn on the group switch, all switches turn on as expected. When I turn it off, nothing happens.
    I even cannot see the switch turning of in the log (it’s off in the ui)
2023-11-30 17:15:46.767 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.BUTTON1

==> /var/log/openhab/events.log <==

2023-11-30 17:15:46.637 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Stimmungslichter' received command ON
2023-11-30 17:15:46.641 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'ZWave_Node_029_FGWP101_Metered_Wall_Plug_Switch_Switch' received command ON
2023-11-30 17:15:46.642 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'MQTTRefossPlug3_Schalter' received command ON
2023-11-30 17:15:46.643 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'TasmotaTeckinSP221_state' received command ON
2023-11-30 17:15:46.644 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'MQTTRefossPlug1_Schalter' received command ON
2023-11-30 17:15:46.646 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'ZWave_Node_029_FGWP101_Metered_Wall_Plug_Switch_Switch' predicted to become ON

2023-11-30 17:15:46.648 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'MQTTRefossPlug3_Schalter' predicted to become ON
2023-11-30 17:15:46.651 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ZWave_Node_029_FGWP101_Metered_Wall_Plug_Switch_Switch' changed from OFF to ON
2023-11-30 17:15:46.653 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'TasmotaTeckinSP221_state' predicted to become ON
2023-11-30 17:15:46.657 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'MQTTRefossPlug1_Schalter' predicted to become ON
2023-11-30 17:15:46.659 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'MQTTRefossPlug3_Schalter' changed from OFF to ON
2023-11-30 17:15:46.663 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ZWave_033_Schalter_weiss_Electric_meter_watts' changed from 0 to 2
2023-11-30 17:15:46.667 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TasmotaTeckinSP221_state' changed from OFF to ON
2023-11-30 17:15:46.669 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'MQTTRefossPlug1_Schalter' changed from OFF to ON

I don’t know what triggers the JINJA error, but it is related to the switch. But why does nothin happen on turning it off?
Am I doing something obviously wrong?
Is there a better way? Or a similar tutorial i might have missed?

Thank you!

How are you turning it ON and OFF?

If you don’t even see the command in the logs then that’s where the root problem is going to be. The OFF command isn’t getting into OH. How you are switching the Group is going to dictate where to look.

That’s related to the transformation on the Thing. That wouldn’t block the OFF command though unless the OFF command is coming from outside of OH.

It’s hard to say. There’s not enough information yet to understand what’s going on.

Thank you, Rich!
Ok, I’ll try to write down exactly what I did:
PaperUI
Administration - Settings - Items
Add Item

Name: My Group
Label: MyGroup Label
Type: Basic Types - Group
Semantic Class: Point - Switch

No members yet

Switch on via Paper UI:
“Communication error” (in the UI)
Switch off via Paper UI:
“Communication error”

Adding one Switch (of the 4 I added ifor my first post)
Switch on via Paper UI:

2023-11-30 23:26:12.346 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'MyGroup' received command ON
2023-11-30 23:26:12.349 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'MQTTRefossPlug3_Schalter' received command ON
2023-11-30 23:26:12.350 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'MQTTRefossPlug3_Schalter' predicted to become ON
2023-11-30 23:26:12.352 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'MQTTRefossPlug3_Schalter' changed from OFF to ON

And switch turns on - So the JINJA WARN message seems to be related to one of the other three switches, it’s not here anymore for just one switch.

Switch off via Paper UI:
Nothing happens, no log entries - but the switch is OFF in the ui

Ok, I was just referring to “a better way to implement something to switch several switches at once”.

I assume you mean MainUI. PaperUI does not exist past OH 2.5. It’s been replaced by MainUI since OH 3.0.

You need to give the Group a subtype to Switch.

label: All Lights
type: Group
category: light
groupNames: []
groupType: Switch
function:
  name: OR
  params:
    - ON
    - OFF
tags: []

You don’t necessarily need a function too but it is usually helpful. Without it when you command the Group it won’t change state and the UI won’t know if you’ve turned it ON or OFF and the UI element might not let you command it again.

How did you send this command? From the Item’s page, the Overview Page, the Scratchpad Script, Developer sidebar? All of these are options for sending a command to an Item through MainUI.

It’s coming from a binding. If you’ve not set up a Jinja transformation yourself I’m going to guess you’ve autodiscovered some MQTT Things.

1 Like

Thanks again! That fixed it for me!

Yeah, sorry…

That’s the missing part, thank you!

From the item’s page.

Ok, I’ll look into it later, I had an autodiscovered MQTT Thing, thanks for telling me where to look.
I’ll see if I can automate turning them on and off before Christmas is over.