Whats your way to update OH2 with another nightly build?

Thanks @xsnrg for the script. I seem to be losing my persistence data with this (though the files are still present in the /userdata/persistence folder). Is this expected behaviour? Is there any way to keep the persistence data intact?

Your persistence data is maintained, though it may not be available right away. One word of caution when using this script, after the first time you start up again after the upgrade, all of the maven dependencies are gone and have to be downloaded again. Give it some time, more so on a slow device like a Pi. This also has a tendency to throw some exceptions until all the dependencies and bindings are loaded again. After the log output has stabilized, it may be a good idea to restart, and it should then come up quicker and cleanly.

Thanks and that’s good to know. I’ll restart the service and see if the persistence data comes back.

1 Like

Does anyone have a recommended process for updating a Windows installation of OH2 to the latest nightly build?

It is just that I did an update last weekend and then had to rediscover all of my z-wave things and then redo all the links. I really don’t want to repeat that process very time I update the system.

Cheers,
Mike

I have not written a batch file or powershell, but you should be able to follow what I did with the bash script, and perform the same steps in windows.

Basically, download the bundle you need, remove everything under the runtime folder, remove all the cache and tmp data under the userdata maven folder (don’t touch the mapdb or anything else, that is where all your configuration is!), then extract the newly downloaded bundle over the top of what is left.

Again, the important stuff for your individual configuration resides in the userdata folder, be careful in there to only remove things in tmp or maven cache folders.

1 Like

Thank you for your reply and advice. I will also make sure I do a full backup as well before I do anything.

Cheers,
Mike

OK, so I tried the following process to update OH2.

(Environment = WIN7 64 Bit)

Firstly after stopping OH2 I made a copy of the full directory structure c:\openhab

Then I did the following…

  1. deleted the folder c:\openhab\runtime and its contents

  2. deleted the contents of c:\openhab\userdata\cache\

  3. deleted the contents of c:\openhab\userdata\tmp\

  4. extracted the latest (as of today) snapshot to c:\openhab

  5. copied new copies of the latest zwave and Mqtt bindings into c:\openhab\addons

  6. started openhab

  7. using paper UI reinstalled the mqtt & zwave bindings

  8. reset sitemap settings for classic and basic UI’s in the paper UI.

Ok, so after this I was able to confirm that my items and sitemap were still in place. Also MQTT was working.

However, I then seemed have a problem with all of my zwave devices (devices and links were lost). I was trying to get them back using HABmin2 ver 0.1.4 and getting really unreliable results. I was able to restore a couple of devices but zwave looked to be broken as these devices did not work after linking…

Question: with the recent changes to OH2 and the bindings, does HABmin need some changes also?

Anyway, I have now reverted to to my backup copy so that I can get on with development of my home system.

If anyone has any ideas re: what I may have done wrong or missed, then I am happy to repeat the process, given I now have a quick way to revert to my working version of OH2.

I look forward to your comments.

Cheers,
Mike

Why did you do 5) and 7)? As I understand, doing 7) will always get you the latest version from the bin repo.

re: 5) because I saw that there were some changes over the last couple of days to the bindings

re: 7) because when I went into the Paper UI, after restarting, the bindings were showing as “uninstalled”

FYI, I extracted the “offline” snapshot. Also, I am not sure that it does get the latest version from the bin repo for v1.9 bindings. I could be wrong, but it has not seemed to work for me yet.

Cheers,
Mike

The current version of the z-wave binding is not working. It will likely be fixed with tonight’s build.

As for steps 5 and 7, in the conf directory there is a file called addons.cfg. Edit this file and add the bindings you always want to use to it. In this way, when you remove the cache directory contents, OH2 will be forced to download the latest bindings that you specified. You should not have to do any manual downloads for any 1.x or 2.0 bindings to get the latest ones. Let the system do the work. If you use the offline version, then just use PaperUI, no need to manually copy. You will have all the latest bindings as of the last time they were built.

Jim,

Thank you for your reply. I will try again tonight my time (New Zealand) and follow your advice.

Regarding the addons.cfg file, is there a specific format for specifying the binding or will this be obvious when I open the file?

Cheers,
Mike

You shouldn’t have any problem when you give it a look. The file is documented pretty well inside.

Jim,

OK, that was better, but I still have few minor issues which I will solve before the next time I update e.g. by adding more info to the addons.cfg file e.g. action and persistence settings etc…

One thing that I noticed is lost every time is the sitemap setting for the basic and classic UI. Is there anywhere I can preset these values?

Once I have this all sorted I will publish my process to help other Windows users of OH2.

Cheers,
Mike

When you say you are losing the sitemap settings, what exactly is being lost? If you have sitemaps in the config directory, they should not be touched. If you have configuration options for the UI interfaces themselves that are being lost, ie language, etc. then this might be a bug. I would suspect those settings should be stored in mapdb, but perhaps they are not. Do you lose those settings if you just do a restart without any update/removal?

I think the settings are probably stored in the mapdb that you nuked as part of the upgrade process.

All that is being lost is the pointer to the sitemap in the config for the UI. It was defaulting back to “_default” for both the baaic and classic UI after the update.

I have noticed happen with the classic UI after restarts, but the basic UI seems to hold the value.

I plan to retest after I add some more data to the addons.cfg file, I might try this tonight.

Ya thats wiped.

Always reset to default and png manually after nightly Script.

Hi!
You can adjust the default sitemap in the services folder: https://github.com/cyberkov/my-openhab-config/blob/master/services/basicui.cfg
This setting is always picked up, even when the db gets lost.

I hope this helps :slight_smile:
Cheers Hannes

1 Like

Thank you, I will check this out before my next update.
Cheers,
Mike

I have just a about got my process to update a Windows OH2 system finished, thanks to everyone that has responded to my questions.

I have written a batch file that takes a backup copy and then prepares the openHAB directory structure for updating. Here it is in case it is of any help to anyone else.

@echo Please confirm that you have shut down openHAB. @echo =============================================== @echo This routine will backup openHAB and then prepare for updating to the latest snapshot. @echo ====================================================================================== pause cd\oh_backup del *.* /s /q cd\ xcopy c:\openhab\*.* c:\oh_backup /v /q /s /e /h rd c:\openhab\runtime /s /q del /s /f /q c:\openhab\userdata\cache\*.* for /f %%f in ('dir /ad /b c:\openhab\userdata\cache\') do rd /s /q c:\openhab\userdata\cache\%%f del /s /f /q c:\openhab\userdata\tmp\*.* for /f %%f in ('dir /ad /b c:\openhab\userdata\tmp\') do rd /s /q c:\openhab\userdata\tmp\%%f @echo Task completed pause

My last bit to solve is when extracting the new snapshot as it is easy to miss that addons.cfg and runtime.cfg are overwritten. I can take care of that by restoring these 2 files from my backup copy immediately after extracting the new snapshot.

My question is should I also do this for the keystore (wherever that is located) for when it might be used in future?

Cheers,
Mike.