Switch items in group with delay and keep OR function of group

Hello community,

I’m struggeling with the following,

I would like to have a group with Group switch in which the items get switched with a delay but keep the group function OR.

I use a normal (not bounded) switch with rule in which I switch my items in a real group with for,each. This is working fine.
However when switching the items individually the “group switch” is not updated like the OR function in a real group would do.

Is this possible?
Thank you

I think you mean you want a ‘virtual’ switch to mirror the state of a group?

ITEMS
Group:Switch:OR(ON,OFF)  someGroup  "description"
Switch mySwitch "description"  {autoupdate="false"}


rule "mirror group state"
when
   Item someGroup changed
then
   if (someGroup.state != someSwitch.state) {
      someSwitch.postUpdate(someGroup.state.toString)
   }
end

You might want to disable autoupdate for the switch as shown, that will stop it updating in response to a command (since you’re going to update it by rule).

There may be a problem if you put your virtual switch on your sitemap. If just one group member is ON, a sitemap slider would also be ON and I don’t think you’ll be able to turn it ON again for the “every member on” use.

Thank you,

Yes the virtual switch should indeed reflect the state of the group switch but should act by the rule and not the group.
I think I’m helped with the auto update false.

What do you mean if the virtual switch is on the sitemap? Do you mean when one switch of the group is on its not possible to switch the complete group on with the virtual switch? (because the virtual switch is already on). You would have to switch everything off and on again? Or don’t I understand correctly?

Thanks again for your quick and detailed help.

I think it rather depends which UI you are using. Will it allow you to turn a switch ON that is already ON? Maybe you don’t care about that, don’t need the user to change it? Try it out.

If you need it, it might work better with a button-style presentation.
Sitemap -
Switch item=mySwitch mappings=[ON="ON", OFF="OFF"]

Okay, thank you.

Will try that and see what works best.