BobRak / OpenHAB-Smartthings

53 stars 54 forks source link

Problem migrating to OH3 #106

Closed pisabell2 closed 3 years ago

pisabell2 commented 3 years ago

Hello Bob,

I left a message yesterday on the OH forum regarding an issue I am encountering in my work to migrate my OH2 confifg to OH3. The method I have chosen to use is to do a fresh install of OH3 on a different machine (than the one running my current OH2), and then to port one by one to OH3 the different modules I am using in OH2. In doing that, I take care to stop my OH2 process whenever I am working on my OH3 implementation.

At this time I have managed to get several of my modules working on the OH3 platform, but I have a problem with the Smartthings binding. When OH3 tries starting the Smartthings service, it complains as follows:

2021-03-24 16:41:40.250 [WARN ] [rtthings.internal.SmartthingsServlet] - Could not start Smartthings servlet service: alias: '/smartthings' is already in use in this or another context
2021-03-24 16:41:40.255 [ERROR] [org.openhab.binding.smartthings     ] - bundle org.openhab.binding.smartthings:3.1.0.202103230340 (246)[org.openhab.binding.smartthings.internal.discovery.SmartthingsDiscoveryService(292)] : The setSmartthingsHubCommand method has thrown an exception
java.lang.IllegalArgumentException: argument type mismatch

It does that even though the OH2 process is not running and the Smartthings hub has been rebooted.

I noticed that in the binding documentation you mention that only one bridge is supported, but I was hoping that the bridge I was using under OH3 was the same as the one alternately running on OH2. Do you think my OH3 connection is being seen by the Hub as a different bridge even though it has the same name?

It is not clear to me what procedure I will be ble to use for my definitive migration to OH3.

Many thanks in advance for your kind help.

BobRak commented 3 years ago

The first error message "Could not start Smartthings servlet service" means that a binding has already claimed the url {host:port}/smartthings/... I claim that alias for the smartthings binding to communicate with the hub on. Do you think one of your other bindings could also claim the same name? Another possibility is that you have two smartthings binding loaded. I suggest that you look at this openHAB document. You will see an example command "bundle:list | grep openHAB". Try this command "bundle:list | grep -i smartthings" if you see more than one line of output it is likely the binding is loaded twice. Is it possible that you have one in the addons folder. It would also be worth flushing the openHAB cache. Here are instructions.

I'm not sure what would cause the second error: "argument type mismatch" but hopefully that will get resolved when the first one is resolved.

If you want to have 2 servers both connect to the same hub you will have to create multiple Devices: Instructions here. Each will have to have the correct IP and mac for that server. That should work for you with no problem. I have multiple devices defined for my test and prod RPi servers.

One bridge means you can only have one openHAB server connect to a single hub.

pisabell2 commented 3 years ago

Thanks a lot for your informative response.

I am a bit puzzled by what I found.

I had placed "org.openhab.binding.smartthings-3.1.0-SNAPSHOT.jar" in my addons folder. I renamed it as " "org.openhab.binding.smartthings-3.1.0-SNAPSHOT.jar.tmp" so that it does not get loaded at system startup. Restarting the system, I found that I had among my installed bindings "smartthings-3.1.0-SNAPSHOT". I uninstalled it. Then I stopped the system and I cleared the cache and tmp folders.

Now, after restarting the system, I found that the smartthing binding was not listed among those of Settings>Bindings. However, the console command "bundle:list | grep -i smartthings" produces the following output:

163 │ Active   │  80 │ 3.1.0.202101191633      │ openHAB Add-ons :: Bundles
:: Samsung Smartthings Binding

Doesn't that mean that I still have a smartthings binding installed? If so I don't understand where it comes from. Any idea?

Le jeu. 25 mars 2021 à 15:02, Bob Raker @.***> a écrit :

The first error message "Could not start Smartthings servlet service" means that a binding has already claimed the url {host:port}/smartthings/... I claim that alias for the smartthings binding to communicate with the hub on. Do you think one of your other bindings could also claim the same name? Another possibility is that you have two smartthings binding loaded. I suggest that you look at this openHAB document https://www.openhab.org/docs/administration/console.html. You will see an example command "bundle:list | grep openHAB". Try this command "bundle:list | grep -i smartthings" if you see more than one line of output it is likely the binding is loaded twice. Is it possible that you have one in the addons folder. It would also be worth flushing the openHAB cache. Here are instructions https://community.openhab.org/t/clear-the-cache/36424.

I'm not sure what would cause the second error: "argument type mismatch" but hopefully that will get resolved when the first one is resolved.

If you want to have 2 servers both connect to the same hub you will have to create multiple Devices: Instructions here https://www.openhab.org/addons/bindings/smartthings/doc/SmartthingsInstallation.html#create-the-device. Each will have to have the correct IP and mac for that server. That should work for you with no problem. I have multiple devices defined for my test and prod RPi servers.

One bridge means you can only have one openHAB server connect to a single hub.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BobRak/OpenHAB-Smartthings/issues/106#issuecomment-807292276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMVPUG74F74KJSMVQEZC5SDTFOCC3ANCNFSM4ZYCKWYA .

pisabell2 commented 3 years ago

Update: looking at the openhab log I was surprised to find that the system appeared to be playing with my "org.openhab.binding.smartthings-3.1.0-SNAPSHOT.jar.tmp" file. So just removd it completely from the addons folder. After restatrting the system I found that the console command "bundle:list | grep -i smartthings" was still producing a line about the smartthings buiding. So, I remain puzzled.

pisabell2 commented 3 years ago

Update: I used bundle:unintall to remove the extra package the console was showing. Then I reinstalled the smartthings binding through the OH UI. Now the consoile is only showing one line for "bundle:list | grep -i smartthings":

266 │ Active │  80 │ 3.1.0.202103250339      │ openHAB Add-ons :: Bundles :: Samsung Smartthings Binding
pisabell2 commented 3 years ago

The smartthings binding is currently shown as installed, the Smartthings devices I described in the my "smartthing.things" file are shown as "online", but thus far it seems I am receiving no data from the hub: all the values are shown as "null". The openhab log no longer reports anything about smartthings, except for the fact that my "smartthings.things" file was succesfully loaded.

I will investigate this a bit fut-rther later tonight or tomorrow morning.

BobRak commented 3 years ago

The Addons folder is for binding that you download from someplace and want openHAB to use. There are also the bindings installed through the admin web page (or paperUI). Those are separate and I'm not sure where they get placed on disk. But there must be a way to uninstall them using the admin page. Unfortunately I no longer have an openHAB installed so I can't easily help. Maybe uninstall through the admin, flush caches and check the console. Hopefully no smartthings will be there. Then install the one you want to use.

Did the "argument type mismatch" error disappear?

BTW - searched for your post on the community site and didn't find it. Could you send me a link to it? I just want to see what the comments are.

pisabell2 commented 3 years ago

My post to the OH community is at the end of the following page: https://community.openhab.org/t/oh3-and-smartthings/113438 Anyway, as mentioned in one of my recent posts for you, I believe I have now managed to uninstall the zombie binding using the bundel:uninstall command. Thereafter, the argument mismatch stuff has disappeared in the log. Thus, it now seem I only have the correct binding left in my current version. As I mentioned in my previous post, the sole mention of "smartthings" in my openhab log is the confirmation that my "smartthings.things" file was successfully read. The smartthings devices listed in that file are shown as online things, but no update appears to be received from the hub. Should I let go of the things file and try automatic discovery of my devices?

BobRak commented 3 years ago

Do you now have 2 devices, one for each machine? And is each configured with the appropriate IP and mac? Here is an image from ST config: image And, here is a picture of one of the device configurations. The IP and mac has to point back to each openhab server and since there are two servers the device config for each will be different. image

And, on your smartphone you will have to configure OpenHabAppV2 for each device. If you don't do this step the hub will not report status back to openHAB. This is probably why you are not seeing any updates. image

Before you let go of the config files you should be able to get the updates working.

pisabell2 commented 3 years ago

Huge thanks for your fantastic help. My 2nd Openhab instance is now working fine.

The only remaining concern I have is the inbox being filled anew after I clean it up. The fact is that I have a "smartthings.things" file that is enumerating all the things in which I am interested. When the connection with the hub went up, all things known to the hub appeared in my inbox. Since they were already known through the things file, I deleted the 20-so devices listed there, but they reappeared immediately. What is the best way to manage this? Should I abandon the use of a things file?

Thanks so much again!

Le ven. 26 mars 2021 à 00:00, Bob Raker @.***> a écrit :

Do you now have 2 devices, one for each machine? And is each configured with the appropriate IP and mac? Here is an image from ST config: [image: image] https://user-images.githubusercontent.com/17749636/112573605-e1126280-8da9-11eb-97f4-bcb497c8f965.png And, here is a picture of one of the device configurations. The IP and mac has to point back to each openhab server and since there are two servers the device config for each will be different. [image: image] https://user-images.githubusercontent.com/17749636/112573842-554d0600-8daa-11eb-9e66-7db683e36bb5.png

And, on your smartphone you will have to configure OpenHabAppV2 for each device. If you don't do this step the hub will not report status back to openHAB. This is probably why you are not seeing any updates. [image: image] https://user-images.githubusercontent.com/17749636/112575067-d4433e00-8dac-11eb-9e6e-0f25dd044910.png

Before you let go of the config files you should be able to get the updates working.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BobRak/OpenHAB-Smartthings/issues/106#issuecomment-807918561, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMVPUG2G3XAPU6HBZEE32DDTFQBFJANCNFSM4ZYCKWYA .

BobRak commented 3 years ago

This is just my opinion. The OH maintainers might have a different opinion. I think one has to decide on discovery or files. If you choose files then just ignore the inbox. If you choose discovery then accept the things you want and I don't think they will keep coming back.

I choose files. For one I really like that I can easily backup and restore. And, when I started with OH my first binding was the cm11a which is a controller for X-10 and it can't do discovery. So I was forced to do files.

This applies to OH2. I'm not that familiar with OH3. Maybe files and discovery work better together there.

I'm going to close this issue. You can reopen if you want and you can add to it even if it is closed.

Bob

pisabell2 commented 3 years ago

Yes, I think I should choose either way and stick with it. Backup and portability is probably a decisive factor. Thanks a lot

Le sam. 27 mars 2021 à 00:02, Bob Raker @.***> a écrit :

This is just my opinion. The OH maintainers might have a different opinion. I think one has to decide on discovery or files. If you choose files then just ignore the inbox. If you choose discovery then accept the things you want and I don't think they will keep coming back.

I choose files. For one I really like that I can easily backup and restore. And, when I started with OH my first binding was the cm11a which is a controller for X-10 and it can't do discovery. So I was forced to do files.

This applies to OH2. I'm not that familiar with OH3. Maybe files and discovery work better together there.

I'm going to close this issue. You can reopen if you want and you can add to it even if it is closed.

Bob

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BobRak/OpenHAB-Smartthings/issues/106#issuecomment-808644079, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMVPUG3ZRAVI6GXKBUXK3A3TFVKEPANCNFSM4ZYCKWYA .

pisabell2 commented 3 years ago

Hi Bob,

I am sorry to reopen this issue, but I just realized that there is still at least one glitch. Basically, the binding appears to be working on my two machines (OH2 and OH3), but on the OH3 machine, I am still getting the same error message as before in the log: "Could not start Smartthings servlet service: alias: '/smartthings' is already in use in this or another context". I don't know if I will find any unwanted consequences of that warning.

I believe I did as you recommended, in that each machine is now associated with a different smarthings device.

On my phone app, I accidentally created a second OpenHabAppV2 app, but since I disabled one of them, I don't suppose that this is the cause of my problem.

pisabell2 commented 3 years ago

Update, I just realized that at this time, I have 2 copies of the binding running simultaneously on my OH3 machine. Not sure how this happened because I don't have any jar file in my addons folder. After I stopped that bundle and restarted the system, the error message disappeared. So I guess everythung is now OK. Thanks again.