Thing equivalent to getItemRegistry.getItems

In DSL I want to loop through all things and get some properties (like all things being OFFLINE)
I know how to do it with items:

import org.openhab.core.model.script.ScriptServiceUtil
var strThing = ScriptServiceUtil.getItemRegistry.getItems()

I tried a few days to find an equivalent command for things like these:






but these do not work.

Could anybody please guide me in the right direction?
Please keep in mind, I do not need a comand to get properties of a specific thing. I need a command which returns ALL things.

I don’t think there is any equivalent.
But -

yes, forgot to mention this in my original post that I have this in mind as plan b.
And thank you for your reply.
Let’s see if some developers see any way to achieve this.

Maybe I see it too much simplified but I was hoping to do a class import see here and use one of these commands:

Still learning. Please forgive any nonsense question.

An example of the method you are looking for is used here: publishMQTT not working as advertised in OH3 - #11 by rlkoshak . I am not sure if that helps.

unfortunately not. this is about getting thing status of a pre-defined thing (UID).
I need a function which returns ALL things

I have actually done this in the java rule engine jrule, as an experiment. I can readd the code if you are interested.

Regards S

I read your other thread. I think switching to java will exceed my little experience in xtend.
However, if there is some help available (example codes) I definitely would like to have a look at that.

Access to things like the Thing Registry and Item Registry is more involved than just importing a class. The Item registry gets injected into the rule when it runs. These need to be populated and linked to the actual data that openHAB is using.

So you need to get access to the ItemRegistry or ThingRegistry through org.openhab.core.model.scriptScriptServiceUtil. However, the ThingRegistry doesn’t provide a getThings() method.

The only way to get at all the Things is to query the REST API and parse the JSON that gets returned.

Hey Rich, thanks a lot for making this clear to me. A different or complementary approach I am pursuing is to get an event if the status of things changes.
I know that can be done by rule but the solution Yannick came up with is by for leaner.
May I ask you to have a look at this thread.
That is such wonderful solution but I am stuck.