Problem: Switching a group

Hi,

I’ve got a problem using a group to switch multiple switches. I want to have one switch that can control multiple switches at one time (e.g. to switch some christmas lights).

Currently my sitemap looks like:

Switch item=Lampen_sw mappings=[OFF="Aus",ON="An"]

And my items file:

Group Lampen
Group:Switch:OR(ON, OFF) Lampen_sw "Alle Lampen [(%d)]" <light> (Lampen)

Switch  SteckdoseB "Funksteckdose 2" (Lampen) { exec=">[ON:/home/pi/scripts/switchBOn.sh] >[OFF:/home/pi/scripts/switchBOff.sh]" }
Switch  SteckdoseC "Funksteckdose 3" (Lampen) { exec=">[ON:/home/pi/scripts/switchCOn.sh] >[OFF:/home/pi/scripts/switchCOff.sh]" }

In the logs I can see the following output:

 [ItemCommandEvent          ] - Item 'Lampen_sw' received command ON
 [GroupItemStateChangedEvent] - Lampen changed from OFF to ON through Lampen_sw

But unfortunately the items itself (SteckdoseB and SteckdoseC) don’t change their state.

Thank you for your help!
Best regards
Philipp

Hi @Nephelo!

This is an easy one! :wink:

The items SteckdoseB and SteckdoseC belong to the “Lampen” group, but they should be part of the “Lamp_sw” group, I don’t even know if the “Lampen” group exists. So, just change the lines:

Switch  SteckdoseB "Funksteckdose 2" (Lampen) { exec=">[ON:/home/pi/scripts/switchBOn.sh] >[OFF:/home/pi/scripts/switchBOff.sh]" }
Switch  SteckdoseC "Funksteckdose 3" (Lampen) { exec=">[ON:/home/pi/scripts/switchCOn.sh] >[OFF:/home/pi/scripts/switchCOff.sh]" }

to

Switch  SteckdoseB "Funksteckdose 2" (Lampen_sw) { exec=">[ON:/home/pi/scripts/switchBOn.sh] >[OFF:/home/pi/scripts/switchBOff.sh]" }
Switch  SteckdoseC "Funksteckdose 3" (Lampen_sw) { exec=">[ON:/home/pi/scripts/switchCOn.sh] >[OFF:/home/pi/scripts/switchCOff.sh]" }

and you are ready to go!

If you still have any problem, don’t hesitate to write again.

Best regards,

Aitor

Hi Aitor,

thank you very much! Now it’s working :slight_smile:

I’ve got an other question related to this topic: In my sitemap I’ve got a switch for each light and one for the group. Unfortunately the status of the other switches is just updated after reloading the webinterface (basicui). Is it possible to show the new state directly after clicking on one switch?

Best regards
Philipp

You don’t say what version of OH you are running.

If using OH 1.8 then the answer is there is a known problem that sometimes but not always prevents the sitemap from updating properly.

If using OH 2.0b4 there was a known bug that caused the sitemaps to not update correctly. I know for sure it impacted BasicUI, maybe ClassicUI as well.

If using the latest build then this should work. What UI are you on?

Thank you very much for your information. I’m using the daily snapshot version (maybe it was not totally up to date). I used the basic ui but in the Android UI it worked.