Set default state of a group

I saw in [SOLVED]Set default item state to OFF instead of NULL that I can use a rule to set a default state of items.

Is there an easy way I can set a whole group - ie all my motion_detection items in one command:
eg g_motion_detection.postUpdate(OFF)
Is that possible, or do I have to iterate them?

It definitely works with sendCommand. I’m not sure if it works with postUpdate.

Give it a try and report back here.

I believe not.
There were contact items though.
So

g_motion_detection.postUpdate(CLOSED)

did nothing, but I’ve managed to replicate what I want with:

g_motion_detection.allMembers.forEach[g |
		logInfo("AlarmSetOff","Item " + g.name + " state: " + g.state.toString )
		g.postUpdate(CLOSED)
]