Migration from OH 1.x to OH 2 Tutorial

Hehe sorry :smiley:

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.

Hi,

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

Regards,
Abin

You’ll need to change the link in the original post to /nginx.html instead of /jetty.html.

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.

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.

Done

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

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.

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

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

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 for logging in and http://docs.openhab.org/administration/runtime.html for commands you can issue.

1 Like

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.

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.

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.

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

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.

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.

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?

No, I just misunderstood his question … :sunglasses:

BUT: if you follow the link (Please check the Karaf reference for more details.) to http://karaf.apache.org/manual/latest/ it’s mentioned on THAT page. :grin:

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.
.

1 Like

Maybe it’s time to update :grinning:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

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?