# Migration from OH 1.x to OH 2 Tutorial

**URL:** <https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947>\
**Category:** Tutorials & Examples\
**Tags:** installation\
**Created:** [September 8, 2016, 3:57pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947 "2016-09-08T15:57:53Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![ThomDietrich](https://community.openhab.org/user_avatar/community.openhab.org/thomdietrich/32/71239_2.png) [@ThomDietrich](https://community.openhab.org/u/ThomDietrich)\
**Post date:** [September 19, 2016, 4:48pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/21 "2016-09-19T16:48:01Z")

</div>

Hehe sorry 😃

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [September 19, 2016, 5:36pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/22 "2016-09-19T17:36:06Z")

</div>

Added a warning and recommendations for those who were using port forwarding to access their openHAB instance remotely since openHAB 2 doesn’t yet have authentication.

---

<div class="post-metadata">

**Author:** ![abinmathewabraham](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@abinmathewabraham](https://community.openhab.org/u/abinmathewabraham)\
**Post date:** [October 3, 2016, 12:57pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/23 "2016-10-03T12:57:39Z")

</div>

Hi,

How can we write rules for dynamically created items? Is it possible? What should be the approach if yes?

Regards,  
Abin

---

<div class="post-metadata">

**Author:** ![Benjy](https://community.openhab.org/letter_avatar_proxy/v4/letter/b/eada6e/32.png) [@Benjy](https://community.openhab.org/u/Benjy)\
**Post date:** [October 3, 2016, 1:39pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/24 "2016-10-03T13:39:09Z")

</div>

> [@rlkoshak](#):
>
> Added a warning and recommendations [..] since openHAB 2 doesn’t yet have authentication

You’ll need to change the link in the original post to [/nginx.html](http://docs.openhab.org/configuration/nginx.html) instead of /jetty.html.

> [@abinmathewabraham](#):
>
> Hi,
> 
> How can we write rules for dynamically created items? Is it possible? What should be the approach if yes?
> 
> Regards,  
> Abin

You _should_ just need to write the rule the same way as you would with any other item. If you made the switch `Example_Switch` in paperUI, then you can write a .rules file that references it.

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 3, 2016, 3:24pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/25 "2016-10-03T15:24:08Z")

</div>

The Rules engine shouldn’t care whether an Item was dynamically created or not. So long as you have that Item’s name and/or a Group the Item is a member of the Rule should be able to access it and postUpdate/sendCommand.

If you are asking how to dynamically create an Item inside Rules, I have no idea.

> [@Benjy](#):
>
> You’ll need to change the link in the original post to /nginx.html instead of /jetty.html.

Done

---

<div class="post-metadata">

**Author:** ![dan12345](https://community.openhab.org/letter_avatar_proxy/v4/letter/d/c0e974/32.png) [@dan12345](https://community.openhab.org/u/dan12345)\
**Post date:** [October 3, 2016, 3:53pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/26 "2016-10-03T15:53:41Z")

</div>

This may be a dumb question, but can I install 2.0 alongside 1.8?

I appreciate both can’t run at the same time, but I’ll feel much more comfortable starting the migration if I can switch back at any time if I run into teething problems.

thanks,

Dan

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 3, 2016, 4:11pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/27 "2016-10-03T16:11:46Z")

</div>

> [@dan12345](#):
>
> This may be a dumb question, but can I install 2.0 alongside 1.8?

These instructions do just that. In fact, I seem to have neglected a step to uninstall OH 1.8 at all. I myself still have OH 1.8.3 installed on my machine.

But, as you note, you cannot run them both at the same time.

---

<div class="post-metadata">

**Author:** ![abinmathewabraham](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@abinmathewabraham](https://community.openhab.org/u/abinmathewabraham)\
**Post date:** [October 4, 2016, 5:27am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/28 "2016-10-04T05:27:05Z")

</div>

Hi Rich Koshak,

Thank you for your response.

If we have the name, we can use it in Rules. Maybe this is out of the scope of OpenHAB, my query was how to manipulate items where we don’t know the rule. For example, is there any way we can access the item registry and do a search, something like that. Any idea?

Regards,  
Abin

---

<div class="post-metadata">

**Author:** ![dan12345](https://community.openhab.org/letter_avatar_proxy/v4/letter/d/c0e974/32.png) [@dan12345](https://community.openhab.org/u/dan12345)\
**Post date:** [October 4, 2016, 11:46am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/29 "2016-10-04T11:46:20Z")

</div>

brilliant - thank you. Can I ask, out of interest, which you use on a daily basis?

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 4, 2016, 3:38pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/30 "2016-10-04T15:38:33Z")

</div>

> [@abinmathewabraham](#):
>
> For example, is there any way we can access the item registry and do a search, something like that. Any idea?

If you log into the Karaf console, you can get the list of Items with the command:

```
smarthome:items list

```

See [http://docs.openhab.org/administration/console.html](http://docs.openhab.org/administration/console.html) for logging in and [http://docs.openhab.org/administration/runtime.html](http://docs.openhab.org/administration/runtime.html) for commands you can issue.

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 4, 2016, 3:40pm UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/31 "2016-10-04T15:40:28Z")

</div>

I’ve fully switched over to OH 2 now. I’m still tweaking things here and there but for the most part it is up and running the same as it was for OH 1.8. I still have 1.8 on my machine but it is no longer running.

---

<div class="post-metadata">

**Author:** ![Marty56](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/b5a626/32.png) [@Marty56](https://community.openhab.org/u/Marty56)\
**Post date:** [October 9, 2016, 3:51am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/32 "2016-10-09T03:51:49Z")

</div>

Hi Rich,  
Thanks for this great start.

I did not find a section on the “addons.cfg”.  
To my understanding this file should be used to enable an easy upgrade and port to a different machine. It textual states which 2.0 bindings should be installed.  
So no need to use paper Ui (at least for 2.0 bindings) every time you moved to a new machine or corrupted the paper Ui data base. It only seems to work for 2.0 binding and one seems not to have the ability to specify the installation of 1.x binding. If I am not wrong ?

What I also do not know how to cope with the karaf console. F.e. if have switch on the log using log:tail I have not figured out how to come back to the karaf prompt.

Additionally for windows user (i know that you are not) one has to define environment variables “JAVA\_HOME” otherwise OH 2 is always asking for registry entry every time OH 2 is starting.  
I am still struggling what the right folder is and did not find a good documentation.

All in all it is very early and last weekend was my 4th attempt to port and basically I was again stuck. To me it seems that the steps take from 1.x to 2.0 are pretty (too) big and a more backward compatible approach would have been desirable.

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 9, 2016, 4:21am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/33 "2016-10-09T04:21:54Z")

</div>

> [@martin\_klimke](#):
>
> It only seems to work for 2.0 binding and one seems not to have the ability to specify the installation of 1.x binding.

At the time I wasn’t aware of addonds.cfg. However, if it is limited to just 2.0 bindings I would put its use outside the scope of the migration tutorial This tutorial is purposefully arranged to gradually transition to OH 2 bindings. As such, a tutorial on addons.cfg would probably belong as its own tutorial.

> [@martin\_klimke](#):
>
> F.e. if have switch on the log using log:tail I have not figured out how to come back to the karaf prompt.

The console seems to work a lot like a regular shell. Does `<ctrl>-c` not work? I usually tail the openhab.log instead.

> [@martin\_klimke](#):
>
> I am still struggling what the right folder is and did not find a good documentation.

If you have 64-bit Oracle Java installed it’s `c:/Program Files/Java/jre1.8.0_101` or what ever later version you have installed. If 32-bit its` c:/Program Files (x86)/jre1.8.0_101`. Be aware that this folder will change as updates install.

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [October 9, 2016, 4:24am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/34 "2016-10-09T04:24:18Z")

</div>

> [@martin\_klimke](#):
>
> If I am not wrong ?

You are wrong, works also for 1.x bindings (f.e. astro1). Yesterday cloudbees was down, so if you tried that yesterday, it may not have worked.

> [@martin\_klimke](#):
>
> how to come back to the karaf prompt.

[http://docs.openhab.org/administration/console.html](http://docs.openhab.org/administration/console.html)

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [October 9, 2016, 4:26am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/35 "2016-10-09T04:26:36Z")

</div>

> [@sihui](#):
>
> [http://docs.openhab.org/administration/console.html](http://docs.openhab.org/administration/console.html)

I actually just scanned through those docs and didn’t notice anything about how to return from tailing the log. Did I miss it?

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [October 9, 2016, 4:27am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/36 "2016-10-09T04:27:26Z")

</div>

> [@rlkoshak](#):
>
> Did I miss it?

No, I just misunderstood his question … 🕶

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [October 9, 2016, 4:29am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/37 "2016-10-09T04:29:51Z")

</div>

BUT: if you follow the link (Please check the Karaf reference for more details.) to [Apache Karaf Container 4.x - Documentation](http://karaf.apache.org/manual/latest/) it’s mentioned on THAT page. 😁

---

<div class="post-metadata">

**Author:** ![Marty56](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/b5a626/32.png) [@Marty56](https://community.openhab.org/u/Marty56)\
**Post date:** [October 9, 2016, 5:17am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/38 "2016-10-09T05:17:05Z")

</div>

crtl c did the job. Sometimes it is so trival …

with respect of the Java Home, below did the trick:

In user variable add JAVA\_PATH to C:\Program Files\Java\jdk1.8.0\_51\bin  
In system variables JAVA\_HOME to C:\Program Files\Java\jdk1.8.0\_51

where C:\Program Files\Java\jdk1.8.0\_51\bin is java installed pathFinish.

Thanks for your initiative.  
.

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [October 9, 2016, 6:45am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/39 "2016-10-09T06:45:23Z")

</div>

> [@martin\_klimke](#):
>
> jdk1.8.0\_51

Maybe it’s time to update 😀

[http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)

---

<div class="post-metadata">

**Author:** ![Marty56](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/b5a626/32.png) [@Marty56](https://community.openhab.org/u/Marty56)\
**Post date:** [October 9, 2016, 7:19am UTC](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947/40 "2016-10-09T07:19:24Z")

</div>

Do not worry. I have the latest version that was cut and past from the I-Net.

With respect of the addons.cfg  
What is the syntax to specify a 1.x addon. e.g.  
Homematic there are both

would it be homematic1?

[Previous page](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947.md?page=1)

[Next page](https://community.openhab.org/t/migration-from-oh-1-x-to-oh-2-tutorial/13947.md?page=3)
