Ewelink / Sonoff Binding - New binding without flashing

That’s not a correct jar, needs to have suffix of the version number on… 2.6 is latest but if have issues use 2.4

Hi @delid4ve ,

yes, I can confirm that 2.4 works! However, all my things are shown as offline. Is there any chance to assign the local ip address manually?

A small correction. I was able to add normal Sonoff-Devices (Basic, Pow, Socket_4) but the device which appears offline was falsly recognized as POWR2 - instead it’s a Hoch circuit breaker:

For some reason, the device appeared online today (it still shows POWR2) but it’s working perfectly!

Thanks for answer.

hi, first of all i would like to thank the developer for adding support for sonoff devices.
That being said im having trouble getting my smart all switch for rollershutter blinds to work., i think they are the t1 3channel model i tried adding it manually it shows as online but the switch wont work.

Im getting this error on log files after i did the discovery procedure:
17:24:49.634 [DEBUG] [rnal.discovery.SonoffDiscoveryService] - Processing device 100122cb89
17:24:49.635 [DEBUG] [g.sonoff.internal.SonoffCacheProvider] - Device 100122cb89: writing to file C:\openHab\userdata\sonoff\100122cb89.txt
17:24:49.653 [DEBUG] [rnal.discovery.SonoffDiscoveryService] - Cache file and state created for device 100122cb89 as it was missing
17:24:49.653 [INFO ] [rnal.discovery.SonoffDiscoveryService] - Discovered device 100122cb89
17:24:49.654 [ERROR] [rnal.discovery.SonoffDiscoveryService] - Unable to add 100122cb89 as its not supported, please forward the cache file to the developer

is there a way to add support for this device or am i doing something wrong ?
any help would be appreciated, ty.

Background

  • Copied org.openhab.binding.sonoff-3.2.0-SNAPSHOT_2.5r6.jar to addon folder
  • Changed ownership to openhab:openhab on jar file
  • Added sonoff binding in GUI
  • Added sonoff account thing and entered credentials. Left it in default connection (Cloud + local)
  • Account thing online and three devices were discovered but they were offline since they’re in a separate subnet
  • Reconfigured account thing to cloud only. The account and three device things then came online for a few minutes
  • Account thing goes offline as well as devices

Questions

  1. Is “Cloud only” mode supported when you’re in the same subnet? I believe you mentioned mini are supported in mixed modes. I suspect the issue I have is with the account thing
  2. The SONOFF D1R1 is not discoverable. It is a dimmer switch but I wasn’t able to match it to any of the devices you listed in your repository.

Current configuration

##   Release = Debian GNU/Linux 10 (buster)
##    Kernel = Linux 4.19.0-16-amd64
##  Platform = VMware Virtual Platform/440BX Desktop Reference Platform
##    Uptime = 92 day(s). 4:38:11
## CPU Usage = 1.98% avg over 1 cpu(s) (1 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.00, 5m: 0.00, 15m: 0.00
##    Memory = Free: 0.16GB (9%), Used: 1.77GB (91%), Total: 1.94GB
##      Swap = Free: 0.94GB (100%), Used: 0.00GB (0%), Total: 0.95GB
##      Root = Free: 8.46GB (60%), Used: 5.51GB (40%), Total: 14.74GB
##   Updates = 0 apt updates available.
##  Sessions = 2 session(s)
## Processes = 184 running processes of 32768 maximum processes
## Openhabian 3.1.0 - Release Build

Openhab Log entries

==> /var/log/openhab/openhab.log <==
2021-09-08 13:19:40.805 [ERROR] [connection.SonoffWebSocketConnection] - Websocket Closed, Status Code: 0, Reason:Broken pipe
2021-09-08 13:19:40.805 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SonoffAccountHandler tried updating the thing status although the handler was already disposed.
2021-09-08 13:19:40.806 [ERROR] [connection.SonoffWebSocketConnection] - Websocket Closed, Status Code: 1006, Reason:Broken pipe
2021-09-08 13:19:40.806 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SonoffAccountHandler tried updating the thing status although the handler was already disposed.
2021-09-08 13:19:54.611 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SonoffAccountHandler tried updating the thing status although the handler was already disposed.
2021-09-08 13:19:54.614 [ERROR] [connection.SonoffWebSocketConnection] - Websocket Closed, Status Code: 0, Reason:Broken pipe
2021-09-08 13:19:54.614 [ERROR] [connection.SonoffWebSocketConnection] - Websocket Closed, Status Code: 1006, Reason:Broken pipe
2021-09-08 13:19:54.614 [ERROR] [l.connection.SonoffConnectionManager] - Unable to remove lan service for device 1000c5b7d6 as the connection is offline
2021-09-08 13:19:54.614 [ERROR] [l.connection.SonoffConnectionManager] - Unable to remove lan service for device 1000c40054 as the connection is offline
2021-09-08 13:19:54.615 [ERROR] [l.connection.SonoffConnectionManager] - Unable to remove lan service for device 1000f8d77e as the connection is offline

Hi Community,

Just bought a Sonoff S26 for the first time and would like to integrate it into my OH3.1 installation.
I can switch the socket with the ewelink app. So wifi connection is OK.
Downloaded the latest jar org.openhab.binding.sonoff-3.1.0-SNAPSHOT_v2.4r2.jar and installed it into /usr/share/openhab/addons.
Then I restarted openhab and get this error in openhab.log

@delid4ve:

  • Have i installed the right jar file because there is also org.openhab.binding.sonoff-3.1.0-SNAPSHOT-sources.jar? also tried that one without success! what could be wrong?
  • How to configure the things for the S26 device? can you give any example please.

EDIT: just found the right jar file “compiled”: org.openhab.binding.sonoff-3.2.0-SNAPSHOT_2.5r6.jar and works fine. Thing is ONLINE!
Still have the question how do i define the S26 thing?

many thanks!

Hi @BartVdP,

Try this version org.openhab.binding.sonoff-3.2.0-SNAPSHOT_2.5r6.jar

Hi @fisker,

Thanks for pointing me in the right direction!
System is up and running!

Hi @delid4ve
I am still having issues with using rules to sync the state of two separate Sonoff light switches.
I have tried lots of different rules to resolve this without success, so have come back here, I hope you can help.
Two key points to this issue, it is time based and does not have to be the same switch triggering twice.
I will try and better explain it below.
I am using openhab 3.1
I am using Sonoff binding “org.openhab.binding.sonoff-3.2.0-SNAPSHOT_2.5r6.jar”, I did previously use “org.openhab.binding.sonoff-3.1.0-SNAPSHOT_2.5r6.jar” and had the same issue.
I am hosting openhab on Raspberry Pi 4, I do feel this can cause lag in rule processing which could be another variable.

Test
I have two sonoff light switch panels “Chalet1 and Chalet2” they have three buttons each.
I am using a rule to sync the state of each button with each other.
for example…
Chalet1_switch0 <–> Chalet2_Switch0
Chalet1_switch1 <–> Chalet2_Switch1
The rule works perfectly fine except if you happen to press the buttons in quick succession.
In other words if I run my hand down the light switch and turn Switch0 on quickly followed by Switch1 then it can trigger this issue which is a continuous looping of the lights on, off until you restart openhab.

Below I have the logs of two examples, the first shows it working correctly, the second captures the issue being triggered.
The Test…
At light switch Chalet2, turn on switch0 followed quickly by switch1.


example 1, shows rule worked OK “Light 0 on immediately followed by light 1”
10:59:25.416 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch0’ changed from OFF to ON
10:59:25.429 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch0’ received command ON
10:59:25.432 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch0’ predicted to become ON
10:59:25.436 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch0’ changed from OFF to ON
10:59:25.921 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from OFF to ON
10:59:25.940 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch1’ received command ON
10:59:25.943 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch1’ predicted to become ON
10:59:25.952 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from OFF to ON


example 2, shows rule looping “Light 0 on immediately followed by light 1”
Note for the first 8 lines both logs match, however line 9 in the following is showing “Chalet1_Switch1’ changed from ON to OFF”
This was not triggered by me, I only turned the switch ON, not off, the question is what triggered it, the loop takes off at this point and openhab becomes pretty unusable and needs to be restarted to resolve.

11:01:04.187 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch0’ changed from OFF to ON
11:01:04.201 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch0’ received command ON
11:01:04.204 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch0’ predicted to become ON
11:01:04.209 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch0’ changed from OFF to ON
11:01:04.380 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from OFF to ON
11:01:04.391 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch1’ received command ON
11:01:04.395 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch1’ predicted to become ON
11:01:04.400 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from OFF to ON
11:01:04.450 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from ON to OFF
11:01:04.467 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet2_Switch1’ received command OFF
11:01:04.470 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet2_Switch1’ predicted to become OFF
11:01:04.479 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from ON to OFF
11:01:04.576 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from OFF to ON
11:01:04.589 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch1’ received command ON
11:01:04.594 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch1’ predicted to become ON
11:01:04.599 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from OFF to ON
11:01:04.761 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from ON to OFF
11:01:04.773 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch1’ received command OFF
11:01:04.776 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch1’ predicted to become OFF
11:01:04.781 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from ON to OFF
11:01:04.812 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from OFF to ON
11:01:04.821 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet2_Switch1’ received command ON
11:01:04.827 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet2_Switch1’ predicted to become ON
11:01:04.832 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from OFF to ON
11:01:04.925 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from ON to OFF
11:01:04.935 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch1’ received command OFF
11:01:04.939 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch1’ predicted to become OFF
11:01:04.945 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from ON to OFF
11:01:05.297 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from OFF to ON
11:01:05.307 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch1’ received command ON
11:01:05.312 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch1’ predicted to become ON
11:01:05.317 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from OFF to ON
11:01:05.351 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from ON to OFF
11:01:05.365 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet2_Switch1’ received command OFF
11:01:05.369 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet2_Switch1’ predicted to become OFF
11:01:05.375 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from ON to OFF
11:01:05.480 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from OFF to ON
11:01:05.494 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch1’ received command ON
11:01:05.497 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch1’ predicted to become ON
11:01:05.502 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from OFF to ON
11:01:05.838 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from ON to OFF
11:01:05.851 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch1’ received command OFF
11:01:05.854 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch1’ predicted to become OFF
11:01:05.860 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from ON to OFF
11:01:05.872 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from OFF to ON
11:01:05.881 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet2_Switch1’ received command ON
11:01:05.885 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet2_Switch1’ predicted to become ON
11:01:05.890 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from OFF to ON
11:01:06.025 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet2_Switch1’ changed from ON to OFF
11:01:06.038 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Chalet1_Switch1’ received command OFF
11:01:06.041 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item ‘Chalet1_Switch1’ predicted to become OFF
11:01:06.049 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Chalet1_Switch1’ changed from ON to OFF

on and on etc.
Any suggestions would be greatly appreciated

Hi @delid4ve
I just wanted to come back to you on the problem I had when using your suggested rule on my OH3, just to give you a more complete answer.

15:25:47.542 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model ‘Daves_Rule.rules’
15:25:47.599 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model ‘Daves_Rule.rules’ is either empty or cannot be parsed correctly!
15:25:48.605 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model ‘Daves_Rule.rules’

Hi guys
Sorry just haven’t had time to jump on with work.
Bear with me.
This that are having issues with r6 try r4.

You have an error in there - more than likely the file is encoded wrong.

Hi @tdlr, did you manage to connect the dimmer?

I get this in the cache:

{"name":"SonoffDimmer214","deviceid":"1001106a93","apikey":"xxxxxxxxxxxxxxxxx","extra":{"uiid":44,"description":"20201117004","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:20:d2:77","mac":"d0:27:02:20:d2:76","ui":"单路调光灯","modelInfo":"5dc9483b9d0ed6590fbc73fd","model":"PSF-BLD-GL","manufacturer":"深圳松诺技术有限公司","chipid":"002AA6CA","staMac":"C4:DD:57:2A:A6:CA"},"brandName":"SONOFF","brandLogo":"https://eu-ota.coolkit.cc/logo/q62PevoglDNmwUJ9oPE7kRrpt1nL1CoA.png","showBrand":true,"productModel":"D1R1","tags":{"m_a512_dark":"on"},"devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1,"wxAlarmNotify":0,"wxOpsNotify":0,"wxDoorbellNotify":0,"appDoorbellNotify":1},"devGroups":[],"family":{"familyid":"60a11d981a0fa600086359d1","index":-2},"shareTo":[],"devicekey":"xxxxxxxx-xxxx-xxxx-baa6-xxxxxxx","online":true,"params":{"bindInfos":{},"version":8,"sledOnline":"on","init":1,"fwVersion":"3.5.0","rssi":-50,"staMac":"C4:DD:57:2A:A6:CA","switch":"on","brightness":1,"brightMin":0,"brightMax":255,"startup":"on","mode":0,"rsn":"online"},"isSupportGroup":true}

I haven’t and I don’t see a manual entry for SonoffDimmer214. Were you able to add it as a thing?

No I did not, that is why I am asking, SonoffDimmer214 is just the name of the device in my ewelink

Hi,
I can’t initialize the account think. After instalation and filling creditials I have still status “UNINITIALIZED” with description “HANDLER_INITIALIZING_ERROR, Index 2 out of bounds for lenght 2”. What is wrong?

Will get added soon as :+1:

1 Like

OpenHAB version?
Jar version?

deli4dve sorry to bother but I’ve opened a query as I’m not able to see the binding in openhub. I tried both on a docker as well as on window.
I feel very dummy

SONOFF not able to see binding - Setup, Configuration and Use / Beginners - openHAB Community