openhab / org.openhab.binding.zigbee

openHAB binding for ZigBee
Eclipse Public License 2.0
73 stars 111 forks source link

Refactor Tuya into separate bundle #675

Open cdjackson opened 2 years ago

cdjackson commented 2 years ago

@dschall - firstly, sorry this has taken so long. The past few months have been a bit hectic moving around the world, selling and buying houses, and changing jobs etc, all with the world in a mess.

I've refactored your PR into a separate bundle. Maybe you can take a look to see if it works as I can't really test.

Thanks

Intended to replace #629

Signed-off-by: Chris Jackson chris@cd-jackson.com (+4 squashed commits) Squashed commits: [8c397c9] Add tests for ZigBeeConverterTuyaButton

Signed-off-by: Daniel Schall github.com@mon-clan.de [d68a96a] Fix build break

Signed-off-by: Daniel Schall github.com@mon-clan.de [9a37f0e] Add Tuya button support

Signed-off-by: Daniel Schall github.com@mon-clan.de [af45e77] Create Tuya specific handler binding

Signed-off-by: Chris Jackson chris@cd-jackson.com

cz6ace commented 2 years ago

Hello @cdjackson, I'm interested in this PR to be merged into the main OH3 release. I can do a real test as I have Tuya switches (one 3-button type). Is there obvious reason it won't work in OH 3.1?

Thank you, Libor

cdjackson commented 2 years ago

Thanks @cz6ace

Is there obvious reason it won't work in OH 3.1?

No - I don't think so. If you take this bundle and drop it in your addons folder, I think it ought to work. Let me make one more small change to move the channel definition into the Tuya binding otherwise you'd need to also update the main zigbee binding and this should be better decoupled (I just missed that earlier).

cdjackson commented 2 years ago

I've now moved the channel definition into the separate Tuya bundle, so once CI completes this should work as a standalone bundle.

I've also rebased on the current master.

cz6ace commented 2 years ago

Hello Chris,

thank you. I do not know so once CI completes exactly means - merging into the main branch?

I tried the updated version, copied the thuya into /usr/share/openhab/addons folder and there is an dependency error: 2021-10-24 11:23:03.154 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.zigbee.tuya-3.2.0-SNAPSHOT.jar org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.zigbee.tuya [303] Unresolved requirement: Import-Package: org.openhab.binding.zigbee.internal

I looked into the 3.1.0 karaf into the zigbee bundle, the package is there, but probably issue will be the meta information in the manifests. Don't waste your time, it might be 3.1.0 and 3.2.0 incompatibility, I'll try another computer, install there 3.2.0 and will play with it in the sandbox.

cdjackson commented 2 years ago

I would hazard a guess that the issue is the library version since it was updated recently. It should be ok in 3.2 if you do a clean install of the snapshot so please let me know how you go.

cdjackson commented 2 years ago

In case anyone is testing this, I suspect it doesn't work at the moment. I'm currently doing a larger refactoring to support more complex customisation (initially to support the Tuya roller blinds) and as I have one of these I will be able to do some general level of testing.

Hopefully I'll have something further to test on this in the next week or two.

cz6ace commented 2 years ago

Hello Chris,

after a pause (need to solve issue with homematic & heating system after migration to a new control unit) I tried brand new install from the snapshot:

$ cat /etc/apt/sources.list.d/openhab.list
deb https://openhab.jfrog.io/artifactory/openhab-linuxpkg unstable main

$ apt show openhab
Package: openhab
Version: 3.2.0~S2554-1
Priority: optional
Section: java
Source: openhab
...

still, after copying the Tuya bundle: cp org.openhab.binding.zigbee.tuya/target/org.openhab.binding.zigbee.tuya-3.2.0-SNAPSHOT.jar /usr/share/openhab/addons/

I can see the same error:

2021-11-11 00:05:23.924 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.zigbee.tuya-3.2.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.zigbee.tuya [267]
  Unresolved requirement: Import-Package: org.openhab.binding.zigbee.internal

        at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.300.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.16.300.jar:?]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.7.0]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.7.0]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.7.0]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.7.0]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.7.0]

What are the correct steps to install the new bundle? Or should I copy other bundles into addons?

cdjackson commented 2 years ago

As I posted above, this will not work at the moment. I'm currently refactoring this further to resolve this.

jflalande commented 2 years ago

Dear all, I found this PR after reading the original thread where the patch was proposed. I am also facing the problem of "Unknown command 253" for a 3 buttons scene Switch (Moes) which maybe would be considered as a tuya device. So I guess the patch would solve the issue, as far as I understand. I can try the new tuya bundle if required, as I just deployed OH3 3.3.0~S2656-1. But I not really know if Chris has finished his refactoring and where to find it. And finally... Happy Christmas !

cz6ace commented 2 years ago

@jflalande , Hi, I am afraid it is not fully refactored yet. Now it is not even compilable.

[INFO] Reactor Summary for openHAB Add-ons :: Bundles :: ZigBee Reactor 3.2.0-SNAPSHOT:
[INFO]
[INFO] openHAB Add-ons :: Bundles :: ZigBee Reactor ....... SUCCESS [  2.061 s]
[INFO] openHAB Add-ons :: Bundles :: ZigBee Binding ....... FAILURE [  8.282 s]
[INFO] openHAB Add-ons :: Bundles :: ZigBee Serial Driver . SKIPPED
cz6ace commented 2 years ago

Hi @cdjackson ,

is this pull request abandoned or do you plan to work on it in the future?

Thx, libor

cdjackson commented 2 years ago

It is not abandoned, but I have had a lot of other things going on over the past few months and this has unfortunately dropped down the priority list.

cz6ace commented 2 years ago

It is not abandoned, but I have had a lot of other things going on over the past few months and this has unfortunately dropped down the priority list.

Tell me about it, I'm glad that it is still on the list ;-) No stress.

cz6ace commented 1 year ago

Hi, is it dead now? If not, do you remember what has to be done to finish this and can someone else help with this? I'd like to help, but I'm afraid I'll need few initial hints where to start and where to look for some docs.

jflalande commented 6 months ago

Hi, same here. I can test, but for now I understand that this specific bundle is not finished yet. Just found my MOES 3 tuya button, changed the battery, and I still see that openhab complains about the 253 command in the zigbee logs.