Get item channel data

Hello, is there a way to get item channel data using openhab-js javascript interface inside rule execution context?
E.g. getItem

const myItem = items.getItem("my_item");
// get the item channel data, etc.

I’d like to get the channel data from the following defined item:

Number DoorSwitch_AlarmTimer <clock> { channel="mihome:sensor_magnet_aq2:xxxxxxxxxx:yyyyyyyyyyyyyyyyy:isOpenAlarmTimer" }

Thanks in advance,
Rado

The link between the Item and the Channel is not actually a property on the Item. It’s a wholly separate entity and there is no way I know of to get from just an Item to the Link and from there to the Channel. If you get access to the ItemChannelLinkRegistry there appears to be a way to get all the ItemChannelLinks for a given Item’s name. From the ItemChannelLink you can get to the ChannelUID and from there you can get the ID as a String.

Conceptually though, this should never be necessary. One of the whole points of Items is so that rules, persistence, UIs, etc. never have to know nor care anything about technology that an Item is linked to. A Zwave Switch is the same as a KNX Switch is the same as a virtual Switch; they are just a Switch. This is by design and it’s a good thing.

What should matter is what the Item represents. You should be doing things to it in your rules because the Item represents the living room lamp (and the Item should be named appropriately), not because it’s linked to some Channel.

So to avoid the XY Problem, why do you need the “channel data” for an Item? What do you mean by “channel data” in the first place? What is the root problem you are trying to solve?