delid4ve / openhab-sonoff-compiled

10 stars 0 forks source link

Openhab 4.0.0 #8

Open memphissk opened 1 year ago

memphissk commented 1 year ago

Hello, can you please recompile your package for Openhab version 4.0.0. It should be similar as 3.4.0, but in Thing bridge configuration i have next error HANDLER_INITIALIZING_ERROR 'void org.openhab.core.library.types.DecimalType.(long)'

Thanks in advance

blockbasti commented 1 year ago

I've compile my own version for OH4 for now and it seems to work.

org.openhab.binding.sonoff-4.0.0-SNAPSHOT.zip

memphissk commented 1 year ago

Installation looks fine, but i didn't find any "sonoff" category under installed bindings. Also when i want to add new thing, then i don't have "sonoff" binding offered as in previous version. In "bundle:list" command i also see that bundle is active --> "276 | Active │ 80 │ 4.0.0.202303172314 │ openHAB Add-ons :: Bundles :: sonoff Binding" Do you have idea how to use it now please?

blockbasti commented 1 year ago

No sorry. I've had the binding setup before and with replacing the jar, it started working again. Haven't tried creating a new thing yet. I don't have the necessary knowledge or time to debug this issue.

memphissk commented 1 year ago

So when i copied part of jsondb definition for thing, then i can list it in Things list. But it shows that it cannot connect to cloud, but only local, but then i am not able to contorl device via local LAN and still showw as offline in local mode. Do you use Cloud or local connection to your devices?

blockbasti commented 1 year ago

I just use local connections

JacekKac commented 1 year ago

i installed the binding and get HANDLER_INITIALIZING_ERROR Index 2 out of bounds for length 2

2023-04-16 12:22:29.980 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'sonoff:account:b0f2e86997': Index 2 out of bounds for length 2 java.lang.IndexOutOfBoundsException: Index 2 out of bounds for length 2 at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?] at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?] at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[?:?] at java.util.Objects.checkIndex(Objects.java:359) ~[?:?] at java.util.ArrayList.get(ArrayList.java:427) ~[?:?] at com.google.gson.JsonArray.get(JsonArray.java:204) ~[?:?] at org.openhab.binding.sonoff.internal.handler.SonoffDeviceState.setParameters(SonoffDeviceState.java:112) ~[?:?] at org.openhab.binding.sonoff.internal.handler.SonoffDeviceState.updateState(SonoffDeviceState.java:80) ~[?:?] at org.openhab.binding.sonoff.internal.handler.SonoffDeviceState.(SonoffDeviceState.java:64) ~[?:?] at org.openhab.binding.sonoff.internal.SonoffCacheProvider.getStates(SonoffCacheProvider.java:157) ~[?:?] at org.openhab.binding.sonoff.internal.handler.SonoffAccountHandler.restoreStates(SonoffAccountHandler.java:296) ~[?:?] at org.openhab.binding.sonoff.internal.handler.SonoffAccountHandler.initialize(SonoffAccountHandler.java:100) ~[?:?] at jdk.internal.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:147) ~[?:?] at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) ~[?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?] at java.lang.Thread.run(Thread.java:833) ~[?:?]

JacekKac commented 1 year ago

I've compile my own version for OH4 for now and it seems to work.

org.openhab.binding.sonoff-4.0.0-SNAPSHOT.zip

can you help me with the compilation steps, i got

1/ git clones openhab-addons 2/ git clone sonoff binding respository 3/ Move it to bundles, included in bundles .pom

C:\Users\J\Documents\OPENHAB\openhab-addons>C:\Users\J\Downloads\apache-maven-3.9.2\bin\mvn clean install -pl :org.openhab.binding.sonoff [INFO] Scanning for projects... Downloading from central: https://repo.maven.apache.org/maven2/org/openhab/addons/bundles/org.openhab.addons.reactor.bundles/3.2.0/org.openhab.addons.reactor.bundles-3.2.0.pom [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for org.openhab.addons.bundles:org.openhab.binding.sonoff:3.2.0: The following artifacts could not be resolved: org.openhab.addons.bundles:org.openhab.addons.reactor.bundles:pom:3.2.0 (absent): Could not find artifact org.openhab.addons.bundles:org.openhab.addons.reactor.bundles:pom:3.2.0 in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 7, column 11 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project org.openhab.addons.bundles:org.openhab.binding.sonoff:3.2.0 (C:\Users\J\Documents\OPENHAB\openhab-addons\bundles\org.openhab.binding.sonoff\pom.xml) has 1 error [ERROR] Non-resolvable parent POM for org.openhab.addons.bundles:org.openhab.binding.sonoff:3.2.0: The following artifacts could not be resolved: org.openhab.addons.bundles:org.openhab.addons.reactor.bundles:pom:3.2.0 (absent): Could not find artifact org.openhab.addons.bundles:org.openhab.addons.reactor.bundles:pom:3.2.0 in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 7, column 11 -> [Help 2] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

proggprod commented 1 year ago

I am having the same problem.

I can't see anything in the inbox or when trying to manually add things. My previously working thing doesn't "wake up".

I do see a message in the logs "Sonoff Access Mode set to: local" but that is all

FrancescoTalotta commented 1 year ago

Cloud keys need to be updated: https://github.com/AlexxIT/SonoffLAN/commit/4ae7ee275a2a3861459b769b0bc586d312cf9966

@blockbasti could you recompile it with the new keys for OpenHAB 4?

FrancescoTalotta commented 1 year ago

I just tried the new release https://github.com/jgesser/openhab-3.x-sonoff/releases/tag/v4.4.0-SNAPSHOT on OH4 but I get this error: HANDLER_INITIALIZING_ERROR 'void org.openhab.core.library.types.DecimalType.<init>(long)' @jgesser any idea?

JacekKac commented 1 year ago

@FrancescoTalotta it is not for openhab 4.0

jgesser commented 1 year ago

@FrancescoTalotta , that release was compiled for OH 3.4.0. I am still running 3.4. But I will upgrade my environment to OH4 next week and then compile and test this addon. I hope no major change will be required and be able to release a 4.0 compatible binary.

JacekKac commented 1 year ago

btw may i ask somebody to check my error with 4.0 binary https://github.com/delid4ve/openhab-sonoff-compiled/files/11006939/org.openhab.binding.sonoff-4.0.0-SNAPSHOT.zip

`i installed the binding and get HANDLER_INITIALIZING_ERROR Index 2 out of bounds for length 2

2023-04-16 12:22:29.980 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'sonoff:account:b0f2e86997': Index 2 out of bounds for length 2 java.lang.IndexOutOfBoundsException: Index 2 out of bounds for length 2 at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?] at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?] at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[?:?] at java.util.Objects.checkIndex(Objects.java:359) ~[?:?] at java.util.ArrayList.get(ArrayList.java:427) ~[?:?]`

jgesser commented 1 year ago

@FrancescoTalotta, I just released a binary for OH4 in my fork, please test and let me know if it is working as expected: https://github.com/jgesser/openhab-3.x-sonoff/releases/tag/v4.0.0-SNAPSHOT

JacekKac commented 1 year ago

@jgesser working well on Version: 4.0.0 (Build) thank you so much!

FrancescoTalotta commented 1 year ago

It works fine! Thank you very much!!

josefsch15 commented 1 year ago

Yes, it's working fine, thank you for the great update!

3volution91 commented 1 year ago

hi, there is a problem when trying to add new device. the bridge is missing from things.

FrancescoTalotta commented 6 months ago

Hello. This morning again I get this error Api Login Response:{"error":408,"msg":"appid has expired","data":null} in OH4. How to get new appid and appsecret keys?

enrico-cc commented 6 months ago

Same issue here

jgesser commented 6 months ago

appId and appSecret are externalized as configurations on the Thing in my fork. We only need to find a new pair that is working. The one that is already there was taken from the Home Assistant extension for Sonoff devices.

jgesser commented 6 months ago

https://github.com/AlexxIT/SonoffLAN/blob/ceafb289a029742c818116f398433a7979c34f9d/custom_components/sonoff/core/ewelink/cloud.py#L38

jgesser commented 6 months ago

This one seems to be working:

appId="4s1FXKC9FaGfoqXhmXSJneb3qcm1gOak", appSecret="oKvCM06gvwkRbfetd6qWRrbC3rFrbIpV"

FrancescoTalotta commented 6 months ago

@jgesser Thank you very much, it works now :)