This is really a beginner question and I was about to give up a couple of times. Reading through all the documentation on this side and external pages I’m now totally confused about the question when to create items.
I use Homematic components (mostly thermostats). I thought that items don’t need to be mentioned in the .items file because they are stored in the db in OH2.
Therefore I thought, for example, to set a new temperature I just need to copy the channel that is listed in the PaperUI in “Configuration” --> “Things” --> “Channels” and in this case the “Set Temperature” channel and add it only in the sitemap.
However other docs state that you have to create items for setting the temperature and that you use those items in the sitemap.
When I look at the openhab-config files that ThomDietrich lists in his github I can see that he also defines the homematic components in his item list.
So now I’m confused when to create items (esp. for my homematic example). Is it
- generally for controlling the components?
- just for special cases like groups?
- not at all necessary because items stored in the db can be addressed in the following way…
The confusion is caused by the multiple alternative (and sometimes redundant) ways to create items on OH2.
If you define a link for a channel in PaperUI then you create in fact an item. However, this item is stored in JSON DB and not in the item file.
If you define an item in an item file, then this item will be used yy OH2 just like the item from PaperUi (or Habmin or whatever UI alternative).
You are even able to create different items for the same device in item file and UI (which IMHO does not make sense and contributes to confusion), but that is OH2 at the moment…
I personally have switched back to item files completely as you can easily backup all your items by saving one file. With this, you can upgrade to any snapshot or experimental version without having to click again for hours in the UIs.
Thanks for your reply. I also switched to defining items (only the channels I really use) in the .items file. Another advantage of it is that the items appear with their names in the log file instead of the cryptic model name they have.
You can also name the items individually when using the UI, just overwrite the cryptic proposal.
I believe you can only change the ID when creating the Item. Once created, I don’t believe it can be altered, at least through Paper UI or HABmin UI.
In the log my items (or the channels of them, to be more precise) are displayed like “homematic_HM_ES_PMSw1_Pl_0e0ce14e_NEQ1807561_2_POWER changed from 1.18 to 0.88” even though the item itself has a name.
When I create an item in the item file with a reference to that channel, the event.log then displays the correct item name.
Or maybe I just haven’t found the right field in the PaperUI.
While the “friendly name” is used by the UI for display, the Thing/Item ID is used for virtually all logic- and model-level operations, such as logging and references in links, groups, rules, and the like.