GrouipItem with expire metadata

All,

I thought it would be possible to run a GroupItem with an expire-metatag, just like any other item.
My group looks like this:

Group:Switch:OR(ON,OFF) gMotion1 "Motion Hallway [%s]" <presence>{expire="3m,command=OFF"}

It’s a group switch that gets set to “ON” when one of the member (motion sensors) switch to “ON” and triggers hallway lights. The idea is that as long as group members update the GroupItem, the timer gets rescheduled, and only if no updates to “ON” occur within the timeframe of the expiration, it switches to “OFF”, and the lights along with it (via rule).

That works great with an item, but not with the GroupItem. The GroupItem switches to “OFF” as soon as all the member switch to “OFF”. Is that expected?

I know I can either use a dummy item or create timers in the rules themselves, but using the GroupItem would be much more elegant.

Thanks!

Yes.

The Group’s state is determined by the state of all its Items, and the aggregation function specified in the group definition.

Thanks, but that describes the function of the GroupItems and how to define them, but does not mention the expiration function.

I found this, where it looks like it should support that:

You can’t achieve this but not for the reasons you may expect.

You can’t send an update to a Group Item. The only way that a Group can get a state is through the aggregation function. It doesn’t maintain a state separate from that.

What you can do with Expire is configure it to send a command when the Group doesn’t change or update for a certain amount of time. That might work in this case assuming that the members do not update periodically even when there is no motion (i.e. the Items do not update to OFF every so often even when there is no motion). You can’t rely only on changes because as soon as one member changes to ON the Group will remain ON even if other Items change to ON. Put another way, only the first change to ON changes the state of the Group Item and that is what starts the expire timer. The expire timer won’t reschedule itself on the changes to ON after that point unless you have expire configured to react on updates. But if the Items are constantly updating, the expire will never have a chance to run out and issue the command.

And then you have the issue that sending a command to the Group causes that command to be sent to each member of the Group. The fact that it comes from Expire doesn’t matter. That may not cause a problem (they should all be OFF already anyway) but I don’t know if sending OFF as a command to the motion sensors muight cause problems.

You can use Expire with a Group for this though, but you’ll use it on the Group of light Switch Items. Configure the Expire to send command OFF after the desired amount of time. Make sure it reschedules on updates. Then configure a rule or follow profile or whatever to command the Group or individual members of the Group to ON whenever motion is detected.

The Group aggregation function will update the state of the Group any time any member changes state. Because Expire is rescheduling on updates it will send command OFF to all members of the Group when there hasn’t been an update for the given amount of time.

Of course this will only work if the members of the Switch Group don’t just periodically update even when there isn’t a change in state.

Thank you very much, Rich, that makes a lot of sense.
I suppose I could create a group of the switches (dimmers, really, so “Number” items, but since they all have the same value, the default EQUALITY should work), set the expire to that and post-update the group status every time the motion group updates…