Ewelink / Sonoff Binding - New binding without flashing

@Emre7 i would remove the channels/things, then the binding, stop openhab, clear cache.
I have just checked all of the above and all has been fixed in latest version above (r18), r19 just has a new device added. will shortly be publishing r20 tho.

temp is set to celcius
humidity to percent
I cant find any errors in regards to sending the command via cloud.

make sure you defo have latest version installed.

OK, I’ll test with the r20 when you publish it. I will start from scratch to make sure no cache or earlier settings interfere with the test.

For TH16R2, mainSwitch does not turn on the device even in Cloud mode. “switch” does.

Give me 2 mins I’ll post it up

@Emre7 SonoffJars/org.openhab.binding.sonoff-3.1.0-SNAPSHOT_v2.1r20.jar at main · delid4ve/SonoffJars · GitHub

Thanks a lot, seems to be working well now! Now I need to try to get those to work with other stuff :slight_smile:

1 Like

Fantastic, now I can discovered it! :tada:

Using PaperUI I can turn it on and off, but if I use the button on the device the status is not updated in PaperUI.

this is what I see:
image

and those are the logs:

2021-03-21 14:16:22.320 [INFO ] [inding.sonoff.internal.MainDiscovery] - Discovered device 10002a293f
2021-03-21 14:17:21.715 [ERROR] [f.internal.messaging.MessageProvider] - Websocket message didnt have any content {"error":0,"deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","sequence":"1616332641480"}
2021-03-21 14:17:40.331 [ERROR] [f.internal.messaging.MessageProvider] - Websocket message didnt have any content {"error":0,"deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","sequence":"1616332660100"}
2021-03-21 14:17:42.668 [ERROR] [f.internal.messaging.MessageProvider] - Websocket message didnt have any content {"error":0,"deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","sequence":"1616332662424"}
2021-03-21 14:18:21.930 [ERROR] [onoff.internal.connections.Websocket] - Websocket Closed, Status Code: 1006, Reason:Disconnected
2021-03-21 14:18:21.936 [ERROR] [onoff.internal.connections.Websocket] - Websocket Closed, Status Code: 0, Reason:Broken pipe
2021-03-21 14:18:21.954 [ERROR] [onoff.internal.connections.Websocket] - Websocket Closed, Status Code: 1000, Reason:null
2021-03-21 14:22:09.479 [ERROR] [f.internal.messaging.MessageProvider] - Websocket message didnt have any content {"error":0,"deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","sequence":"1616332929238"}
2021-03-21 14:22:09.822 [ERROR] [f.internal.messaging.MessageProvider] - Websocket message didnt have any content {"error":0,"deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","sequence":"1616332929579"}
2021-03-21 14:22:11.124 [ERROR] [f.internal.messaging.MessageProvider] - Websocket message didnt have any content {"error":0,"deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","sequence":"1616332930911"}

@enrico.mcc can you enable debug logging and send me please

I’ve done the following test: I switched the sonoff on from the ui (hear the “click”), then pressed the button on the device (I hear the “click” but nothing happens in the ui) and finally switched again the ui to off (no “click” heard this time, so in the end everything is off).
Those are the logs:

2021-03-21 16:00:29.355 [DEBUG] [off.internal.handler.HandlerBaseDual] - Sonoff - Command Payload:{"switch":"on"}
2021-03-21 16:00:29.358 [DEBUG] [f.internal.messaging.MessageProvider] - Message Type added: 1616338829357 - switch
2021-03-21 16:00:29.370 [DEBUG] [noff.internal.handler.HandlerAccount] - Sending message via LAN
2021-03-21 16:00:29.372 [DEBUG] [ding.sonoff.internal.connections.Lan] - Send LAN Update to http://192.168.1.56:8081/zeroconf/switch with unencrypted payload:{"switch":"on"}
2021-03-21 16:00:29.429 [DEBUG] [ding.sonoff.internal.connections.Lan] - Lan response received: {"seq":39,"sequence":"1616338829357","error":0}
2021-03-21 16:00:29.435 [DEBUG] [f.internal.messaging.MessageProvider] - Lan event received from 192.168.1.56
2021-03-21 16:00:29.440 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:00:29.458 [DEBUG] [f.internal.messaging.MessageProvider] - Websocket received message: {"action":"update","deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","userAgent":"device","sequence":"1616338829357","params":{"switch":"on"},"from":"device","seq":"39"}
2021-03-21 16:00:29.461 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:00:32.204 [DEBUG] [f.internal.messaging.MessageProvider] - Lan event received from 192.168.1.56
2021-03-21 16:00:32.209 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:00:32.231 [DEBUG] [f.internal.messaging.MessageProvider] - Websocket received message: {"action":"update","deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","userAgent":"device","params":{"switch":"off"},"from":"device","seq":"40"}
2021-03-21 16:00:32.234 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:00:35.394 [DEBUG] [off.internal.handler.HandlerBaseDual] - Sonoff - Command Payload:{"switch":"off"}
2021-03-21 16:00:35.396 [DEBUG] [f.internal.messaging.MessageProvider] - Message Type added: 1616338835396 - switch
2021-03-21 16:00:35.398 [DEBUG] [noff.internal.handler.HandlerAccount] - Sending message via LAN
2021-03-21 16:00:35.400 [DEBUG] [ding.sonoff.internal.connections.Lan] - Send LAN Update to http://192.168.1.56:8081/zeroconf/switch with unencrypted payload:{"switch":"off"}
2021-03-21 16:00:35.474 [DEBUG] [ding.sonoff.internal.connections.Lan] - Lan response received: {"seq":41,"sequence":"1616338835396","error":0}
2021-03-21 16:00:35.488 [DEBUG] [f.internal.messaging.MessageProvider] - Lan event received from 192.168.1.56
2021-03-21 16:00:35.501 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:00:35.508 [DEBUG] [f.internal.messaging.MessageProvider] - Websocket received message: {"action":"update","deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","userAgent":"device","sequence":"1616338835396","params":{"switch":"off"},"from":"device","seq":"41"}
2021-03-21 16:00:35.511 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:00:43.727 [DEBUG] [noff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
2021-03-21 16:00:47.548 [DEBUG] [onoff.internal.connections.Websocket] - Websocket Sending Message:ping
2021-03-21 16:00:47.552 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"peqHJidb","ts":1616338847551,"version":8}
2021-03-21 16:00:47.578 [DEBUG] [onoff.internal.connections.Websocket] - Pong Response received
2021-03-21 16:00:47.729 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"Multiuso","deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","extra":{"description":"WWJG001162","brandId":"5611402280a0e2630f7b102d","apmac":"d0:27:00:54:4f:cf","mac":"d0:27:00:54:4f:ce","ui":"开关改装模块","modelInfo":"5655cb0c93991b740423d1ba","model":"ITA-GZ1-GL","manufacturer":"深圳创易智能系统有限公司","uiid":14,"staMac":"DC:4F:22:2A:2E:20","chipid":"002A2E20"},"brandName":"Maker","brandLogo":"","showBrand":true,"productModel":"Sonoff","tags":{"disable_timers":[],"m_6d34_enri":"on"},"devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1},"family":{"familyid":"5ff81d3e04d5cd00080a4d90","index":0},"shareTo":[],"devicekey":"e1167b7c-402a-421d-a97d-bab2b2125708","online":true,"params":{"bindInfos":{"gaction":["3762d06b-dd8c-401a-bea5-2272fc3a6d34_ewelink-google-home-v1"]},"switch":"off","fwVersion":"3.5.0","rssi":-83,"staMac":"DC:4F:22:2A:2E:20","startup":"stay","sledOnline":"on","init":1,"pulse":"off","pulseWidth":500,"timers":[],"version":8,"only_device":{"ota":"success"},"ssid":"Skynet","bssid":"44:4e:6d:dd:9f:15"}},"index":0}],"total":1}}
2021-03-21 16:00:47.732 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:01:43.729 [DEBUG] [noff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
2021-03-21 16:01:47.557 [DEBUG] [onoff.internal.connections.Websocket] - Websocket Sending Message:ping
2021-03-21 16:01:47.561 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"gHzTxFdL","ts":1616338907561,"version":8}
2021-03-21 16:01:47.587 [DEBUG] [onoff.internal.connections.Websocket] - Pong Response received
2021-03-21 16:01:47.687 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"Multiuso","deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","extra":{"description":"WWJG001162","brandId":"5611402280a0e2630f7b102d","apmac":"d0:27:00:54:4f:cf","mac":"d0:27:00:54:4f:ce","ui":"开关改装模块","modelInfo":"5655cb0c93991b740423d1ba","model":"ITA-GZ1-GL","manufacturer":"深圳创易智能系统有限公司","uiid":14,"staMac":"DC:4F:22:2A:2E:20","chipid":"002A2E20"},"brandName":"Maker","brandLogo":"","showBrand":true,"productModel":"Sonoff","tags":{"disable_timers":[],"m_6d34_enri":"on"},"devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1},"family":{"familyid":"5ff81d3e04d5cd00080a4d90","index":0},"shareTo":[],"devicekey":"e1167b7c-402a-421d-a97d-bab2b2125708","online":true,"params":{"bindInfos":{"gaction":["3762d06b-dd8c-401a-bea5-2272fc3a6d34_ewelink-google-home-v1"]},"switch":"off","fwVersion":"3.5.0","rssi":-83,"staMac":"DC:4F:22:2A:2E:20","startup":"stay","sledOnline":"on","init":1,"pulse":"off","pulseWidth":500,"timers":[],"version":8,"only_device":{"ota":"success"},"ssid":"Skynet","bssid":"44:4e:6d:dd:9f:15"}},"index":0}],"total":1}}
2021-03-21 16:01:47.691 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:02:43.731 [DEBUG] [noff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
2021-03-21 16:02:47.566 [DEBUG] [onoff.internal.connections.Websocket] - Websocket Sending Message:ping
2021-03-21 16:02:47.570 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"ZNR660G7","ts":1616338967570,"version":8}
2021-03-21 16:02:47.597 [DEBUG] [onoff.internal.connections.Websocket] - Pong Response received
2021-03-21 16:02:47.710 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"Multiuso","deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","extra":{"description":"WWJG001162","brandId":"5611402280a0e2630f7b102d","apmac":"d0:27:00:54:4f:cf","mac":"d0:27:00:54:4f:ce","ui":"开关改装模块","modelInfo":"5655cb0c93991b740423d1ba","model":"ITA-GZ1-GL","manufacturer":"深圳创易智能系统有限公司","uiid":14,"staMac":"DC:4F:22:2A:2E:20","chipid":"002A2E20"},"brandName":"Maker","brandLogo":"","showBrand":true,"productModel":"Sonoff","tags":{"disable_timers":[],"m_6d34_enri":"on"},"devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1},"family":{"familyid":"5ff81d3e04d5cd00080a4d90","index":0},"shareTo":[],"devicekey":"e1167b7c-402a-421d-a97d-bab2b2125708","online":true,"params":{"bindInfos":{"gaction":["3762d06b-dd8c-401a-bea5-2272fc3a6d34_ewelink-google-home-v1"]},"switch":"off","fwVersion":"3.5.0","rssi":-83,"staMac":"DC:4F:22:2A:2E:20","startup":"stay","sledOnline":"on","init":1,"pulse":"off","pulseWidth":500,"timers":[],"version":8,"only_device":{"ota":"success"},"ssid":"Skynet","bssid":"44:4e:6d:dd:9f:15"}},"index":0}],"total":1}}
2021-03-21 16:02:47.713 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:03:43.734 [DEBUG] [noff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
2021-03-21 16:03:47.575 [DEBUG] [onoff.internal.connections.Websocket] - Websocket Sending Message:ping
2021-03-21 16:03:47.580 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"WtL1OVfQ","ts":1616339027580,"version":8}
2021-03-21 16:03:47.606 [DEBUG] [onoff.internal.connections.Websocket] - Pong Response received
2021-03-21 16:03:47.665 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[],"total":0}}
2021-03-21 16:04:43.736 [DEBUG] [noff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
2021-03-21 16:04:47.586 [DEBUG] [onoff.internal.connections.Websocket] - Websocket Sending Message:ping
2021-03-21 16:04:47.590 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"k1XFHPA5","ts":1616339087589,"version":8}
2021-03-21 16:04:47.615 [DEBUG] [onoff.internal.connections.Websocket] - Pong Response received
2021-03-21 16:04:47.756 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"Multiuso","deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","extra":{"description":"WWJG001162","brandId":"5611402280a0e2630f7b102d","apmac":"d0:27:00:54:4f:cf","mac":"d0:27:00:54:4f:ce","ui":"开关改装模块","modelInfo":"5655cb0c93991b740423d1ba","model":"ITA-GZ1-GL","manufacturer":"深圳创易智能系统有限公司","uiid":14,"staMac":"DC:4F:22:2A:2E:20","chipid":"002A2E20"},"brandName":"Maker","brandLogo":"","showBrand":true,"productModel":"Sonoff","tags":{"disable_timers":[],"m_6d34_enri":"on"},"devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1},"family":{"familyid":"5ff81d3e04d5cd00080a4d90","index":0},"shareTo":[],"devicekey":"e1167b7c-402a-421d-a97d-bab2b2125708","online":true,"params":{"bindInfos":{"gaction":["3762d06b-dd8c-401a-bea5-2272fc3a6d34_ewelink-google-home-v1"]},"switch":"off","fwVersion":"3.5.0","rssi":-83,"staMac":"DC:4F:22:2A:2E:20","startup":"stay","sledOnline":"on","init":1,"pulse":"off","pulseWidth":500,"timers":[],"version":8,"only_device":{"ota":"success"},"ssid":"Skynet","bssid":"44:4e:6d:dd:9f:15"}},"index":0}],"total":1}}
2021-03-21 16:04:47.759 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:05:37.212 [INFO ] [miio.internal.cloud.MiCloudConnector] - Error logging on to Xiaomi cloud (0): Error getting logon location URL. Return code: 70016
2021-03-21 16:05:43.738 [DEBUG] [noff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
2021-03-21 16:05:47.595 [DEBUG] [onoff.internal.connections.Websocket] - Websocket Sending Message:ping
2021-03-21 16:05:47.598 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"MIdC539q","ts":1616339147598,"version":8}
2021-03-21 16:05:47.625 [DEBUG] [onoff.internal.connections.Websocket] - Pong Response received
2021-03-21 16:05:47.749 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"Multiuso","deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","extra":{"description":"WWJG001162","brandId":"5611402280a0e2630f7b102d","apmac":"d0:27:00:54:4f:cf","mac":"d0:27:00:54:4f:ce","ui":"开关改装模块","modelInfo":"5655cb0c93991b740423d1ba","model":"ITA-GZ1-GL","manufacturer":"深圳创易智能系统有限公司","uiid":14,"staMac":"DC:4F:22:2A:2E:20","chipid":"002A2E20"},"brandName":"Maker","brandLogo":"","showBrand":true,"productModel":"Sonoff","tags":{"disable_timers":[],"m_6d34_enri":"on"},"devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1},"family":{"familyid":"5ff81d3e04d5cd00080a4d90","index":0},"shareTo":[],"devicekey":"e1167b7c-402a-421d-a97d-bab2b2125708","online":true,"params":{"bindInfos":{"gaction":["3762d06b-dd8c-401a-bea5-2272fc3a6d34_ewelink-google-home-v1"]},"switch":"off","fwVersion":"3.5.0","rssi":-83,"staMac":"DC:4F:22:2A:2E:20","startup":"stay","sledOnline":"on","init":1,"pulse":"off","pulseWidth":500,"timers":[],"version":8,"only_device":{"ota":"success"},"ssid":"Skynet","bssid":"44:4e:6d:dd:9f:15"}},"index":0}],"total":1}}
2021-03-21 16:05:47.752 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f
2021-03-21 16:06:43.740 [DEBUG] [noff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
2021-03-21 16:06:47.604 [DEBUG] [onoff.internal.connections.Websocket] - Websocket Sending Message:ping
2021-03-21 16:06:47.608 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"xDxarGSJ","ts":1616339207607,"version":8}
2021-03-21 16:06:47.633 [DEBUG] [onoff.internal.connections.Websocket] - Pong Response received
2021-03-21 16:06:47.744 [DEBUG] [ding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"Multiuso","deviceid":"10002a293f","apikey":"3762d06b-dd8c-401a-bea5-2272fc3a6d34","extra":{"description":"WWJG001162","brandId":"5611402280a0e2630f7b102d","apmac":"d0:27:00:54:4f:cf","mac":"d0:27:00:54:4f:ce","ui":"开关改装模块","modelInfo":"5655cb0c93991b740423d1ba","model":"ITA-GZ1-GL","manufacturer":"深圳创易智能系统有限公司","uiid":14,"staMac":"DC:4F:22:2A:2E:20","chipid":"002A2E20"},"brandName":"Maker","brandLogo":"","showBrand":true,"productModel":"Sonoff","tags":{"disable_timers":[],"m_6d34_enri":"on"},"devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1},"family":{"familyid":"5ff81d3e04d5cd00080a4d90","index":0},"shareTo":[],"devicekey":"e1167b7c-402a-421d-a97d-bab2b2125708","online":true,"params":{"bindInfos":{"gaction":["3762d06b-dd8c-401a-bea5-2272fc3a6d34_ewelink-google-home-v1"]},"switch":"off","fwVersion":"3.5.0","rssi":-83,"staMac":"DC:4F:22:2A:2E:20","startup":"stay","sledOnline":"on","init":1,"pulse":"off","pulseWidth":500,"timers":[],"version":8,"only_device":{"ota":"success"},"ssid":"Skynet","bssid":"44:4e:6d:dd:9f:15"}},"index":0}],"total":1}}
2021-03-21 16:06:47.748 [DEBUG] [f.internal.messaging.MessageProvider] - Forwarding state to 10002a293f


Thanks for the reply. Sorry, I flashed the Sonoff Mini with Tasmota now. So will not be able to follow the steps.

Deleted account things and both S26 and 1ch basic, deleted .txt file in userdata/sonoff
Updated with r20, scan, both S26 and 1 ch basic discovered and added smoothly.
Thanks Dave !!

2.5.x: SonoffJars/org.openhab.binding.sonoff-2.5.13-SNAPSHOT_v2.2r1.jar at main · delid4ve/SonoffJars · GitHub
3.x: SonoffJars/org.openhab.binding.sonoff-3.1.0-SNAPSHOT_v2.2r1.jar at main · delid4ve/SonoffJars · GitHub

Various improvements and bug fixes

1 Like

I’ve tested the 2.5.13 v2.2r1 with a Basic and POW r2 and everything seems working as expected. :+1: :+1:

I have only a doubt for the 2 options related to polling in the POW.
What those should be used for?
thanks

consumption: if your running in cloud or mixed mode this will retrieve the consumption channels (5 in total) (kWh)

local: if your running in local only mode current/power/voltage are not sent from the device - just switching. This will retrieve the extra data at whatever intervals you want. If your in mixed or cloud you don’t need this

Hi Dave I just deleted my account thing, and my 2 devices to start again with your new code. Unfortunately this one is not even allowing an account to be added, please see logs below:

2021-03-27 12:29:26.384 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.sonoff.internal.handlers.HandlerAccount@42b018': null
java.lang.NullPointerException: null
	at org.openhab.binding.sonoff.internal.states.StateProvider.getStateType(StateProvider.java:89) ~[?:?]
	at org.openhab.binding.sonoff.internal.states.StateProvider.setState(StateProvider.java:81) ~[?:?]
	at org.openhab.binding.sonoff.internal.states.StateProvider.setStates(StateProvider.java:61) ~[?:?]
	at org.openhab.binding.sonoff.internal.handlers.HandlerAccount.initialize(HandlerAccount.java:98) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor45.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
2021-03-27 12:29:26.403 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'sonoff:account:fad0e9be48': null
java.lang.NullPointerException: null
	at org.openhab.binding.sonoff.internal.states.StateProvider.getStateType(StateProvider.java:89) ~[?:?]
	at org.openhab.binding.sonoff.internal.states.StateProvider.setState(StateProvider.java:81) ~[?:?]
	at org.openhab.binding.sonoff.internal.states.StateProvider.setStates(StateProvider.java:61) ~[?:?]
	at org.openhab.binding.sonoff.internal.handlers.HandlerAccount.initialize(HandlerAccount.java:98) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor45.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

Can you clear cache and try. I have working here on 2.5.x and 3.x

I did the cache clear from the console, and same issue. Is there a different way to clear the cache other than stopping the service then doing the sudo console-cli clean-cache?

2021-03-27 13:31:05.141 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.sonoff.internal.handlers.HandlerAccount@13affcd': null
java.lang.NullPointerException: null
	at org.openhab.binding.sonoff.internal.states.StateProvider.getStateType(StateProvider.java:89) ~[?:?]
	at org.openhab.binding.sonoff.internal.states.StateProvider.setState(StateProvider.java:81) ~[?:?]
	at org.openhab.binding.sonoff.internal.states.StateProvider.setStates(StateProvider.java:61) ~[?:?]
	at org.openhab.binding.sonoff.internal.handlers.HandlerAccount.initialize(HandlerAccount.java:98) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor43.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
2021-03-27 13:31:05.159 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'sonoff:account:1b926125f9': null
java.lang.NullPointerException: null
	at org.openhab.binding.sonoff.internal.states.StateProvider.getStateType(StateProvider.java:89) ~[?:?]
	at org.openhab.binding.sonoff.internal.states.StateProvider.setState(StateProvider.java:81) ~[?:?]
	at org.openhab.binding.sonoff.internal.states.StateProvider.setStates(StateProvider.java:61) ~[?:?]
	at org.openhab.binding.sonoff.internal.handlers.HandlerAccount.initialize(HandlerAccount.java:98) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor43.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

Don’t think I changed the cache configuration but try deleting the files (userdata/sonoff) and running discovery again.

Yes deleting that text file with the device ID worked from the /var/lib/openhab/sonoff folder. Did another reboot of the server after that, and account added properly, and all devices added instantly with a single scan.

This version is beauty!

1 Like

Thanks for all your comments and findings.
Concerning the DW2 Wifi, what mode is required now?
I am asking cause I’m concerned running in cloud mode when it means China is always listening or do I get it wrong?

And where will I get the description how to set the binding up, is it provided in the binding description in openhab?

The DW2 is cloud only I’m afraid so unfortunately has to go through the ewelink servers.

The first post in this thread.

I was wondering: would the binding work also with “compatible” sonoff devices?
E.G. I found on Amazon some items sold as compatible with the EweLink app:

My guess would be that it should, but if I understood correctly each new item needs to be “coded” into the binding and then a new version has to be released, right?