Maybe I'm stupid but.. Things

Hey guys,

I’m trying to set up my home automation with VSC, I installed it and made clear that it gets my openhabian on my pi3.
But thats it, every folder in my “openhab2-conf” is empty, so i was just wondering. I found out that the things/items/… i created in my paperUI are stored in a json db and I have to manual configure all things/items/… by myself because there is no way to get them out of the json.
Let’s assume I am right with my explanations, how do I do that, could somebody show me a guide, or something like that which would help me to get started?

thank you guys.

Hi,

The bad news is: you are right.

The good news, is: You’re so much more flexible with the textual configuration.

First, have a look at the demo items and sitemap:
https://github.com/openhab/openhab-distro/blob/master/features/distro-resources/src/main/resources/items/demo.items

https://github.com/openhab/openhab-distro/blob/master/features/distro-resources/src/main/resources/sitemaps/demo.sitemap

It will help you to understand the basic structure.
Second good news is, that there are tools which support you in the initial setup of the textual configuration:

If you need any help on your initial steps, the forum here is the best source!

Kurt

2 Likes

Well that’s not quite right.
You have a number of choices:

a) keep using PaperUI to change your items and things
b) create .items and eventually .things input files.
The jsondb to contain your config has a different format but it’s human-readable.
See /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.thing.Thing.json
OH will then parse your files on every startup (and file change) and create copies of the items/things in jsondb.
For safety reasons you should delete the items/things using PaperUI before deploying the replacement in file format, pretty sure it’ll not overwrite existing entries in any case.

In theory, you can choose for every item and thing whether to do it in UI or files, but I wouldn’t mix or you’ll lose overview quickly.
My recommendation would be to stick with PaperUI-created things (they rarely need to be changed so you can do it manually via PaperUI if needed) and to just move to file input for items.

Cool! Didn’t know that one!
Thanks for the hint!

Kurt

This is how I play it - things are created in PaperUI
In some cases, I’ll let PaperUI generate items too, but from here on, all item and rules config is done in files.
I run openhabian and the backup and restore scripts have been very good at teardown, rebuild and migrate of my environment…

Make sure you have some idea how to use the karaf console - and if in dire need, you can always fall back on the API to identify any spurious records.

The biggest downside is that I sometimes end up with duplicate items linked to channels and occasionally add channels, that I am fairly certain I will never need

You should disable item generation so you don’t end up with duplicate items:
Set org.eclipse.smarthome.links:autoLinks=false in services/runtime.cfg. Or disable the corresponding switch “Item linking Simple Mode” in PaperUI.

Thanks - I am aware of this, it’s typically when I am copying old ‘item’ code - and I gorget to check whether I already created an item in the UI.
Either way, no show stopper :slight_smile:

2 Likes

mstormi, is it possible to hook me up, so i could get started?
maybe in german, maybe with some links, because i am standing still right now, i am confused :persevere:

Just go to each binding page and look up the examples.
For Example the Astro binding:

astro:sun:home  [ geolocation="52.5200066,13.4049540,100", interval=60 ]
astro:moon:home [ geolocation="52.5200066,13.4049540", interval=60 ]

Please have in mind that autodiscovering your things is a lot more comfortable, especially as a beginner.
There is no real need to define things in text files …

get started with what ?
I am willing to answer specific questions but I won’t do 1:1 tutorials or Q&A from the very beginning.
I expect you to have read the official docs to get started.
Follow the beginners tutorial and if that’s leaving you with open questions, get back and place them here, please.

1 Like

well, thats right, but to use it in visual studio code, i need to define them in text files :frowning:

???
No … can’t follow your problem :sunglasses:

Maybe your problem is the understanding of the differences between Things, Channels and Items.
So please read first:

sihui okay, when I am using visual studio code, i have to open the folder of my openhabian, but when i used the paperui, which writes everything in the .json file, the conf folder is empty, there is no .item/.thing/.sitemap file, or am i wrong?

That is correct, Things and Items created by PaperUI are not stored in those Folders!

That part is correct. But you’re still failing to explain what your problem is.
What you’ve likely not understood is this:
To configure things and items, you can either use PaperUI or (source) files.
Those files you have to create from scratch. PaperUI will NOT create them.
For examples see the demo setup that comes with OH.
Both input methods are mutually exclusive (well, exclusive per thing and per item, that is).
Both will result in data being stored in jsondb.
Sitemaps only can be created as files, there’s no GUI way in PaperUI (but you can use the homebuilder tool).

so i am at work now, i will check how far i can go with the informations above, and when i’m stuck again, i think i will be able to describe the problem.

hi, here i am again, i have understood the whole thing so far and have defined my items.
now i am at a loss, i thought that i can just integrate any device with the zigbee standard, can someone tell me if this is correct?
i have some light switches, which are controllable via an app (smart life), google/alexa and via ifttt, but how do i add them as items now?