Manually add a thing (code)

Hi guys,
just for a plain beginner:

I just want to add things cvia code and not the gui.
As far as I understood I just need to create a .things file in OpenHAB\conf\things and
put my definitions inside…?

I just tied it with some basic stuff:

Thing network:device:webcam "Webcam" @ "Living Room" [ hostname="192.168.0.2", timeout="5000", ... ]
Thing astro:moon:home [ geolocation="50.12345,10.98765", interval=300 ]

After saving theese things do not appear in paper ui…

Of course I have the required bindings installed. I use openHAB on a windows machine…

There are examples on every page of the corresponding docs:

Yeah and I am literally just copying and pasting them into my file without any effect…

Do you see any errors in the log file? If you are maintaining the “…” in your network Thing, the parser likely gives an error and will simply abort and none of your file is being read. Check the docs again for syntax (see post by @sihui) and check your logs for errors. Better even, use VSCode as editor:

whoops I am sorry.
But anyhow the other things also dont work. After removing the dots the network thing also does not work…

the log just drops
2019-04-15 19:29:12.633 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'test.things'
without any further messages…

I ll look into the editors thanks!

Edit: nevermind, got things mixed up.

Not sure about that, I do text file definitions exclusively and all things show in PaperUI

Sometimes it helps to clean the cache; if you are on linux (you don;t say):

sudo service openhab2 stop
sudo openhab-cli clean-cache
sudo service openhab2 start

on other platforms or with openhabian there are similar commands, but you would need to search the forum.

I use openHAB on a windows machine…

Nope wont work for me. I am going to search…

oops…sorry missed that…

You can still clear the cache. See Clear the Cache.

Replace the /var/lib/openhab2 part of the paths with c:\where ever you unzipped openhab to\userdata.

To have a “thing” visible in Paper UI, you need to create an “item” for a specific “channel” of that thing.

The simplest way to do that experimentally is switch item linking to simple mode (“Paper UI” -> “Configuration” -> “System” -> “Item Linking”, and enable that “Simple Mode”). Afterwards, go to your thing in Paper UI (“Configuration” -> “Things”, and your thing you just created) and click on one of the channels. Paper UI should automatically create an item for you, bind it to that channel, and thus the thing becomes visible in the “Control” tab.

Of course, if you want to create the items via text file, read up on “items” files.

I would state that more like:
Each created thing is visual on PaperUI under Configuration-Things. It doesn’t matter if they are created via PaperUI or via files.
Under PaperUI Controls only those things which have at least one Channel that is linked to an item are visual!

1 Like

After Clearing the cache it finally worked!

I can confirm that a thing appears in PaperUI even if it has no item yet…

How do I delete the cache in Windows? heeeelp

Read the “Manual install” section: