OH2 link items from config files to channels

Is it possible to link items configured in traditional .items files to OH2 channels? – I don’t see this ability in PaperUI or HABmin, nor can I figure out the channelUID to create the link in the Karaf console.

Bigger picture, the goal is to link multiple lights together into a single channel; some of the lights are ZWave, items configured in PaperUI via the ZWave 2.x binding, and other lights are Insteon, configured in an .items file via the InsteonPLM 1.9.x binding.

Similarly, I’m looking to link HomeKit integration items from the .items file to items provided by 2.x bindings configured in PaperUI.

I’m worried I may not have fully understood the differences between items, things, and channels, going from 1.x to 2.x and I’m approaching these uses from the wrong perspective.

EDIT: I suppose I could use a rule trigged by the state change of a PaperUI item belonging to the channel, to send a similar state change command to the items configured in the .items file. There must be a better way :slight_smile:

Yes, it is, you have to write it like

Switch MyItem {channel="..."}

You can get the channel name from Paper UI

From what I see there are two options how to link channels of things to items in .items file.

Option 1: You create your item in .items file, like
Switch Light_Living_Hue “LivingRoom”

Afterwards go to PaperUI at things, go to channel, e.g. color and select in “Linked Items” the item “Light_Living_Hue”

Alternatively Option2:
Goto Paper UI at things go to channel, e.g. color, copy channel in clipbaord and insert it as channel in .items file, like
Switch Light_Living_Hue "LivingRoom" <light> {channel=hue:0210:00178821cbbf:4:color}

Both options do work for me and coming from oh1 both are fast options whereas at the moment I prefer option 2, just because being used that way from oh1

Thanks Udo, Jens, it’s working well for me. – I don’t know how I didn’t spot the channel ID in paper UI, I had been looking right at it!

A follow up question: Is it possible to link two items from a .items file with a channel, without including a thing from PaperUI? I suspect this means a method would be needed to create a channel unrelated to a thing.

If your idea is like that:

Switch MyItem1 "..." {channel="myChannel:1"}
Switch MyItem2 "..." {channel="myChannel:1"}

you should not do this (and why do you you want to?).

Hi Udo,
Yes, you’re following my madness!

My intent is to bind the state of two items belonging to separate 1.9x bindings, configured in .items files.

For example, two Switch items.

I’m accomplishing this today via rules (if itemA changes state, assign ItemA.state to ItemB…), attempting to simplify my setup by replacing these rules with a channel for shared state between items.


You don’t need no channel for this, just use one item for both bindings:

DateTime	Date	"Zeit [%1$tA, %1$td. %1$tB %1$tY %1$tT]"	<calendar>	(All)		{ ntp="Europe/Berlin:de_DE", knx="10.001:15/7/10, 11.001:15/7/11" }

That’s one item for Date & Time, set by ntp binding, sent to the knx bus (one DPT for time/weekday, another DPT for date).

Same question again, …
After configuring sitemap, items and thinks from files, it look necessary to manually apply the link to the channel. Is it a way to automate that only by modifying the files without finalize the configuration from the PAPERUI

If using Visual Studio Code with the Plugin for openHAB, you can create Items for Chanels by right-click the Channel or even the whole Thing. You have to select an items file first, of course.

Well I am using Eclipse Smart Home designer to edit the files.
I did a trial with Visual Studio Code with the OH plug-in but while editing the items I![01|690x255]! see no way to link the item to a channel

Is it not another way?

Click at the openHAB symbol. You will get a list of things and Items.

See the usage text for the openhab plugin:

I couldn’t configure the OPENHAB extension on VSC correctly but I think the solution is from the PAPERUI configuration.
I have made one successful trial

No, don’t do Simple Mode. Instead setup the plugin correctly to use text configuration or (at least) set the items manually via Paper UI. When turning off simple mode, an additional Configuration Chapter Items will appear.

Well, I don’t want to spend too much time with VSC set-up (doc is unclear or at least what I see doesn’t correspond to the doc).
Finalizing the link to channel with the PAPER UI is a minor problem anyway, I have to restart OH2 each time the MQTT bridge is updated via the things file

Setting up VSC with openHAB plugin is really easy.

  1. download VSC, install, run.
  2. within VSC, choose openHAB plugin to install (and restart VSC finally)
  3. go to VSC Settings, openHAB-Plugin and change settings fitting to your system.

No, that’s not correct. As the binding doesn’t react properly when changing things, you need to restart the mqtt addon (that’s possible through openHAB karaf console within seconds).