Openhab Zwave things to file export?


I’m having a problem lately with my Aeotec zwave bridge as it goes into bridge error.
I just had that issue recently and i had to uninstall the device and reinstall it. For some reason the zwave uid has changed and now all my zwave things show not configured.

I have all channels/items tagged and have modified the zwave stick uid in the .items file config for zwave devices, but now i must add all detected zwave devices as things again.

To speed up things I’d like to export the current things configured from UI to the .things file if possible to then have a clean OH 4.1 install and test it. Currently I’m still running OH 3.x

Is there any option to export at things from UI to .things file? I’d rather not learn and mess with the manual code writing and adding 25+ zwave device to the same name and location would take me ages :slight_smile:

Hi Kardos
If the Aeotec stick has a new UID you can just rename it to the previouse one.
The things will then come up online immediately.

I want to elaborate on @chris4789 's answer.

When you create and/or discover a Thing, it’s given a Unique Identifier (UID). Bridges and Things that do not work through a Bridge will use a randomly generated string as the UID.

Before you create that Thing though, you can change that UID to anything you want, so long as it’s unique. I recommend using something meaningful, like “controller” for a zwave controller.

All the Thing that are under that Bridge will then include that Bridge’s UID as part of their UID.

Consequently, if you replace a Bridge Thing with a new Thing, if you use the same UID as the old Thing all the Things under the Bridge will have the same UIDs too. And because they have the same UIDs, the Links to the Items will all continue to work.

Since all Things except for the Bridge are autodiscovered, adding all the Things should be as simple as running a Scan and accepting the Things from the Inbox.

However, if you restore a backup from before you replaced the Thing and follow these steps you won’t have to do even that much.

  1. Delete the old Zwave controller Bridge Thing, taking note of the Thing UID.
  2. Manually create a new Zwave Bridge Thing. Before clicking “Create Thing”, make sure to modify the Thing ID to match the ID you recorded in 1.

That’s it. All your existing Zwave Things will now use this new Thing as their Bridge and all the Links to your Items will continue to work.

You cannot export managed Things to .things files. Similarly you cannot import a .things file to become managed Things.

There are some scripts here and there on the forum you might find that can do this using the REST API. But this is unnecessary.

As I described above, this is unnecessary. Just make sure your new Bridge has the same UID as the old one and everything will work.

If you fail to do that, it’s still not necessary as you can just scan for and rediscover all the Things again. If you do this though you will have to update the Links in your Items as the new Things will now have new UIDs.

If you don’t want to do even that, you can just stop OH and do a find an replace on the UIDs of your Zwave Things so they match the UID of the newly created Zwave controller thing. On a Zwave Thing, if the UID of the Controller is zwave:serial_zstick:blahblahblah, a Zwave Thing’s UID will look like zwave:device:blahblahblah:node11. You just need to make the “blahblahblah” parts match.

1 Like

Hi Gents,

Thanks for the answers!
I thought that UID is automaticaly generated and have not tried to create the new thing with custom UID :slight_smile:
Adding newly discovered things was the way i chose i just had to check all the node numbers for the previous items to have the same naming syntax.

Anyway now that i know that i should add things with custom thing id and it will generate the same uid, i’ll have a shorter install time when I’ll install a fresh OH 4.1

Thanks for the help!

Just a little addition to @rlkoshak 's perfect elaboration.
If you have devices included with security do not forget to note the security key from the stick.
It is not stored on the stick, just in the thing.
Without the correct key you have to exclude and factory reset the secure devices and include again.
This is a pain if you do not have easy access to the devices …

1 Like