Thanks, will digest your pointers, but I think I may have just got it (after seeing this Use variable for item - #9 by rlkoshak)
change var groupName = i.name.toString
to var groupName = i as GroupItem
and add the .toString to the log groupName.toString
Now gives me
2022-10-24 12:24:40.686 [INFO ] [org.openhab.core.model.script.GROUP ] - gLivingRoomModeEnable (Type=GroupItem, BaseType=SwitchItem, Members=19, State=ON, Label=Living Room Mode Enable, Category=settings, Groups=[gRoomModeRoomEnable, gLivingRoomModeSettings])
2022-10-24 12:24:40.688 [INFO ] [org.openhab.core.model.script.ROOM ] - [livingRoomModeWeekdayEarlyEveningEnable, livingRoomModeWeekdayNightEnable]
2022-10-24 12:24:40.688 [INFO ] [org.openhab.core.model.script.GROUP ] - gDiningRoomModeEnable (Type=GroupItem, BaseType=SwitchItem, Members=19, State=ON, Label=Dining Room Mode Enable, Category=settings, Groups=[gRoomModeRoomEnable, gDiningRoomModeSettings])
2022-10-24 12:24:40.690 [INFO ] [org.openhab.core.model.script.ROOM ] - [diningRoomModeWeekdayEarlyMorningEnable, diningRoomModeWeekdayMorningEnable, diningRoomModeWeekdayDaytimeEnable, diningRoomModeWeekdayEarlyEveningEnable, diningRoomModeWeekdayEveningEnable, diningRoomModeWeekdayNightEnable]
Which, I think is what I want.