A transform returns a String. A String is not an Item and it most definitely is not a Group Item. Strings do not have .members
. You need the actual Item.
Furthermore when you send a command to a Group Item, that command get’s passed to all of it’s members so you don’t need the for loop.
The name of an Item is already a String, so there is no need to call toString.
To write the above rule properly:
val screendirection = transform("MAP", "screenbuttonsdirection.map", triggeringItem.name)
val screengroupitem = transform("MAP", "screenbuttonsitem.map", triggeringItem.name)
logInfo("rules", "groupitem is " + screengroupitem)
sendCommand(screengroupitem, screendirection)
See Design Pattern: Associated Items for details and other strategies you can use to avoid the need for the map transforms by encoding the needed information into the Item names themselves.