[r223.jython.turn off kitchen lights ] - <type ‘org.eclipse.smarthome.core.library.items.SwitchItem’>
If I simply log the raw object it returns its name and a nice tuple with all the data im trying to access, well and if I type it returns that is an eclipse Switch item.
Is there already a way to access: (Type=SwitchItem, State=ON, Label=Küchen Licht, Category=light, Tags=[Lighting], Groups=[gSonoffSwitches, gMaster_Lights, gNonWorkRelatedLights, gDoStamp, Kitchen]) values of the object?
Simiular to ir.getItem("My_Item").state? like item.group?
I have no idea how this relates to the tuple that gets printed when you log the Item itself, but I know you can get the list of Group names using ir.getItem("MyItem").groupNames and you can get the list of tags using ir.getItem("MyItem").tags. I suspect that what you are seeing is not a tuple at all but just how the Java Object’s toString prints.
I don’t know about better, but a list comprehension will work too…
def getfromgroup(locationgroup, functionalgroup):
return [item for item in itemRegistry.getItem(locationgroup).members if item in itemRegistry.getItem(functionalgroup).members]
Thank you… contributions are always welcome! There are 54 attributes and methods for a GroupItem. The helper library repo is not the proper place for them to be documented, since they do not have anything to do with the helper libraries. Javadoc has been written for them, but we still do not have a means for displaying it. However, some of the older Javadoc from ESH is still available.
Thanks This is indeed helpful i saw it in the Docs but was a little overwelmed since i just got into JSR. But this close to what i had in mind.
Yes thats good to know and im always happy to Help out The only thing for now, Holding me back is that im not fully got my had around how everything works together (JSR, Jython and the Java core?). I for example never found the source of the “itemRegistry”. So is this just a Wrapper around the Eclipse Code? Like Micropython for C?