Migration OH1 -> OH2, especially z-wave related

On a side note: We are always looking for volunteers to write short tutorials. It would be amazing if you (or whoever reads this) could find the time to write a short text on Migrating from OH1 to OH2 and post it under Tutorials & Examples. A summary twice the size of my previous answer is probably enough. :wink:

Isn’t/shouldn’t this be part of the Migration Docs page?

http://docs.openhab.org/tutorials/migration

Should: Yes.
Is: No, unfortunately not.

The current page concentrates on the technical differences between OH1 and OH2. A migration path has still to be written.

Absolutely. I just thought that @jaydee73 may find it easier to contribute something here in the forum. You (Stefan) are of course also welcome to create a pull request for the migration article.

So I guess what I’m saying is: Content first! :slight_smile:
I know how big of a step it is to start contributing to a new project and ANYTHING is already amazing. If someone finds the time to write a short tutorial, I’ll be sure to take my time to transfer it into the docs.

:+1:

Hey,

Since I’m having some small issues with new zwave sensors (see Floodsensor) that should be no issues in OH2, I’m also on the point to (maybe) migrate from OH1 to OH2.

Don’t know if a procedure is now fully in place (or needed)? Else I would like to attribute to this.

Personally, I’m having some questions like:

  • What with my server-migration? Can I run 2 servers/applications at the same, or one-shot upgrade, or…?
  • What with my hardware (zwave, knx…)?
  • What with my items/sitemap files (just copy and go?)?
  • What with my rules/scripts (again just copy and go?)?
  • Will my add-ons like pushover work…?

Certainly all questions that will be answered when I start to dig in to them. But maybe better for everybody to organize this a bit? Since English is not my native language, I guess it would be nice if somebody else can help to (re)write the procedure?

OH2 is the successor to OH1. Yes there are a lot differences but most things will of course work as before.
Regarding the upgrade process: I would recommend making a backup of your OH1 installation and then making a clean switch. Habmin2 will take care of your zwave devices. Items, sitemaps and rules can be reused with a few slight modifications. Most addons (like pushover) are working as expected. To be safe, check the list of tested addons and have a quick search for obvious problems with e.g. knx here in the forum.

Please have a look at the Migration Tutorial and if you are working with a Raspberry Pi, consider using openHABian.

To elaborate just a bit on Thom’s answer, the reason it is best to make a clean switch is that there are conflicts when trying to run two instances of OH at the same time. In your case the big problem will be only one can access the zwave controller at a time.

Hardware setup for zwave is a little different with the 2.0 zwave binding, but the procedure is documented in the readme.

http://docs.openhab.org/addons/bindings/zwave/readme.html

Items will be slightly different. 2.0 bindings use the new concepts of Things and Channels. These replace the configuration parameters you used to put in the “{ }” on your Items. Now, instead of a config that looks like {zwave="6:command=switch_binary,respond_to_basic=true"} it will look like {channel="zwave:device:528f7aca:node6:switch_binary" } which is the Channel ID which you can find in PaperUI, Habmin, or the Karaf console.

Sitemap, rules, scripts, and persistence should all work unchanged.

If it is a supported 1.9 binding, it should work just fine. If it is a 2.0 version of that binding it may work differently.

Let me know if the Migration Tutorial is not adequate for your needs and I’ll edit it to address the deficiencies.

1 Like

Some feedback so far…

I’ve chosen to run a complete new installation. This way, I can easily return in case of issue. And with esxi, it’s not a big issue to do this.

The installation was rather smoothly, I went for the offline version on ubuntu 16.04.

  1. In http://docs.openhab.org/installation/linux.html, i just missed a bit to add the repo for oracle.
  2. KNX was running out of the box, just updated knx.cfg.
  3. zwave binding was something else. the file zwave.cfg wasn’t created automatically, and I needed to copy the jar file 1.9 under addons. But after this…
  4. And with copying the old items, sitemaps, rules, scripts… OH2 started to live.
    I just needed to updated the _default sitemap to default to get my ‘old’ sitemap to show up.
    And copy the icons so my old sitemap was

It all took about 2 hours, so to be honest, it wasn’t that big of deal. :stuck_out_tongue:


Next step, trying to secure the server a bit more, OH1 was nicely/simply done for access internally/externally. But now, I feel a bit naked.

Afterwards, check if all rules/scripts/pushover… are working as they supposed to do. I guess step 6 in the migration procedure (btw you’ve got 2x times step 6 in the procedure)?

Afterwards, update to OH2 bindings and testing the zwave devices.

But it looks promising. Nice job so far!!!

The config file will only be generated if you “install” the binding through the console or PaperUI. If you are using PaperUI, you need to configure the System to “Include Legacy 1.x Bindings” and the 1.9 zwave binding will now appear in the list. I’m not sure how to do it from the console.

You can see Using NGINX Reverse Proxy (Authentication and HTTPS) for setting up nginx.

I followed the steps, (option include legacy…) all through paperUI. But somewhere, the file wasn’t created. I’ve created it manually, and it was working.

But now, I’m running the 2.0 binding. Jiepie!
All none-powered zwave devices are still in state ‘unknown’ in things. But guess I’ll just need to have a little bit of patience. The powered once are in, and I can switch on a light with a simple relay. So it looks promising.
Tomorrow I’ll have a look if the devices have communicated a bit more information.

I’ve added nginx for security. Is working smoothly for the android app. I just have a small issue with habmin and google chrome. But in firefox it’s working. So for the moment, I’m not naked anymore. :wink:

Has security been added to OH2 Z-Wave? I am thinking about moving to OH2, but I have a bunch of Yale ZWave locks.

Glad you got it working. You may have to manually wake up some of your battery powered devices. The binding may need multiple contacts with the device to get all the info it needs. If your device only reports very infrequently (e.g. I have smoke alarms that report once a week, if that) it could take weeks or months before the binding recognizes the device. Some devices, like Minimotes, don’t report at all without being woken up.

Also, I would caution you to at least consider using my.openhab to get at your OH remotely. Ngnix is pretty awesome and a solid project but any time you expose your LAN to the Internet you are taking on the responsibility to monitor, audit, and update your connections to ensure your home network is and remains protected.

For example, I have port 22 (ssh) exposed over my router. In the last week I’ve banned over 2100 IP addresses who are trying to hack into my network through that port. Before switching to OH 2 and I had 443 exposed I saw a similar number of attacks a week on that port.

If you are unaware that these sorts of attacks can take place and/or are unaware how to find out if these attacks are taking place on your network I cannot recommend using NGINX as your protection mechanism and highly recommend my.openhab instead.

Not yet unfortunately. However, you can run on OH 2 with the 1.9 SNAPSHOT binding or an alternatively compiled binding (i.e. whatever you are using now) until it is.

I’ve got another firewall (opnsense) in front of everything that does a first layer of security. And mostly, I work over vpn, but I’m very intresting how openhab2 solve these things. Professional deformation as network engineer. :wink:

A very nice feature of openhab is the internal/external connection with the android app. With this, it’s not needed to explain my family about private/public use. They just use it…

No devices have been properly added.
I see a lot of log entries like below. Looks like it keep on counting up?

2016-10-05 18:33:29.142 [ItemStateChangedEvent     ] - zwave_serial_zstick_1578e7a83ee_serial_sof changed from 8958 to 8959
2016-10-05 18:33:29.290 [ItemStateChangedEvent     ] - zwave_serial_zstick_1578e7a83ee_serial_sof changed from 8959 to 8960
2016-10-05 18:33:29.441 [ItemStateChangedEvent     ] - zwave_serial_zstick_1578e7a83ee_serial_sof changed from 8960 to 8961

I’ve triggerd a Philio 3in1 sensor several time (open/close, tampered the switch…). But to me, it seems that it’s not sending data anymore. Or at least, it’s not being seen in the logs.
I’ve got about 20 of these sensors, and before, they’re sending every 2 hours data like temperature/battery/lux… But till now, not one sensor was reconigzed in OH2.

logs/openhab.log:2016-10-05 12:20:24.223 [ERROR] [l.serialmessage.SendDataMessageClass] - NODE 31: Sent Data was not placed on stack due to error 0.
logs/openhab.log:2016-10-05 12:20:29.570 [WARN ] [ocol.ZWaveController$ZWaveSendThread] - NODE 31: Too many retries. Discarding message: Message: class=SendData[0x13], type=Request[0x00], priority=Poll, dest=31, callback=222, payload=1F 01 00 
logs/openhab.log:2016-10-05 16:37:58.564 [INFO ] [mmandclass.ZWaveSecurityCommandClass] - NODE 31: setupNetworkKey useSchemeZero=false
logs/openhab.log:2016-10-05 16:38:04.929 [ERROR] [ocol.ZWaveController$ZWaveSendThread] - NODE 31: Timeout while sending message. Requeueing - 2 attempts left!
logs/openhab.log:2016-10-05 16:39:12.017 [INFO ] [mmandclass.ZWaveSecurityCommandClass] - NODE 31: setupNetworkKey useSchemeZero=false
logs/openhab.log:2016-10-05 16:39:13.030 [INFO ] [ommandclass.ZWaveVersionCommandClass] - NODE 31: Command Class BASIC has version 0!
logs/openhab.log:2016-10-05 16:39:13.083 [INFO ] [ommandclass.ZWaveVersionCommandClass] - NODE 31: Command Class BASIC has version 0!
logs/openhab.log:2016-10-05 16:39:13.871 [ERROR] [curityCommandClassWithInitialization] - NODE 31: SECURITY_ERROR Invalid state! Secure inclusion has not completed and we are not in inclusion mode. Aborting
logs/openhab.log:2016-10-05 16:39:14.260 [ERROR] [curityCommandClassWithInitialization] - NODE 31: SECURITY_ERROR Invalid state! Secure inclusion has not completed and we are not in inclusion mode. Aborting
logs/openhab.log:2016-10-05 16:39:14.745 [ERROR] [curityCommandClassWithInitialization] - NODE 31: SECURITY_ERROR Invalid state! Secure inclusion has not completed and we are not in inclusion mode. Aborting
logs/openhab.log:2016-10-05 16:39:20.732 [ERROR] [ocol.ZWaveController$ZWaveSendThread] - NODE 31: Timeout while sending message. Requeueing - 2 attempts left!
logs/openhab.log:2016-10-05 16:39:44.444 [ERROR] [ocol.ZWaveController$ZWaveSendThread] - NODE 31: Timeout while sending message. Requeueing - 2 attempts left!
logs/openhab.log:2016-10-05 16:39:53.868 [ERROR] [ocol.ZWaveController$ZWaveSendThread] - NODE 31: Timeout while sending message. Requeueing - 2 attempts left!
logs/openhab.log:2016-10-05 16:39:59.924 [ERROR] [ocol.ZWaveController$ZWaveSendThread] - NODE 31: Timeout while sending message. Requeueing - 1 attempts left!
logs/openhab.log:2016-10-05 17:09:32.178 [ERROR] [ocol.ZWaveController$ZWaveSendThread] - NODE 31: Timeout while sending message. Requeueing - 2 attempts left!

You were right :blush:

Almost 5 days, and still no devices that are properly recognized.
After I run around and tampered all devices, things were starting to look like it should be. :wink:

Here is what I did … just documenting it for anyone else who might be looking at jar and .cfg files … as there was absolutely no such thing for me:

  1. start with openHABianPi fully automated install (so nice!)
  2. open the web UI (port 8080) -> click on paperUI
  3. under Extensions - User Interfaces -> install HABmin
  4. under Extensions - Bindings -> install Z-Wave Binding
  5. Go to the “Inbox”, which is still emtpy
  6. click the blue plus icon
  7. click the zwave line
  8. click on the serial controller
  9. (the only step not in your browser UI:) check on the console the ports via ls /dev/ and in my case ttyACM0 must be the one …
  10. back in the browser on the web UI, added /dev/ttyACM0 under serial port and saved it
    (at this monemt I was wondering if I could/should change the Thing ID?)
  11. Waited a moment, not sure on a refresh … so I went to another page … then back to configuration > things, see that the Controller is then marked as ONLINE
  12. wait a few minutes for the inbox to fill with content
  13. Click on each device and then click on ADD AS THING

And this takes you to the point where you can take your OH1 items file, copy it over, and replace the binding with the channel to the thing … because you now have the channels all within OH2.

Good luck!

For 9. I think it is easier to use the command “dmesg” in the console

1 Like

For 10 I do recommend changing it. If due since reason you need to wipe out your userdata, the Thing I’d cut the controller will change when you next set it up and you will have to update all you Items.

1 Like