All items

Hi there

For debug purposes I want to go through all defined items and output name & state.

I am sure there is a way to access all defined items from within a rule. But I can’t find it.

Loop through all members in a group with OH2

Is there a global group that contains all defined items?

Because I don’t like to create & maintain one manually…

If this is for debug purposes, why not user the REST API instead? You can get all the others, their current state, and a host of other information.

Perhaps not the best, but I think that within the Android App for OH2 there is a built in ‘Home’ sitemap that will list all items where you can see all channels associated with that item.

I’m not sure if you can access that via IOS or in a browser though.

First this,


Then this


Maybe some background:
I am building an alarm system based on Xiaomi sensors. It doesn’t have a traditional interface and I do not intend to use the android / web interface on a daily basis.
Instead I use the Xiaomi cube (a small cube that recognizes & reports different motions like turn, flip, shake, throw, etc). Different movements are used to select between different montoring states, and arm and disarm the system.
The Xiaomi gateway night lights are used to inform the user about different states (solid yellow light for staying home, red for leaving home, flashing red for alarm, flashing blue for windows open for >5 minutes, etc).

All seems to be working weel, but to iron out the last bug it’s helpful to just dump the current state of all items in a human readable way without accessing a computer and without looking into logfiles.

What I do is send a basic string representation of all items via email
Something like

Right now I maintain a separate group ALLITEMS containing all relevant items, and whenever I want the state I just turn my Xiaomi cube upside down to invoke a rule that builds a string representation for each item in ALLITEMS, and sends this via email and writes it to the log.

It would just be nice to not maintain the ALLITEMS group manually, but instead use a system provided group. Such a group must exist internally in OH2 but the question is: Is it accessible?

Of course this is possible using the REST API but I haven’t looked into this in detail to understand what rule coding is required to extract name & value for each item. And using a webservice for an internal call from within a rule has some code design smell for me.

The android home sitemap looks OK, but is not a way to permamenty document the current system state.

That only lists Things, not Items.

I don’t think that necessarily follows. There certainly is an internal representation of all Items and their states, but there is no reason to assume this internal representation uses Groups in any way.

The only way I know to get a full list of Items is through the REST API or through the Karaf console.

It actually wouldn’t work very well because it only shows Things created within PaperUI.

You are right. Internally it could be anything, list, maps, sets, whatever. But maybe it just isn’t accessible.

I don’t use the paper UI for configuration but only files, but for me the home sitemap lists all the things that have items defined, and a detail view of their items.
This sitemap does not show virtual items, it does not show things that have no items defined, and it does not show channels that don’t have an asociated item definition.
So you are right, this sitemap doesn’t work well. I work quite a bit with virtual items so without these its an incomplete picture.

Seems like I need to stick to my manual ALLITEMS group

Its been a while, Also I have not read all posts.
Get the “Visual Studio Code” OpenHab hub extension.
It will list all your Things. All you Items structured within your Groups. With there current State.
You Also can creat Items directly from your Things Channel etc.