Help with things, items and sitemap (files) in OH2 needed

Hi folks,

as I am switching over from OH1 to OH2, I have some questions regarding things, items and the sitemap:

I have successfully added my zwave devices and the things were added automatically. Also the appropriate channels of each thing. Also I added my HUE bridge and my three bulbs were added as things (and channels for each thing).

  1. For what do I need the things file in the configurations folder? It is empty at the moment, so I assume all things have been added to the OH2 database.

  2. I have created some items in my .items. file. I have used the { channel } command, taking the channel from PaperUI/HABmin. The link was correctly shown in HABmin after this procedure. Is this the preferred way or is it “better” to create some kind of blank item (without channel) and do the link with PaperUI/HABmin? Or doesn’t this matter at all?

  3. Where do I do mappings (.map file)? In the item file or in the sitemap? I can’t do this in PaperUI or HABmin, right?

  4. Similar: Where do I do define formattings like “Temperature [%.1f °C]”? Items file or sitemap? This also isn’t possible with PaperUI or HABmin, isn’t it?

  5. I can use PaperUI/HABmin for creating new items for a channel (haven’t done this yet but I think I’ve read about it). Does this mean that when doing this a new item will be created in the item file? Otherwise I would have some items in a file and others in the OH2 database?

  6. belongs to 5): If the creation of an item through PaperUI/HABmin only creates the item in a DB: Can I nevertheless use this created item for rules? Or does it have to be an item in the item file?

Thanks for your help! I hope I haven’t missed any tutorials which do already answer my questions. As the (really good!) tutorial from @rlkoshak and also the official documentations of OH2 do (AFAIK) not answer them…


I’m still making the transition myself so I could be wrong on some of my answers. But here is the best information I have right now:

  1. Things basically replace the stuff we used to put into the { } part of the Item definition. Some OH 2 bindings will automatically discover and generate Things which you can then map to your Items. However, not all bindings can automatically generate Things. In those cases, you can manually create Things in the Things file.

All of the automatically discovered and generated stuff in OH 2 gets stored in a database, not files like we are used to in OH 1, as you surmise.

  1. I don’t think one way is any better than the others. I’d only recommend to pick a way and be consistent about it. If you prefer to work with files, continue on the way you have started.

  2. I’m still learning this so can’t answer definitively. But I would presume that you should be able to define the label of the Item the same as you always have (i.e. [MAP(]). I know you absolutely can provide that mapping the same as always in the sitemap file and the Items file. I’ve not yet tried creating Items through Habmin or PaperUI.

  3. ibid.

  4. I’m pretty certain the new Item will reside in the DB. So yes, you would have a combination of some Items in files and some in text files.

  5. Absolutely you can use these Items in Rules or anywhere else you would reference Items (persistence, sitemap, etc)

I do plan on getting to these answers (at least most of them) in my tutorial, I just haven’t got that far yet. Stay tuned…

+1. Such a tutorial would be invaluable to those starting out.

I’m staying tuned…

Forgit the link to the work in progress.