That wording probably needs to be changed because it gives the wrong idea. In your case Testlight is a decendent of gHouse but it is not directly a member of gHouse. Only gGroundfloor is a direct member of gHouse.
The Member of trigger only goes one layer deep in the hierarchy. So it will only trigger for direct members of gHouse, not decedents lower down than that.
If that’s the case it doesn’t really matter how the Member of trigger works. Calling allMembers
traverses the subgroups and returns all the members of the Group and all the members of the subgroups (but not the subgroups themselves). So, assuming that the all the non-Group Items under gHouse and gGroundfloor were Switch Items, your forEach will work as written.
Now to address the real problem, turning off everything in the house. There are several approaches.
-
Forget using the “location” based Groups for this. Create an AllSwitches Group defined as
Group:Switch:OR(ON, OFF) AllSwitches
. To turn off all the switches at once useAllSwitches.sendCommand(OFF)
. -
gHouse.allMembers.filter[ i | i instanceof SwitchItem || i instanceof DimmerItem || i instanceof ColorItem ].forEach[ i | i.sendCommand(OFF) ]
-
Import the image registry (see Design Pattern: Associated Items) and you can get all Items with a given tag. If you use the semantic tagging (you really should) you can grab every Item with a Switch tag using
getItemsByTag("Switch")
.