Reading Channel which is not an Item

For a dynamical offline detection, I try to achieve reading a thing channel which is not an Item. I know how to use Items, i just want to make it dynamical without use of Items for every channel. So here a simple channel example which shows no value, just to show you what I mean:

var thingStatusInfo = getThingStatusInfo(“homematic:HG-HM-Sen-MDIR-WM55:77553c53:OEQ0535505:3#BRIGHTNESS”)

logInfo(“test.rules”, “Value:” + thingStatusInfo.getDescription() .toString() )

In log there is just shown:
2019-08-18 14:06:00.023 [INFO ] [me.model.script.test.rules]

My understanding is the main purpose of the Item is to tell OH to pay attention to that channel and let you manage it accordingly
Channels not linked to Things are therefore ignored by OH except for linking an Item.

Items represent capabilities that can be used by applications, either in user interfaces or in automation logic. Items have a State and they may receive commands.


This would be something like ONLINE or INITIALIZING and not the value that you are looking for.

What problem do you have in using Items?

1 Like

As I mentioned, i loop all thing with gOfflineCounter.members.forEach to check their states to dynamically detect offline members. But this is a different topic. Would be elegant to read the channels without defining them as Item. Is there no way to read a channel by direct address?

Why would you do that? You assign a channel to an Item and read the Item. It doesn’t cost you anything. What do you hope to gain? Perhaps there is another approach.

I think some bindings don’t even bother to calculate channel states for channels that are not linked, so you could be disappointed anyway.


Home Assistant uses entities but OpenHAB breaks things down intoThings, Channels, and Items.
That is part of the core design of OpenHAB. Perhaps either you should approach the issue differently or openHAB may not be the tool you need to accomplish this.

Dropped over this topic when looking about a possibility how I could solve following problem:
Iteration over all of my battery powered Things and query the state of the battery state channels without to have to define an item for the battery state.
The code could be then written so that I do not have to take care when a new thing has been added.

What do you think you will gain from avoiding Items?

1 Like

I have to add each and every item manually. I am looking for a solution for traversing e.g.:

  • all things of type HomeMatic
  • look for channel named battery
  • get the state of that channel
  • send an alarm if the battery low is indicated.
    the same for other thing type like Tradfri controls, and so on.
    now that we can do rules in Python the things are much more simpler to write.

With no requirement for UI or persistence, you should have no trouble.

TMK, only Items store states (Channels do not), so this is not possible. But you could have a rule that triggers when new Things are created, filter on HomeMatic Things, then programmatically add Items linked to the battery Channels and added into a group, and then reload your “Member of” triggered battery monitor rule.

1 Like

This was my last resort. Though it would be a scan of all things once daily and add/delete battery channels/items.
Thanks for support.

How do you manage the useful working channels of these devices, as it’s the same chore to make Items?
I’m just curious how much effort could be saved if you are in any case managing other stuff manually.
I appreciate a great many devices will have a battery state, it’s a good candidate for automation. Maybe it’s possible to examine thing or other linked Items to determine useful info - “battery alarm X1Q67” to “battery front door sensor”.

It’s all like making simple mode a bit less dimwitted.