Ewelink / Sonoff Binding - New binding without flashing

So was it changing the mode to cloud that worked?

I haven’t got as far as to testing this yet, maybe you could for me…
I don’t think it will as the initial lan message will come in to the bridge (account) and at that point the device isn’t initialised. It only sends lan messages when a status is changed unless local polling is enabled in which case it will get the new state when the polling runs.

Let me know as I should be able to get this working if it doesnt
I’m using powr2s so will be high on the list :wink:

Hi Everyone,

After a few reboots for other things, the switch suddenly works.
Do not ask me why…

Thanks for al the help

Patrick

May have been a cache issue

Yup, local polling is what seems to make it work. Great job. It correctly gets the state on restart of openhab as well as if manually change the switch using physical button.
Thanks! I am all set

Ok.
So the idea behind local polling is only for POW/POW2 really as they don’t send power/voltage/current locally unless the cloud tells it to (so when the ewelink app is open under normal conditions).

If not using a POW/POWR2, and therefore local polling, I don’t really want to have people using a thread to get the initial status so I’ll add a fix in for this at some point. Will let you know when I’ve done so you can test.

1 Like

I try org.openhab.binding.sonoff-3.0.0-SNAPSHOT.jar.txt (149.0 KB) it show in bundings… but my relay from this topic didnt appear (when i press scan).

Then i do full erase my sdcard with OH3.0.0.1 and setup it from start in 3.1.0.M1 and try this org.openhab.binding.sonoff-3.1.0-SNAPSHOT.jar.txt (149.0 KB) but the same issue Bunding in this mode, and my device didnt finds. My settings inside account is correct as far i know.

Log

2021-02-28 01:08:41.300 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing ‘sonoff:account:6fea62851e’ changed from UNINITIALIZED (DISABLED) to INITIALIZING
2021-02-28 01:08:41.321 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing ‘sonoff:account:6fea62851e’ changed from INITIALIZING to ONLINE (COMMUNICATION_ERROR): Cloud Offline
2021-02-28 01:08:45.255 [ERROR] [sonoff.internal.helpers.MessageQueue] - Error Running queue:null
2021-02-28 01:08:45.259 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing ‘sonoff:account:6fea62851e’ changed from ONLINE (COMMUNICATION_ERROR): Cloud Offline to OFFLINE

Can you pm me the full debug log please @Zip_Zip (hash out username/password).

Awesome job. No joy for me yet though … Is RE5V1C supported ? The devices are showing up in Api Discovery response log though but not in Paper UI.

So i think when local polling is enabled, the POWr2 thinks it is connected to the eWeLink App in lan mode (the way allows local control of the device) and hence keeps sending multicast DNS packets on every poll as well as on state change. Thats why the state can be read correctly.
the multicast DNS packets have state info so i suppose thats how it is working :slight_smile:

What’s the UID? (If you initialised then check file under userdata/sonoff or look in discovery response (under extra).

Yep that’s right. What I need to do is cache the dns packet on startup (when the service is fist added) as without local polling the device listener hasn’t initialised yet and so the device never gets the initial value

I’m on 2.5.11. Following is the log snippet

2021-02-28 14:38:22.909 [DEBUG] [noff.internal.handler.AccountHandler] - Sonoff Connection Check Running
2021-02-28 14:38:22.912 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Region Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"qNGtjSiN","ts":1614503302911,"version":8,"country_code":"+91"}
2021-02-28 14:38:23.119 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Region Response:{"requestid":"1614503302911-qNGtjSiN","region":"as","error":0}
2021-02-28 14:38:23.121 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Login Request:{"email”:”xxxxxx”,”password”:”XXXX”,”countryCode":"+91"}
2021-02-28 14:38:25.298 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Login Respone:HttpContentResponse[HTTP/1.1 200 OK - 322 bytes]
2021-02-28 14:38:25.301 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"VvqW9vFK","ts":1614503305300,"version":8}
2021-02-28 14:38:26.210 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Discovery response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"Ventilator","deviceid":"1000e96b5e","apikey":"77ee647e-d76f-4787-b7aa-bb034febd319","extra":{"uiid":1,"description":"20200706015","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:01:d2:d4:0d","mac":"d0:27:01:d2:d4:0c","ui":"单通道插座","modelInfo":"5dbd4482781fbdbb2594b8fe","model":"PSF-B01-GL","manufacturer":"深圳松诺技术有限公司","chipid":"00D5A9E7","staMac":"C8:2B:96:D5:A9:E7"},"brandName":"SONOFF","brandLogo":"https://as-ota.coolkit.cc/logo/q62PevoglDNmwUJ9oPE7kRrpt1nL1CoA.png","showBrand":true,"productModel":"RE5V1C","tags":{"m_d319_chau":"on"},"devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1,"wxAlarmNotify":0,"wxOpsNotify":0,"wxDoorbellNotify":0,"appDoorbellNotify":1},"devGroups":[],"family":{"familyid":"5fc5b3d5896bbb0007277d20","index":-2},"shareTo":[],"devicekey":"21f87fa3-5f79-4c04-9e1f-71ff97ce766a","online":true,"params":{"bindInfos":{"alexa":["77ee647e-d76f-4787-b7aa-bb034febd319_26ca1996a20e8bd63617ab272d4eeede1d2d8e32"]},"version":8,"sledOnline":"on","switch":"off","fwVersion":"3.5.0","rssi":-55,"staMac":"C8:2B:96:D5:A9:E7","startup":"off","init":1,"pulse":"on","pulseWidth":500,"only_device":{"ota":"success"},"ssid":"HomeM","bssid":"b6:be:76:ff:88:ef"},"denyFeatures":["extSwitchMode"]},"index":-2},{"itemType":1,"itemData":{"name":"Gate Sensor","deviceid":"1000e944b9","apikey":"77ee647e-d76f-4787-b7aa-bb034febd319","extra":{"uiid":102,"description":"20200706013","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:01:d2:86:c3","mac":"d0:27:01:d2:86:c2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://as-ota.coolkit.cc/logo/q62PevoglDNmwUJ9oPE7kRrpt1nL1CoA.png","showBrand":true,"productModel":"DW2-Wi-Fi","devConfig":{"lowVolAlarm":2.6},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1,"wxAlarmNotify":0,"wxOpsNotify":0,"wxDoorbellNotify":0,"appDoorbellNotify":1},"devGroups":[],"family":{"familyid":"5fc5b3d5896bbb0007277d20","index":-1},"shareTo":[],"devicekey":"644e6c7b-5b24-468f-9d8a-45dc4afcc6db","online":false,"params":{"bindInfos":{"alexa":["77ee647e-d76f-4787-b7aa-bb034febd319_26ca1996a20e8bd63617ab272d4eeede1d2d8e32"]},"switch":"off","battery":2.869,"fwVersion":"1000.2.924","type":4,"chipID":"d02701d286c2","mac":"d02701d286c2","rssi":-92,"lastUpdateTime":"2021-02-08T12:11:40.330Z","actionTime":"2021-02-08T05:55:27.778Z"},"denyFeatures":["sceneClick"]},"index":-1},{"itemType":1,"itemData":{"name":"big gate","deviceid":"1000e97753","apikey":"77ee647e-d76f-4787-b7aa-bb034febd319","extra":{"uiid":1,"description":"20200706015","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:01:d2:eb:f7","mac":"d0:27:01:d2:eb:f6","ui":"单通道插座","modelInfo":"5dbd4482781fbdbb2594b8fe","model":"PSF-B01-GL","manufacturer":"深圳松诺技术有限公司","chipid":"00686D31","staMac":"C8:2B:96:68:6D:31"},"brandName":"SONOFF","brandLogo":"https://as-ota.coolkit.cc/logo/q62PevoglDNmwUJ9oPE7kRrpt1nL1CoA.png","showBrand":true,"productModel":"RE5V1C","tags":{"m_d319_chau":"on"},"devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1,"wxAlarmNotify":0,"wxOpsNotify":0,"wxDoorbellNotify":0,"appDoorbellNotify":1},"devGroups":[],"family":{"familyid":"5fc5b3d5896bbb0007277d20","index":0},"shareTo":[],"devicekey":"ef2bbe55-d2a1-413d-84b3-a2a598b6b87e","online":true,"params":{"bindInfos":{"alexa":["77ee647e-d76f-4787-b7aa-bb034febd319_26ca1996a20e8bd63617ab272d4eeede1d2d8e32"]},"bssid":"b6:be:76:ff:88:ef","ssid":"HomeM","only_device":{"ota":"success"},"pulseWidth":500,"pulse":"on","init":1,"startup":"off","staMac":"C8:2B:96:68:6D:31","rssi":-75,"fwVersion":"3.5.0","switch":"off","sledOnline":"on","version":8},"denyFeatures":["extSwitchMode"]},"index":0}],"total":3}}

Does that helps ? I cannot find sonoff under userdata.

@entropy yep.
The device for your gate? UID 102. I’ll get added soon for you.
The other two devices should work.

1 Like

Another thing, it seems sonoff file is missing. Following is the log when I do manual discovery of things in Paper UI,

2021-02-28 16:33:14.869 [DEBUG] [inding.sonoff.internal.MainDiscovery] - Sonoff - Start Discovery
2021-02-28 16:33:14.872 [DEBUG] [inding.sonoff.internal.MainDiscovery] - Discovery threw an error:{}
java.nio.file.NoSuchFileException: /var/lib/openhab2/sonoff
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) ~[?:1.8.0_265]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:1.8.0_265]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:1.8.0_265]
	at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:407) ~[?:1.8.0_265]
	at java.nio.file.Files.newDirectoryStream(Files.java:457) ~[?:1.8.0_265]
	at java.nio.file.Files.list(Files.java:3451) ~[?:1.8.0_265]
	at org.openhab.binding.sonoff.internal.Utils.getFiles(Utils.java:124) ~[?:?]
	at org.openhab.binding.sonoff.internal.MainDiscovery.discover(MainDiscovery.java:107) ~[?:?]
	at org.openhab.binding.sonoff.internal.MainDiscovery.lambda$0(MainDiscovery.java:87) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_265]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_265]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_265]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_265]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_265]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_265]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_265]

Yeah there’s a few null errors that will be fixed at the same time when I add your device. Should be testing latest build shortly, if not tomorrow.

Hi Dave, first let me say this is amazing, and has saved me so much time in flashing firmware on a bunch of these devices. I was able to install your .jar easily enough (after getting my linux permissions sorted), and it immediately allowed me to create the account type thing which worked right away.
I also very quickly and easily added two TH10 devices right away and could control the switch instantly.

My problem is that the temperature probe I have “Sonoff Sensor - DS18B20” does not report any number in openhab; this sensor is temperature probe only, not humidity. The only value I ever see is NULL for the point “SonoffDryer_Temperature”, however when I go into the sonoff app on my iphone, I can see the temperature probe reporting properly there, so the probe is working.

Not sure if it’s relevant, but the other point I have is “SignalStrength” which also reports NULL.

Please let me know what else I could provide you to help figure this out, thanks.

@Jon_A can you pm me the file created for the device under userdata/sonoff (or discovery response json in logs if no file). Im close to pushing a new version out so if you can get them over ill get sorted

Silly question, but I can’t find it anywhere in openhab 3.0. I thought the userdata folder was just a sub of the openhab folder, but not there. I searched and couldn’t find anything that lists where the userdata folder is.

yes it is, should have the following listed (without shares):
image
Will only be there if using the jar in this thread though a few posts up (github latest version broken at present)

you can just run discovery with debug logging enabled:
log:set debug org.openhab.binding.sonoff
from the console and there should an entry in the openhab.log under ‘discovery Response’

Sorry but I’m totally lost now. I don’t have a “conf” folder, nor a “userdata” folder, but can see addons just fine.

I just went back up through the thread and found another jar file for 3.1, but it’s a jar.txt and downloads as a zipfile? Do I just change the file extension so its .jar and put in the same folder as before?

Yes you can just remove the txt extension.
I’m assuming you was running an earlier version so be sure to read the post a few above about the changes and the readme regarding setting the latest version up.

what are you running openhab on and I may be able to point you to the folders?