voruti/json2config

Question - Including the linked Channel data

MDAR opened this issue · 5 comments

MDAR commented

Hi

Because the "Linked to Thing channel" data is in a different Json file, would it be difficult to create an Item file with the Linked channel data in?

The only problem seems to be that entries of org.eclipse.smarthome.core.thing.link.ItemChannelLink.json doesn't have to be related to org.eclipse.smarthome.core.items.Item.json. This is because items can be created with textual config files and channel links still via PaperUI.
Therefore I think it's better to first convert the items into .items files and after that append the channels to this (and all other already existing) items?

In that case I think it's not very difficult.

Two more questions on this problem:

  1. Can groups have channel links?
  2. Can items have multiple channel links?
MDAR commented

That's a fair answer.
I don't know enough about how the JSON dB really works with items and things, let alone how they are linked.

As far as your other two questions go.

  1. No, I don't think Groups can be linked to anything directly, they just have children / descendents

  2. One Item can't be linked to more than one channel, however a Channel can be linked to more than one Item, with different behaviour profiles.

That's a fair answer.
I don't know enough about how the JSON dB really works with items and things, let alone how they are linked.

As far as your other two questions go.

  1. No, I don't think Groups can be linked to anything directly, they just have children / descendents

  2. One Item can't be linked to more than one channel, however a Channel can be linked to more than one Item, with different behaviour profiles.

I did some testing:

  1. Groups can be linked to channels with textual configuration files, but it doesn't do anything and isn't useful. (I will not implement this.)
  2. This is working, too. And I think it can be useful, e. g. a weather service sets a "isRaining" switch to the state on, and the same item is connected to the (control) switch of a light (the light will turn on when its raining) ...
    A channel can also be linked to multiple items, even with the same profile.
    This leads to: #4

Just found it in the docs as well: https://www.openhab.org/docs/concepts/profiles.html

So if one Channel is linked to several Items it also will have several profile instances, each handling the communication to exactly one of these Items. The same applies for the situation where one Item is linked to multiple Channels.