Ewelink / Sonoff Binding - New binding without flashing

Thanks @delid4ve I’ll give this a shot tomorrow… been caught up with something today

is there a need for something more than just put jar file in the addon folder? because there are no any sonof bunding (i put it inside clean OH3.0.1).

PS i try reboot device with “sudo reboot”

You have the right version jar? (3.0 SNAPSHOT)?
You have read the Readme, specifically ‘Setup’?

Please goto things and click the + sign, do you see it there?

It seems a problem with the binding view, I read another thread in the dev section where a new binding is not showing in binding.

Edit: I have installed it and doesn’t see it either. @delid4ve

debug_sonoff_v2.txt (8.8 KB)

I’ve copied the 3.0 version on my 2.5.12 Openhab but the binding is not showing up.
is it compatible with 2.5?

No, you need the version for 2.5

Right, apologies I misunderstood the versioning.
Using 2.5.11 it appeared :+1:

1 Like

i do as usual, just put jar file to addon folder
and try to find new thing (blue +) and nothing find.

have you added an account thing? read the readme on the first post?

Guys seems to be an issue in the v3 version. Going to look at tomorrow, the old jar is still available under archived in GitHub. If any of you have the new version on v3 working would like to know so I can narrow it down.

1 Like

i can’t find “account” thing, yes read readme many times.

Yeah doesn’t work on v3. Logs:


2021-02-25 10:05:15.176 [DEBUG] [inding.sonoff.internal.MainDiscovery] - Activate Background Discovery
2021-02-25 10:05:15.176 [DEBUG] [inding.sonoff.internal.MainDiscovery] - Start Background Discovery
2021-02-25 10:05:15.176 [DEBUG] [inding.sonoff.internal.MainDiscovery] - Sonoff - Start Discovery
2021-02-25 10:05:15.178 [DEBUG] [inding.sonoff.internal.MainDiscovery] - Discovery threw an error:{}
java.nio.file.NoSuchFileException: null/sonoff
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?]
	at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:432) ~[?:?]
	at java.nio.file.Files.newDirectoryStream(Files.java:472) ~[?:?]
	at java.nio.file.Files.list(Files.java:3699) ~[?:?]
	at org.openhab.binding.sonoff.internal.Utils.getFiles(Utils.java:124) ~[bundleFile:?]
	at org.openhab.binding.sonoff.internal.MainDiscovery.discover(MainDiscovery.java:107) [bundleFile:?]
	at org.openhab.binding.sonoff.internal.MainDiscovery.startBackgroundDiscovery(MainDiscovery.java:74) [bundleFile:?]
	at org.openhab.core.config.discovery.AbstractDiscoveryService.activate(AbstractDiscoveryService.java:371) [bundleFile:?]
	at org.openhab.binding.sonoff.internal.MainDiscovery.activate(MainDiscovery.java:55) [bundleFile:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:228) [bundleFile:?]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) [bundleFile:?]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664) [bundleFile:?]
	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510) [bundleFile:?]
	at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:317) [bundleFile:?]
	at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:340) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:114) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:982) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:955) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:756) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:666) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:432) [bundleFile:?]
	at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:665) [bundleFile:?]
	at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:338) [bundleFile:?]
	at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:382) [bundleFile:?]
	at org.apache.felix.scr.impl.Activator.access$200(Activator.java:49) [bundleFile:?]
	at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:264) [bundleFile:?]
	at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196) [bundleFile:?]
	at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169) [bundleFile:?]
	at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49) [bundleFile:?]
	at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482) [osgi.core-6.0.0.jar:?]
	at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415) [osgi.core-6.0.0.jar:?]
	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) [osgi.core-6.0.0.jar:?]
	at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444) [osgi.core-6.0.0.jar:?]
	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908) [org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) [org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) [org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) [org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168) [org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) [org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.container.Module.start(Module.java:467) [org.eclipse.osgi-3.12.100.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) [org.eclipse.osgi-3.12.100.jar:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]

1 Like

Hi Dave,

I’m having the same problem of not able to load the binding. I have to fall back to version 3.0.0.202102041157 and it works again.
FYI, I’m using OH3.1.0 snapshot.

Thanks.
Patrick

Could somebody try these please, both seem to be working here, couldn’t find anything wrong with why the binding wouldn’t load so can only assume there was an issue with the build system when i compiled them.

org.openhab.binding.sonoff-3.1.0-SNAPSHOT.jar.txt (149.0 KB)
org.openhab.binding.sonoff-3.0.0-SNAPSHOT.jar.txt (149.0 KB)

1 Like

Hey thanks. The binding seems to be working but I can’t seem to initialise the POWR2 that I have

2021-02-26 01:11:40.417 [DEBUG] [inding.sonoff.internal.MainDiscovery] - Sonoff - Start Discovery

2021-02-26 01:11:40.421 [DEBUG] [inding.sonoff.internal.MainDiscovery] - You Havnt initialized the file cache yet, please set Initialize to true in the account configuration

Initialise is set to true

But logs also say it has found the device

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

2021-02-26 01:10:22.438 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:account:2ff9f5d411' changed from OFFLINE to ONLINE

==> /var/log/openhab/openhab.log <==

2021-02-26 01:10:22.513 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Region Response:{"requestid":"1614282022438-LW5iZV0E","region":"as","error":0}

2021-02-26 01:10:22.514 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Login Request:{"email":"xxxxx@gmail.com","password":"yyyyyy","countryCode":"+X"}

2021-02-26 01:10:22.732 [TRACE] [noff.internal.listeners.MDNSListener] - Sonoff - LAN Service added:[ServiceInfoImpl@140013384 name: 'eWeLink_100XXXXXXXX._ewelink._tcp.local.' address: '(null):0' status: 'DNS: openhab1-lan.local. [openhab1.lan/192.168.1.xxx] state: probing 1 task: null', has NO data

	eWeLink_100XXXXXXX._ewelink._tcp.local.: ]

2021-02-26 01:10:22.735 [TRACE] [noff.internal.listeners.MDNSListener] - Sonoff - LAN Service resolved:[ServiceInfoImpl@111116339 name: 'eWeLink_100XXXXXXX._ewelink._tcp.local.' address: '/192.168.1.x:8081 ' status: 'NO DNS state: probing 1 task: null' is persistent, has data

	id: 100XXXXXXXX

	txtvers: 1

	data2: XXXXXXXX...

	apivers: 1

	iv: NDUXXXXXXXX...

	data1: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX...

	encrypt: true

	type: enhanced_plug

	seq: 7]

2021-02-26 01:10:23.567 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Login Respone:HttpContentResponse[HTTP/1.1 200 OK - 49 bytes]

Are you using your ‘old’ thing? If so have you changed deviceId to deviceid?

Has it created the files under userdata / Sonoff? What’s the status of the device thing?

1 Like

T1 1c is now also working … great job :slight_smile:

No I removed।the old thing, and started from scratch. I can see the device details in the log but the cache file is not being created in /var/lib/openhab/
I get the error about device not being initialised when I do scan. Upto this stage i haven’t even added the device thing

Edit:
I think the error is in getting access token and apiKey. I saw the code here and i am not seeing this line in the logs logger.debug("Api Connected");

this is what’s happening- check the last line

2021-02-26 13:03:17.206 [DEBUG] [noff.internal.handler.AccountHandler] - Sonoff Connection Check Running
2021-02-26 13:03:17.206 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Region Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"UfnZiWpA","ts":1614324797206,"version":8,"countryCode":"+91"}
2021-02-26 13:03:17.465 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Region Response:{"requestid":"1614324797206-UfnZiWpA","region":"as","error":0}
2021-02-26 13:03:17.466 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Login Request:{"email":"XXXXXXXXXXX","password":"XXXXXXXXXXXXXXX","countryCode":"+91"}
2021-02-26 13:03:17.803 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Login Respone:HttpContentResponse[HTTP/1.1 200 OK - 118 bytes]

Using sonoff-3.1.0 jar, i have my Sonoff account and my two Sonoff POW R2 devices online. I can see all the channel values, but the switch channel is not working. The value is wrong and switching on/off has no effect.

In the log files, i have only warn errors:

2021-02-26 08:21:07.561 [WARN ] [sonoff.internal.helpers.MessageQueue] - Ok message not received for transaction: 1614324066542, command was switch, retrying again. Retry count 2
2021-02-26 08:21:08.671 [WARN ] [sonoff.internal.helpers.MessageQueue] - Ok message not received for transaction: 1614324066542, command was switch, retrying again. Retry count 3
2021-02-26 08:21:09.782 [WARN ] [sonoff.internal.helpers.MessageQueue] - Unable to send transaction 1614324066542, command was switch, after 3 retry attempts
2021-02-26 08:21:17.546 [WARN ] [sonoff.internal.helpers.MessageQueue] - Ok message not received for transaction: 1614324076542, command was switch, retrying again. Retry count 2
2021-02-26 08:21:18.657 [WARN ] [sonoff.internal.helpers.MessageQueue] - Ok message not received for transaction: 1614324076542, command was switch, retrying again. Retry count 3

Great job.
Thanks.
Patrick

Pat try to look at your items code and your json file… some of them needs the command “switch0” or “switch1” according to json discovered things.