Ewelink / Sonoff Binding - New binding without flashing

Bad password - Sorry!

Country code does not seem to matter.

country code is depreciated, it automatically adjusts it now.

Awesome binding by the way! Thanks for the hard work.

Iā€™m using it for a bunch of 4CH & 4CHPRO switches.

1 Like

No, I didnā€™t update from old version, this is the first time I use this binding (and Sonoff at all). I did delete and copy the jar file few times while trying to get it work.
I deleted the cache, but still no joy. I can see the log returns the state of the hardwired switch but the item does not get update.
I created one extra thing and item from the thing discovered by the UI but nothing changes there also. So on both textual defined thing/item and on the one created by the UI, both items do not update when the hardwired switch is activated.

Ok Iā€™ll be in front of my machine tomorrow so will take a look. :+1:

Openhab cache yeah not Sonoff cache?

Could you also check the cache file created under userdata/sonoff and confirm that itā€™s uiid 1 in there please. In fact, pm me one of the files so I can see the whole structure

Iā€™ve also ordered a mini r2 which will be here tomorrow so I can test :+1:

Openhab cache using

sudo openhab-cli clean-cache

uiid is 1

1 Like

Hi, I also buy PC remote enable/disable card. In general all works, but works incorrectly. OH doesnā€™t show the correct status, you can see this on picture. It shows OFF but my pc is ON. Correct work that switches must be set ON. If I click on the switch button in OH, it sets to ON mode and my PC goes shutdown.

I think this type of devices need two additional property(now it only has a switch) like this:

  • Status that show device status (on or off)
  • Trigger that sends a command to the motherboard (this already exists with switch functionality) and dosent matter what command(ON or OFF) it sends to MB).

@Zip_Zip can you send me the file for the device under userdata/sonoff. I can only add in whatā€™s available from the api - what does the actual ewelink app show/do?

Fixed bug in single switch devices not getting status updates from the physical switch: openhab-sonoff-compiled/org.openhab.binding.sonoff-3.0.3-SNAPSHOT_2.5r6.jar at main Ā· delid4ve/openhab-sonoff-compiled Ā· GitHub

Thereā€™s also a 3.1.0-SNAPSHOT in my repo to fix anyone using M5 or above due to updated dependencies for javax.measure

1 Like

Hi,
Appreciate you for your continued update of the binding.
I see above you update it for 3.1.0 and 3.03, do you also update it for 2.5.x ?
I recently get disconnects from cloud, donā€™t know why, internet connection is ok.

[ERROR] [connection.SonoffWebSocketConnection] - Websocket Closed, Status Code: 1006, Reason:Disconnected
[ERROR] [connection.SonoffWebSocketConnection] - Websocket Closed, Status Code: 0, Reason:Broken pipe
[hingStatusInfoChangedEvent] - 'sonoff:account:<edited out>' changed from ONLINE to ONLINE (COMMUNICATION_ERROR): Cloud Offline
[hingStatusInfoChangedEvent] - 'sonoff:account:<edited out>' changed from ONLINE (COMMUNICATION_ERROR): Cloud Offline to ONLINE

I activated log to trace, when it happens again I will have more info.

Yes if you can provide me with the trace logs Iā€™ll have a look. I will be stopping support for 2.5.x though so no new devices will be added.

Just updated OpenHAB from 3.1.0M4 to M5 and it has broken this binding.

I get this when adding both 3.0.3-SNAPSHOT_2.5r6.jar and 2.5r5.jar

2021-06-03 11:20:59.097 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.sonoff-3.0.3-SNAPSHOT_2.5r6.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.sonoff [296]
  Unresolved requirement: Import-Package: javax.measure; version="[1.0.0,2.0.0)"
	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:440) ~[org.eclipse.osgi-3.16.200.jar:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.8]

read above - in my repo there is a 3.1.0-SNAPSHOT to fix this

Thanks for this binding , working fine on my new zigbee hub to handle temp sensors.

Hey all,
using the Sonoff zigbee hub and the zigbee buttons. Iā€™m finding Iā€™m getting double triggers (I press it, it does the thing. the thing is then repeated a seemingly random amount of time later)
is there anything obvious Iā€™m missing here? where do I even start to look at logs to debug this one?

@kurtopenhab Can you set logging level to trace for the binding and send me them over for the part where it happens. Let me know the time in the log you activated the button and then where it shows it change again.

Hi Dave, thanks again for being so active.
I think Iā€™ve done it correctly, let me know if you need the full log file, I can send them across. I have both the openhab.log and the events.log. theyā€™re just too big to attach here.

Intentional button press looks like this:

2021-06-16 08:28:19.044 [DEBUG] [connection.SonoffWebSocketConnection] - WebSocket message received {"action":"update","deviceid":"a4400057e2","apikey":"30e2af62-fde7-43e9-910b-fc1a5e513a38","userAgent":"device","d_seq":63073,"params":{"battery":100,"trigTime":"1623796098653"},"from":"device"}
2021-06-16 08:28:19.051 [DEBUG] [unication.SonoffCommunicationManager] - Updated state for a4400057e2, with data {"action":"update","deviceid":"a4400057e2","apikey":"30e2af62-fde7-43e9-910b-fc1a5e513a38","userAgent":"device","d_seq":63073,"params":{"battery":100,"trigTime":"1623796098653"},"from":"device"}
2021-06-16 08:28:19.064 [DEBUG] [ng.sonoff.internal.SonoffTaskManager] - Stopping local polling for 
2021-06-16 08:28:19.068 [DEBUG] [ng.sonoff.internal.SonoffTaskManager] - Stopping consumption polling for 
2021-06-16 08:28:19.074 [TRACE] [unication.SonoffCommunicationManager] - Forwarded state to device a4400057e2
2021-06-16 08:28:31.666 [DEBUG] [nternal.handler.SonoffAccountHandler] - Running Activation task
2021-06-16 08:28:31.668 [DEBUG] [connection.SonoffWebSocketConnection] - Websocket Sending Message:ping
2021-06-16 08:28:31.832 [DEBUG] [connection.SonoffWebSocketConnection] - Pong Response received
2021-06-16 08:29:03.865 [DEBUG] [connection.SonoffWebSocketConnection] - WebSocket message received {"action":"update","deviceid":"a4400057e2","apikey":"30e2af62-fde7-43e9-910b-fc1a5e513a38","userAgent":"device","d_seq":52895,"params":{"trigTime":"1623796143640","key":0},"from":"device"}
2021-06-16 08:29:03.871 [DEBUG] [unication.SonoffCommunicationManager] - Updated state for a4400057e2, with data {"action":"update","deviceid":"a4400057e2","apikey":"30e2af62-fde7-43e9-910b-fc1a5e513a38","userAgent":"device","d_seq":52895,"params":{"trigTime":"1623796143640","key":0},"from":"device"}
2021-06-16 08:29:03.884 [DEBUG] [ng.sonoff.internal.SonoffTaskManager] - Stopping local polling for 
2021-06-16 08:29:03.887 [DEBUG] [ng.sonoff.internal.SonoffTaskManager] - Stopping consumption polling for 
2021-06-16 08:29:03.890 [TRACE] [unication.SonoffCommunicationManager] - Forwarded state to device a4400057e2

This is the second trigger that happened without user interaction. Does not show in Ewelink, but does update the ā€œtime last triggeredā€ in openhab.

2021-06-16 08:29:03.865 [DEBUG] [connection.SonoffWebSocketConnection] - WebSocket message received {"action":"update","deviceid":"a4400057e2","apikey":"30e2af62-fde7-43e9-910b-fc1a5e513a38","userAgent":"device","d_seq":52895,"params":{"trigTime":"1623796143640","key":0},"from":"device"}
2021-06-16 08:29:03.871 [DEBUG] [unication.SonoffCommunicationManager] - Updated state for a4400057e2, with data {"action":"update","deviceid":"a4400057e2","apikey":"30e2af62-fde7-43e9-910b-fc1a5e513a38","userAgent":"device","d_seq":52895,"params":{"trigTime":"1623796143640","key":0},"from":"device"}
2021-06-16 08:29:03.884 [DEBUG] [ng.sonoff.internal.SonoffTaskManager] - Stopping local polling for 
2021-06-16 08:29:03.887 [DEBUG] [ng.sonoff.internal.SonoffTaskManager] - Stopping consumption polling for 
2021-06-16 08:29:03.890 [TRACE] [unication.SonoffCommunicationManager] - Forwarded state to device a4400057e2
2021-06-16 08:29:17.058 [DEBUG] [nternal.handler.SonoffAccountHandler] - Running connection check task
2021-06-16 08:29:17.062 [DEBUG] [l.connection.SonoffConnectionManager] - Connection Check Running for mixed mode 
2021-06-16 08:29:31.672 [DEBUG] [nternal.handler.SonoffAccountHandler] - Running Activation task
2021-06-16 08:29:31.675 [DEBUG] [connection.SonoffWebSocketConnection] - Websocket Sending Message:ping
2021-06-16 08:29:31.841 [DEBUG] [connection.SonoffWebSocketConnection] - Pong Response received
2021-06-16 08:30:17.065 [DEBUG] [nternal.handler.SonoffAccountHandler] - Running connection check task
2021-06-16 08:30:17.068 [DEBUG] [l.connection.SonoffConnectionManager] - Connection Check Running for mixed mode 
2021-06-16 08:30:23.847 [DEBUG] [connection.SonoffWebSocketConnection] - WebSocket message received {"action":"update","deviceid":"a4400057e2","apikey":"30e2af62-fde7-43e9-910b-fc1a5e513a38","userAgent":"device","d_seq":34908,"params":{"trigTime":"1623796223398","key":1},"from":"device"}
2021-06-16 08:30:23.853 [DEBUG] [unication.SonoffCommunicationManager] - Updated state for a4400057e2, with data {"action":"update","deviceid":"a4400057e2","apikey":"30e2af62-fde7-43e9-910b-fc1a5e513a38","userAgent":"device","d_seq":34908,"params":{"trigTime":"1623796223398","key":1},"from":"device"}
2021-06-16 08:30:23.865 [DEBUG] [ng.sonoff.internal.SonoffTaskManager] - Stopping local polling for 
2021-06-16 08:30:23.871 [DEBUG] [ng.sonoff.internal.SonoffTaskManager] - Stopping consumption polling for 
2021-06-16 08:30:23.874 [TRACE] [unication.SonoffCommunicationManager] - Forwarded state to device a4400057e2

If helpful, the contents of the text file for this item is:
{"name":"Bathroom ","deviceid":"a4400057e2","apikey":"30e2af62-fde7-43e9-910b-fc1a5e513a38","extra":{"mac":"c650ee22004b1200","apmac":"00:00:00:00:00:00","model":"NON-OTA-GL","description":"zigbee_ON_OFF_SWITCH_1000","modelInfo":"5e53aee709c4f9cde15b1653","manufacturer":"ę·±åœ³ę¾čÆŗꊀęœÆęœ‰é™å…¬åø","brandId":"59e0dbc25c1af3a660cc1ac0","uiid":1000,"ui":"zigbee_ON_OFF_SWITCH_1000"},"brandName":"coolkit","brandLogo":"","showBrand":false,"productModel":"zigbee_ON_OFF_SWITCH_1000","devConfig":{},"family":{"familyid":"6084edef533e5c0008ad4691","index":-6},"shareTo":[],"devicekey":"0e73e5d3-c013-440e-b689-6de426065d42","online":true,"params":{"bindInfos":{"gaction":["30e2af62-fde7-43e9-910b-fc1a5e513a38_ewelinkGoogleHome"]},"subDevId":"c650ee22004b1200","parentid":"10011a161d","battery":100,"trigTime":"1622020707870","key":0}}

Iā€™ll have a look tomorrow, long day. :+1:

1 Like

Hi
just want to say thanks for the development.
Using Iammeter and sonoff - just works!
Brilliant
Martin

@kurtopenhab sorry havenā€™t had a chance to look yet, absolutely snowed under with work. Iā€™ll try next week, Iā€™ve got an idea whatā€™s causing it :+1:

1 Like