gitMiguel / openhab-addons

Add-ons for openHAB 2.x
https://openhab.org
Eclipse Public License 2.0
2 stars 2 forks source link

Binding does not show up in OpenHAB after installation #6

Closed ghost closed 10 months ago

ghost commented 3 years ago

The binding does not show up in any way in Paper UI after installation. I've last checked that with openHAB 2.5.9-1.

I was very curious to try out you awsome extension. I've myself a Vallox ValloPlus 500 SE connected to a USB-Serial adapter on my Raspberry configured for OpenHAB with a custom script solution initially based on a python script by Marcel Tiews. Solution works fine and reliable so my pressure was not so great so switch to a real binding. However I'm still missing some options / settings, so I had hoped to find them here. Your documentation looks quite promising on that ...

It's really awsome to have a real binding for that purpose now! I had always wanted to do something in that direction but haven't found the time to really dig in in OpenHAB plugin development. That's the reason why "my" solution still is in a state of python script, rules and rule-operated items. So first of all, many thanks for your efforts here to build a "real" Vallox binding!

If it's of any use, I would be pleased to share what I've got so far, but probably that won't be any functional extension to this binding as your available channels are already far more complete.

Expected Behavior

Binding should show up in Paper UI under "Configuration / Bindings" and there should be an option to add a new thing based on the binding.

Current Behavior

Possible Solution

Not sure if I'm indended to do a complete config file based setup of the solution. If that's the case a short note in the documentation would be great!

Steps to Reproduce (for Bugs)

Context

I really would like to try out this awsome binding with my Vallox ValloPlus 500 SE.

Your Environment

gitMiguel commented 3 years ago

Hi, @ohaak, and thanks for your detailed post.

First of all, how did you install the binding? Through marketplace or did you drop .jar file to addons folder?

I just updated my production environment to 2.5.9 and the binding works as expected even thou the binding version is still 2.5.7.

ghost commented 3 years ago

Hi @gitMiguel,

I tried installing using the marketplace. Installation seems to work fine - it shows afterwards as "installed". But as stated before, otherwise it doesn't show up, unfortunately.

Best regards Ole

gitMiguel commented 3 years ago

Was this the version shown in PaperUI when installing?

market:binding-4378569 - 1.0

ghost commented 3 years ago

Yes, that's it.

ghost commented 3 years ago

I can try the JAR installation, if you can give me a link for download. Currently no Java runtime or IDE any more on my machine ...

gitMiguel commented 3 years ago

I'm just testing out the marketplace installation to see if I can reproduce your issue.

Here's a download link: https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/addons/bundles/org.openhab.binding.vallox/2.5.7-SNAPSHOT/org.openhab.binding.vallox-2.5.7-SNAPSHOT.jar

ghost commented 3 years ago

Thx. I'll try it out.

gitMiguel commented 3 years ago

Hmm, for me the marketplace install works as it should 🤔

ghost commented 3 years ago

Ok - got an exception installing the JAR. Seems that org.eclipse.smarthome.io.transport.serial is missing somehow:

image

gitMiguel commented 3 years ago

Oh why didn't I remember. A binding that is not part of the official distribution doesn't install dependencies automatically.

Are you familiar with karaf console? You can install this dependency through there by manually typing

feature:install openhab-transport-serial

ghost commented 3 years ago

Ok - I think I will mangage that. I'll try it out. I guess afterwards the marketplace installation should work as well ...

gitMiguel commented 3 years ago

Yes it should.

And please, almost whenever you post code (in this case the stack trace), don't share it as a screenshot. It's a lot easier to examine it when you copy/paste in into code fences. 👍

ghost commented 3 years ago

@gitMiguel - thanks a lot. That did the trick! Very curious now to try it out ...

And yes, your right, of course. Stack trace or source code as screenshot is a bad idea.

Best regards Ole

ghost commented 3 years ago

@gitMiguel Awesome. Once installed it's working like a charm. Thanks!

gitMiguel commented 3 years ago

Good to hear that you got it working!

I still have some work to do with the binding. Connection handling has some inconsistencies but automatic reconnection kind of helps with that.

ghost commented 3 years ago

@gitMiguel So far everything fine for me. Just two strange things: Binding stops working after a while, saying "port in use". After a OpenHAB restart everything fine again (port change before didn't make any difference.

Now I've the situation that binding somehow wasn't listed any more. Tried to reinstall and then again got the message that openhab-transport-serial was missing. Don't know how that got lost without any reason. Any chance to get your binding "upgraded" to a fully-qualified distriution member to get rid of that issue?

gitMiguel commented 3 years ago

Sorry for such a late response. I'm really short on time these days, but developing this binding is in my future plans. Sooner or later and later might mean that I'll switch to support OH3.

Any chance to get your binding "upgraded" to a fully-qualified distriution member to get rid of that issue?

Well I already tried that so not again in the near future. Let's hope that dependency resolution get fixed so that manual installation wouldn't ne needed anymore.

ghost commented 3 years ago

Sorry to hear that. Yes, I can believe it's hard to spare some time for such stuff. If I can help, just let me know. I'm short on time myself and not yet into OpenHAB plugin devlelopment but I've some background in JAVA developement (approx. 16 years J2EE and IBM WebSphere stuff). I've switched to the 'dark side' (just kidding) several yeas ago and now mostly working .NET / C# or PowerShell for M365 and Azure, but I think some more JAVA won't scare me.

Is that issue with "communication error" somehow related to the transport serial stuff? My impression is, that it's not, or at least not always. Just managed to fix it and it's now again in that state after roughly just a day:

2020-11-10 20:31:33.918 [hingStatusInfoChangedEvent] - 'vallox:se-serial:a1087290' changed from OFFLINE (COMMUNICATION_ERROR): Port in use to UNINITIALIZED
2020-11-10 20:31:33.938 [hingStatusInfoChangedEvent] - 'vallox:se-serial:a1087290' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)

==> /var/log/openhab2/events.log <==

2020-11-10 20:31:34.475 [hingStatusInfoChangedEvent] - 'vallox:se-serial:a1087290' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2020-11-10 20:31:34.504 [hingStatusInfoChangedEvent] - 'vallox:se-serial:a1087290' changed from INITIALIZING to UNKNOWN
2020-11-10 20:31:37.510 [hingStatusInfoChangedEvent] - 'vallox:se-serial:a1087290' changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR): Port in use

To fix this situation I always reboot the whole system. Just restarting OpenHAB seems not to be sufficient.

gitMiguel commented 3 years ago

approx. 16 years J2EE

Then you're about 15 years ahead of me in JAVA 😆

First thing that you can try, and use the binding like I am, is to set up ser2net and connect with TCP thing. Might be that my logic in SerialConnetor is failing.

ghost commented 3 years ago

Ok - I will try to dive in there a little bit after Christmas.

gitMiguel commented 3 years ago

Any news @ohaak ?

I've just provided a 3.0 version as requested by other users.

Are you planning a switch to OH 3.0 soon? Would be easier to provide help with this binding if we're all running 3.0.

ghost commented 3 years ago

Just updated to v3.0 and was trying to install the v2 plugin manually. I will try out the v3 version immediately. By the way - since the last OH update on v2 the plugin was kind of stable in my setup.

ghost commented 3 years ago

@gitMiguel Tried out the OH 3.0 version and it works fine. However, I still have pretty much the same issue as with the OH 2.5.x version.

After a while of operation the ttyUSB0 port will get lost in my setup - resulting in the Exception thrown in that code fragment from ValloxSerialConnector.java.

SerialPortIdentifier portIdentifier = serialPortManager.getIdentifier(config.serialPort);
if (portIdentifier == null) {
    throw new IOException("No such port " + config.serialPort);
}

This however doensn't seem the fault of the Vallox binding in any way. Currently I assume it's some issue with my Raspberry Pi 4 and the used RS485 USB adapter. At least in some case it will completely get lost on OS level (not listed any more via lsusb command). In another occurrence it was still present on OS level, but obviously the serialPortManager instance still had no access to any more (same "No suche port" exception).

Anyways - your code looks fine and change with AtomicReference looks reasonable, but obiously doensn't make any difference for my concrete issue (at least I assume that the version you've linked above already includes that code part, doens't it?).

Haven't dived deeper into the AtomicReference specifica - based on my somehow outdated Java knowledge I would have tried to use a simple synchronized method, but that's probably essentially the same in the outcome and still having some advantages on you side using the AtomicReference stuff.

I will have to deeper analyse what's happening to my serial port on OS level and try to find a way around that issue. Maybe trying out another USB-Serial adapter might help. What kind of device are you currently using?

Have you seen my question regarding development setup - how are you handling that. I would guess you don't have a Vallox development unit in place ...

br Ole

gitMiguel commented 3 years ago

Anyways - your code looks fine and change with AtomicReference looks reasonable, but obiously doensn't make any difference for my concrete issue (at least I assume that the version you've linked above already includes that code part, doens't it?).

Yes it does.

Haven't dived deeper into the AtomicReference specifica - based on my somehow outdated Java knowledge I would have tried to use a simple synchronized method, but that's probably essentially the same in the outcome and still having some advantages on you side using the AtomicReference stuff.

That AtomicReference is a thing that I took from another binding in a hope to lure possible bugs out. I'm neither familiar with it but was worth a shot.

Did you notice these or did you mean something else with "simple synchronized method"?

https://github.com/gitMiguel/openhab-addons/blob/e68801f3383d81b838202a29e71e3251df79a147/bundles/org.openhab.binding.vallox/src/main/java/org/openhab/binding/vallox/internal/se/connection/ValloxSerialConnector.java#L49 https://github.com/gitMiguel/openhab-addons/blob/e68801f3383d81b838202a29e71e3251df79a147/bundles/org.openhab.binding.vallox/src/main/java/org/openhab/binding/vallox/internal/se/connection/ValloxSerialConnector.java#L56-L59 https://github.com/gitMiguel/openhab-addons/blob/e68801f3383d81b838202a29e71e3251df79a147/bundles/org.openhab.binding.vallox/src/main/java/org/openhab/binding/vallox/internal/se/connection/ValloxSerialConnector.java#L106-L108

I will have to deeper analyse what's happening to my serial port on OS level and try to find a way around that issue. Maybe trying out another USB-Serial adapter might help. What kind of device are you currently using?

Your problem really does seem to relate to OS / hardware level stuff. Trying with second adapter would rule out hw problems and is a good place to start. I'm using a cheap chinese version from ebay. I just got lucky and got almost properly working version 😄

Have you seen my question regarding development setup - how are you handling that. I would guess you don't have a Vallox development unit in place ...

I replied 4d ago? No, I don't have a separate unit for developement. Just the one here at my home and nothing fancy.

ghost commented 3 years ago

@gitMiguel Thanks for your reply. Yes, I've noticed that code parts. I was just thinking about making just the method itself synchronized, but your solution is definitly more advanced in that matter.

I will try out another adapter - maybe that will solve my issue.