Members of group item not recognized

Can someone tell me what’s wrong with this rule ?

a group itemname is returned from teh MAP function, it’s the correct one I checked that but when execuring belo I get the error message

‘members’ is not a member of ‘java.lang.String’

the rule is as follows

rule "Set status of screens when physical switch used"


   Member of gScreenGroupButtons received update ON


    val screendirection = transform("MAP", "",

    val screengroupitem = transform("MAP", "",

    logInfo("rules", "groupitem is " + screengroupitem)

    screengroupitem.members.forEach[item | 




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", "",
    val screengroupitem = transform("MAP", "",
    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.

thanks Rich and interesting, learned a lot.

I was changing all SendCommand (…,…) instanced in my rules to Item.SendCommand(…) variations because I understood from the documentation this was a recommended change (and was afraid the SendCommand() would disapear in the future.

The other thing that is strange and what is actually the reason for the for loop (tried sending to group first) is that in another rule with items which are also strings the format Itemstring.Sendcommand() is working.

Also not that it’s not a sendcommand but a postupdate, I thought I read somewhere a postupdate doesn’t work for a group while a sendcommand does, that was another reason for the loop.

This is the working rule

rule “Catch dummy screen command and send to real screen”


Member of gScreenDummy received command


val realscreen = "NB_"

if (receivedCommand.toString == "0") { realscreen.sendCommand("UP") }

if (receivedCommand.toString == "100")  { realscreen.sendCommand("DOWN") }

if (receivedCommand.toString == "UP") { realscreen.sendCommand("UP") }

if (receivedCommand.toString == "DOWN") { realscreen.sendCommand("DOWN") }

if (receivedCommand.toString == "STOP") { realscreen.sendCommand("STOP") }


Note that when talk about string variables in rules, it has little to do with String type Items, which are complex objects with many properties, it’s just that the Item’s state property is string-shaped rather than number or on/off.

That’s correct. The state of a Group type Item is based on the state of its member Items, and you cannot update that yourself. Sending a command to a Group type Item does nothing to group itself, but instead gets passed along to all member Items.

It’s not going away. In fact the Actions are all that exists in the other OH rules languages. But when you have the Item itself it’s better to call Item.sendCommand because that method is much better at converting between the various types and Item states. The Actions only handle Strings and have to parse the String into the proper state.

But you don’t have the actual Item here, you only have the Item’s name. So your choices are to pull the Item out of the Item registry or just use the sendCommand Action.

Ah, yes, that is correct. I must have missed that part. You cannot send an update to a Group.