Ewelink / Sonoff Binding - New binding without flashing

It does need to be connected, yes. Some scenario’s:

Local mode chosen:
Api (https): The account will ONLY hit the ewelink servers when a discovery scan is run in order to retrieve devices and encryption keys. No other connection is made outside of the local network.

Websocket: not started

LAN (mDNS): local multicast traffic for updates.
local polling can be enabled in this mode as streaming data requires the api to activate it. This means a device can be blocked by a local firewall or on an isolated vlan (as long as openhab is part of the vlan for multicast traffic or your router supports multicast forwarding)

Cloud mode chosen:

Api (https): on initialise, on discovery scan, every 60 seconds * (to enable streaming data), when a device requests consumption data (POW/POWR2)

  • I could make it longer than 60 seconds BUT; If you open ewelink app or another connection it will disconnect and openhab won’t receive data while it’s disconnected.

Websocket (wss) - continuous connection to receive device updates

LAN: not started

Mixed mode:
All connections enabled. LAN supported devices can be blocked by the firewall if required and local polling enabled, but still allows support for devices that do not support local mode such as the zigbee bridge and various other devices

Thanks for quick reply. One more question. I was trying to scan one sonoff mini r2 in DIY mode. This is not discovered by binding.

Do i need to add devices first to ewelink app in normal mode.

Thanks!

I currently feed all my av equipment (PlayStation/multiple virgin tivo boxes/NAS and pi for Kodi/cctv etc from a central location over IP to tv’s using these:

I want to make the dip switches smart so I can be lazy and get Alexa to change the device the receiver is connected to.

I wondered if anyone has as I want to know what uiid they come back as (whether they support lan mode)

Dave hi. Major progress Thanks. My Sonoff doortrap is discovered perfectly. The problem is that it remains OFFLINE, Two questions plz

  1. Since from my mobile the ewlink app works ok , am I right that only one connection can be available , so I have to remove APP from mobile and do new pairing only with my laptop connected to openhab , rasp pi 4 , ?
  2. Having read the above communications , do I have to select “cloud and local” ? or can I only select “local” … to stay away from ewelink servers ?
    Partial Logs follows (to look for OFFLINE) Thanks again, Dimitri
openhab> log:tail
17:45:48.088 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:account:03cec45dcc' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
17:45:48.137 [DEBUG] [sonoff.internal.connections.Websocket] - Stopping websocket client
17:45:48.140 [ERROR] [sonoff.internal.connections.Websocket] - Websocket Closed, Status Code: 1000, Reason:null
17:46:57.056 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:account:2d38a8018a' changed from UNINITIALIZED to INITIALIZING
17:46:57.072 [DEBUG] [onoff.internal.handler.HandlerAccount] - Initialising Sonoff Account: sonoff:account:2d38a8018a
17:46:57.082 [DEBUG] [.sonoff.internal.states.StateProvider] - Added new state for device 1001038d41
17:46:57.090 [DEBUG] [onoff.internal.handler.HandlerAccount] - Local Mode connected
17:46:57.093 [DEBUG] [nding.sonoff.internal.connections.Api] - Api CountryCode changed to:+93
17:46:57.095 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:account:2d38a8018a' changed from INITIALIZING to ONLINE (COMMUNICATION_ERROR): Cloud Offline

17:46:59.393 [DEBUG] [ff.internal.messaging.MessageProvider] - Websocket received message: {"error":0,"apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","config":{"hb":1,"hbInterval":145},"sequence":"1615996019306"}
17:46:59.396 [DEBUG] [onoff.internal.handler.HandlerAccount] - Remote Mode connected
17:46:59.402 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:account:2d38a8018a' changed from ONLINE (COMMUNICATION_ERROR): Cloud Offline to ONLINE
17:47:03.827 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"qnXWGDAD","ts":1615996023827,"version":8}
17:47:04.063 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-ota.coolkit.cc/logo/q62PevoglDNmwUJ9oPE7kRrpt1nL1CoA.png","showBrand":true,"productModel":"DW2-Wi-Fi","devConfig":{"lowVolAlarm":2.6},"settings":

You don’t need to remove the app, just be aware that if you open it then it will enter into a race with openhab as ewelink only allow 1x connection. It’s not going to break it (you’ll just keep seeing disconnects every minute roughly in openhab), you can use the openhab app though once your set up.
You don’t have to pair the device with openhab, as long as it’s in the app that’s good enough

You have to use cloud or mixed mode as your device (uiid 102) is not lan supported. If you have other devices that support lan mode then you can use mixed.

Supported uiids in lan mode:
1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 15, 32, 44, 77, 78, 103, 104, 126

Is the file created now?
The device should come online nigh on instantly (checks the connection on startup/adding)
If not can you enable trace logging as there may be extra logs in there that will help me see why it’s not coming online

Also there is nothing in that log for the device itself, just the account.

Dave , yes it created 1001038d41.txt file under userdata . Contains info below:
Thanks Dimitri

{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-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,"doorOnNotify":1,"doorOffNotify":1},"devGroups":[],"family":{"familyid":"603aa822a2965000071f8c52","index":0,"roomid":"603aa822a2965000071f8c4f"},"shareTo":[],"devicekey":"bb148e58-4ca6-43c1-82ae-730ee32fc75d","online":false,"params":{"rssi":-81,"fwVersion":"1000.2.924","battery":2.839,"type":4,"chipID":"d027020717d2","mac":"d027020717d2","switch":"on","lastUpdateTime":"2021-03-13T20:18:17.445Z","actionTime":"2021-03-13T07:38:52.800Z"},"denyFeatures":["sceneClick"]}


openhab> Log:set debug org.openhab.binding.sonoff
openhab> log:tail
19:34:44.243 [DEBUG] [sonoff.internal.connections.Websocket] - Websocket Sending Message:ping
19:34:44.328 [DEBUG] [sonoff.internal.connections.Websocket] - Pong Response received
19:34:49.300 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"LpWFnQZw","ts":1616002489300,"version":8}
19:34:49.519 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-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,"doorOnNotify":1,"doorOffNotify":1},"devGroups":[],"family":{"familyid":"603aa822a2965000071f8c52","index":0,"roomid":"603aa822a2965000071f8c4f"},"shareTo":[],"devicekey":"bb148e58-4ca6-43c1-82ae-730ee32fc75d","online":false,"params":{"rssi":-92,"fwVersion":"1000.2.924","battery":2.816,"type":4,"chipID":"d027020717d2","mac":"d027020717d2","switch":"off","lastUpdateTime":"2021-03-17T17:19:40.464Z","actionTime":"2021-03-17T16:55:54.414Z"},"denyFeatures":["sceneClick"]},"index":0}],"total":1}}
19:34:49.530 [DEBUG] [ff.internal.messaging.MessageProvider] - Forwarding state to 1001038d41
19:35:23.553 [DEBUG] [onoff.internal.handler.HandlerAccount] - Sonoff - Running dispose()
19:35:23.560 [ERROR] [ff.internal.messaging.MessageProvider] - Error Running queue:null
19:35:23.559 [DEBUG] [nding.sonoff.internal.connections.Lan] - Sonoff - Stopping LAN connection
19:35:23.567 [DEBUG] [nding.sonoff.internal.connections.Lan] - Unregistered all LAN services
19:35:25.574 [DEBUG] [sonoff.internal.connections.Websocket] - Stopping websocket client
19:35:25.597 [DEBUG] [onoff.internal.handler.HandlerAccount] - Initialising Sonoff Account: sonoff:account:2d38a8018a
19:35:25.616 [DEBUG] [.sonoff.internal.states.StateProvider] - Added new state for device 1001038d41
19:35:25.632 [DEBUG] [onoff.internal.handler.HandlerAccount] - Local Mode connected
19:35:25.643 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:account:2d38a8018a' changed from ONLINE to ONLINE (COMMUNICATION_ERROR): Cloud Offline
19:35:25.647 [DEBUG] [off.internal.handler.HandlerBaseCloud] - bridgeStatusChanged ONLINE (COMMUNICATION_ERROR): Cloud Offline for thing sonoff:102:2d38a8018a:1001038d41
19:35:25.646 [DEBUG] [nding.sonoff.internal.connections.Api] - Api CountryCode changed to:+30
19:35:25.658 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Region Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"vQENXYmh","ts":1616002525657,"version":8,"countryCode":"+30"}
19:35:25.670 [DEBUG] [sonoff.internal.connections.Websocket] - Stopping websocket client
19:35:25.676 [ERROR] [sonoff.internal.connections.Websocket] - Websocket Closed, Status Code: 1000, Reason:null
19:35:26.603 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Region Response:{"requestid":"1616002525657-vQENXYmh","region":"eu","error":0}
19:35:26.609 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Region changed to:eu
19:35:26.615 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Login Request:{"email":"draitsidis@yahoo.com","password":"SecretPassword","countryCode":"+30"}
19:35:27.657 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Login Respone:{"error":0,"msg":"","data":{"user":{"countryCode":"+30","email":"draitsidis@yahoo.com","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","accountLevel":10,"accountConsult":false,"denyRecharge":false,"ipCountry":"GR"},"at":"7a85d0e46632bd10e606c97f5c9ac8aa94cd7b56","rt":"5c430b9fa5b599b6e3638f34adfb2eb833103da9","region":"eu"}}
19:35:27.663 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Access Token changed to:7a85d0e46632bd10e606c97f5c9ac8aa94cd7b56
19:35:27.668 [DEBUG] [nding.sonoff.internal.connections.Api] - Api ApiKey changed to:92cdd98d-13a3-4578-8e01-839a747dfc95
19:35:27.673 [DEBUG] [nding.sonoff.internal.connections.Api] - Attempt to get websocket server
19:35:27.678 [DEBUG] [nding.sonoff.internal.connections.Api] - Websocket URL Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"HOW3Fs1t","ts":1616002527678,"version":8,"accept":"ws"}
19:35:33.441 [DEBUG] [nding.sonoff.internal.connections.Api] - Websocket URL Response:{"port":8080,"IP":"18.156.106.238","reason":"ok","domain":"eu-pconnect8.coolkit.cc","error":0}
19:35:34.133 [DEBUG] [sonoff.internal.connections.Websocket] - WebSocket Socket successfully connected to eu-pconnect8.coolkit.cc/18.156.106.238
19:35:34.138 [DEBUG] [onoff.internal.handler.HandlerAccount] - Logging in to websocket
19:35:34.142 [DEBUG] [ff.internal.messaging.MessageProvider] - Message Type added: 1616002534137 - login
19:35:34.146 [DEBUG] [sonoff.internal.connections.Websocket] - Websocket Sending Message:{"action":"userOnline","at":"7a85d0e46632bd10e606c97f5c9ac8aa94cd7b56","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"3pSwjl93","ts":1616002534,"userAgent":"app","sequence":1616002534137,"version":8}
19:35:34.232 [DEBUG] [ff.internal.messaging.MessageProvider] - Websocket received message: {"error":0,"apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","config":{"hb":1,"hbInterval":145},"sequence":"1616002534137"}
19:35:34.237 [DEBUG] [onoff.internal.handler.HandlerAccount] - Remote Mode connected
19:35:34.244 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:account:2d38a8018a' changed from ONLINE (COMMUNICATION_ERROR): Cloud Offline to ONLINE
19:35:34.248 [DEBUG] [off.internal.handler.HandlerBaseCloud] - bridgeStatusChanged ONLINE for thing sonoff:102:2d38a8018a:1001038d41
19:35:38.454 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"5D9E968h","ts":1616002538454,"version":8}
19:35:38.649 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-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,"doorOnNotify":1,"doorOffNotify":1},"devGroups":[],"family":{"familyid":"603aa822a2965000071f8c52","index":0,"roomid":"603aa822a2965000071f8c4f"},"shareTo":[],"devicekey":"bb148e58-4ca6-43c1-82ae-730ee32fc75d","online":false,"params":{"rssi":-92,"fwVersion":"1000.2.924","battery":2.816,"type":4,"chipID":"d027020717d2","mac":"d027020717d2","switch":"off","lastUpdateTime":"2021-03-17T17:19:40.464Z","actionTime":"2021-03-17T16:55:54.414Z"},"denyFeatures":["sceneClick"]},"index":0}],"total":1}}
19:35:38.668 [DEBUG] [ff.internal.messaging.MessageProvider] - Forwarding state to 1001038d41
19:35:46.596 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:102:2d38a8018a:1001038d41' changed from OFFLINE to REMOVING
19:35:46.602 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:102:2d38a8018a:1001038d41' changed from REMOVING to REMOVED
19:35:46.612 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:102:2d38a8018a:1001038d41' changed from REMOVED to UNINITIALIZED
19:35:46.628 [DEBUG] [off.internal.handler.HandlerBaseCloud] - Running dispose()
19:35:46.643 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:102:2d38a8018a:1001038d41' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
19:36:33.453 [DEBUG] [sonoff.internal.connections.Websocket] - Websocket Sending Message:ping
19:36:33.454 [DEBUG] [onoff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
19:36:33.539 [DEBUG] [sonoff.internal.connections.Websocket] - Pong Response received
19:36:38.462 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"i42Ql2wR","ts":1616002598462,"version":8}
19:36:38.741 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-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,"doorOnNotify":1,"doorOffNotify":1},"devGroups":[],"family":{"familyid":"603aa822a2965000071f8c52","index":0,"roomid":"603aa822a2965000071f8c4f"},"shareTo":[],"devicekey":"bb148e58-4ca6-43c1-82ae-730ee32fc75d","online":false,"params":{"rssi":-92,"fwVersion":"1000.2.924","battery":2.816,"type":4,"chipID":"d027020717d2","mac":"d027020717d2","switch":"off","lastUpdateTime":"2021-03-17T17:19:40.464Z","actionTime":"2021-03-17T16:55:54.414Z"},"denyFeatures":["sceneClick"]},"index":0}],"total":1}}
19:36:38.747 [ERROR] [ff.internal.messaging.MessageProvider] - Cannot forward state for 1001038d41, listener not present
19:37:16.808 [DEBUG] [binding.sonoff.internal.MainDiscovery] - Stop Scan
19:37:16.814 [DEBUG] [binding.sonoff.internal.MainDiscovery] - Start Scan
19:37:16.821 [DEBUG] [binding.sonoff.internal.MainDiscovery] - Sonoff - Start Discovery
19:37:16.830 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Cache Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"S3KlONmD","ts":1616002636829,"version":8}
19:37:17.023 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Cache response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-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,"doorOnNotify":1,"doorOffNotify":1},"devGroups":[],"family":{"familyid":"603aa822a2965000071f8c52","index":0,"roomid":"603aa822a2965000071f8c4f"},"shareTo":[],"devicekey":"bb148e58-4ca6-43c1-82ae-730ee32fc75d","online":false,"params":{"rssi":-92,"fwVersion":"1000.2.924","battery":2.816,"type":4,"chipID":"d027020717d2","mac":"d027020717d2","switch":"off","lastUpdateTime":"2021-03-17T17:19:40.464Z","actionTime":"2021-03-17T16:55:54.414Z"},"denyFeatures":["sceneClick"]},"index":0}],"total":1}}
19:37:17.032 [DEBUG] [onoff.internal.handler.HandlerAccount] - Creating the device cache file for device 1001038d41
19:37:17.036 [INFO ] [binding.sonoff.internal.MainDiscovery] - Discovered device 1001038d41
19:37:17.043 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'sonoff:102:2d38a8018a:1001038d41' to inbox.
19:37:17.059 [INFO ] [openhab.event.InboxAddedEvent        ] - Discovery Result with UID 'sonoff:102:2d38a8018a:1001038d41' has been added.
19:37:33.461 [DEBUG] [onoff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
19:37:33.461 [DEBUG] [sonoff.internal.connections.Websocket] - Websocket Sending Message:ping
19:37:33.549 [DEBUG] [sonoff.internal.connections.Websocket] - Pong Response received
19:37:38.467 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"SpxlAQ3N","ts":1616002658467,"version":8}
19:37:38.660 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-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,"doorOnNotify":1,"doorOffNotify":1},"devGroups":[],"family":{"familyid":"603aa822a2965000071f8c52","index":0,"roomid":"603aa822a2965000071f8c4f"},"shareTo":[],"devicekey":"bb148e58-4ca6-43c1-82ae-730ee32fc75d","online":false,"params":{"rssi":-92,"fwVersion":"1000.2.924","battery":2.816,"type":4,"chipID":"d027020717d2","mac":"d027020717d2","switch":"off","lastUpdateTime":"2021-03-17T17:19:40.464Z","actionTime":"2021-03-17T16:55:54.414Z"},"denyFeatures":["sceneClick"]},"index":0}],"total":1}}
19:37:38.679 [ERROR] [ff.internal.messaging.MessageProvider] - Cannot forward state for 1001038d41, listener not present
19:38:33.465 [DEBUG] [onoff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
19:38:33.474 [DEBUG] [sonoff.internal.connections.Websocket] - Websocket Sending Message:ping
19:38:33.557 [DEBUG] [sonoff.internal.connections.Websocket] - Pong Response received
19:38:38.477 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"PfSTCDPV","ts":1616002718476,"version":8}
19:38:38.684 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-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,"doorOnNotify":1,"doorOffNotify":1},"devGroups":[],"family":{"familyid":"603aa822a2965000071f8c52","index":0,"roomid":"603aa822a2965000071f8c4f"},"shareTo":[],"devicekey":"bb148e58-4ca6-43c1-82ae-730ee32fc75d","online":false,"params":{"rssi":-92,"fwVersion":"1000.2.924","battery":2.816,"type":4,"chipID":"d027020717d2","mac":"d027020717d2","switch":"off","lastUpdateTime":"2021-03-17T17:19:40.464Z","actionTime":"2021-03-17T16:55:54.414Z"},"denyFeatures":["sceneClick"]},"index":0}],"total":1}}
19:38:38.695 [ERROR] [ff.internal.messaging.MessageProvider] - Cannot forward state for 1001038d41, listener not present
19:38:41.865 [WARN ] [hab.binding.mqtt.generic.ChannelState] - Incoming payload '{"Time":"2021-03-17T19:38:42","Uptime":"0T17:54:03","UptimeSec":64443,"Heap":31,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":4,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SP123","BSSId":"98:DA:C4:60:2C:58","Channel":11,"RSSI":64,"Signal":-68,"LinkCount":1,"Downtime":"0T00:00:06"}}' not supported by type 'NumberValue'
19:38:41.915 [WARN ] [rofiles.JSonPathTransformationProfile] - Could not transform state '0' with function 'JSONPATH:$.ENERGY.Voltage' and format '%s'
19:38:56.814 [DEBUG] [binding.sonoff.internal.MainDiscovery] - Stop Scan
19:39:33.469 [DEBUG] [onoff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
19:39:33.481 [DEBUG] [sonoff.internal.connections.Websocket] - Websocket Sending Message:ping
19:39:33.563 [DEBUG] [sonoff.internal.connections.Websocket] - Pong Response received
19:39:38.484 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"rDt5cvCV","ts":1616002778483,"version":8}
19:39:38.676 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-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,"doorOnNotify":1,"doorOffNotify":1},"devGroups":[],"family":{"familyid":"603aa822a2965000071f8c52","index":0,"roomid":"603aa822a2965000071f8c4f"},"shareTo":[],"devicekey":"bb148e58-4ca6-43c1-82ae-730ee32fc75d","online":false,"params":{"rssi":-92,"fwVersion":"1000.2.924","battery":2.816,"type":4,"chipID":"d027020717d2","mac":"d027020717d2","switch":"off","lastUpdateTime":"2021-03-17T17:19:40.464Z","actionTime":"2021-03-17T16:55:54.414Z"},"denyFeatures":["sceneClick"]},"index":0}],"total":1}}
19:39:38.687 [ERROR] [ff.internal.messaging.MessageProvider] - Cannot forward state for 1001038d41, listener not present
19:39:50.211 [INFO ] [openhab.event.InboxRemovedEvent      ] - Discovery Result with UID 'sonoff:102:2d38a8018a:1001038d41' has been removed.
19:39:50.222 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:102:2d38a8018a:1001038d41' changed from UNINITIALIZED to INITIALIZING
19:39:50.236 [DEBUG] [off.internal.handler.HandlerBaseCloud] - Initialising device: sonoff:102:2d38a8018a:1001038d41
19:39:50.265 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'sonoff:102:2d38a8018a:1001038d41' changed from INITIALIZING to OFFLINE
19:40:33.474 [DEBUG] [onoff.internal.handler.HandlerAccount] - Sonoff Connection Check Running
19:40:33.487 [DEBUG] [sonoff.internal.connections.Websocket] - Websocket Sending Message:ping
19:40:33.570 [DEBUG] [sonoff.internal.connections.Websocket] - Pong Response received
19:40:38.491 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Discovery Request:{"appid":"oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq","nonce":"DRzgZsW3","ts":1616002838491,"version":8}
19:40:38.724 [DEBUG] [nding.sonoff.internal.connections.Api] - Api Devices response:{"error":0,"msg":"","data":{"thingList":[{"itemType":1,"itemData":{"name":"DoorTrap1","deviceid":"1001038d41","apikey":"92cdd98d-13a3-4578-8e01-839a747dfc95","extra":{"uiid":102,"description":"20201022001","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:02:07:17:d3","mac":"d0:27:02:07:17:d2","ui":"WiFi门磁","modelInfo":"5e1541388ceaa2dd27be4af4","model":"OPL-DMA-GL","manufacturer":"深圳松诺技术有限公司"},"brandName":"SONOFF","brandLogo":"https://eu-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,"doorOnNotify":1,"doorOffNotify":1},"devGroups":[],"family":{"familyid":"603aa822a2965000071f8c52","index":0,"roomid":"603aa822a2965000071f8c4f"},"shareTo":[],"devicekey":"bb148e58-4ca6-43c1-82ae-730ee32fc75d","online":false,"params":{"rssi":-92,"fwVersion":"1000.2.924","battery":2.816,"type":4,"chipID":"d027020717d2","mac":"d027020717d2","switch":"off","lastUpdateTime":"2021-03-17T17:19:40.464Z","actionTime":"2021-03-17T16:55:54.414Z"},"denyFeatures":["sceneClick"]},"index":0}],"total":1}}
19:40:38.742 [DEBUG] [ff.internal.messaging.MessageProvider] - Forwarding state to 1001038d41

look in that last log entry (json). device isn’t connected to the internet. That field represents whether the device can reach the ewelink servers and ewelink server can reach the device.

in fact, in every log entry its false. That’s why it shows offline

i remember you saying the it goes to sleep and disables wifi. monitor the logs coming in to see if the values update respectively in openhab. if you link the channels to the device then you should still get updates. try and wake the device up too to see what happens to the status (comes online).

The binding only sends streaming data activation if the device is online so you wont get a websocket message. ill have to add a test in for you to see if it accepts the activate message even though its offline, other devices when offline just tell you to f-off i’m offline, maybe this works differently due to the sleeping.

the problem you have is that if it doesnt accept the message then your only going to get updates every 60 seconds… i can always add a poll in if this is the case but thats a poor workaround.

I started from scratch and now all sonoff’s go online. I can also control the switches. But not for the TH16R2 (it’s not only TH16, but TH16R2). Switch somehow does not work, but it does reflect status if I switch it using ewelink.
I also could not see temperature or humidity sensors data, but after a restart, it started to show temperature and for humidity it gives below error:

2021-03-17 22:26:36.340 [INFO ] [inding.sonoff.internal.MainDiscovery] - Discovered device 1000aed035
2021-03-17 22:26:36.341 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'sonoff:15:81579b0ecd:1000aed035' to inbox.
2021-03-17 22:30:39.348 [WARN ] [f.internal.messaging.MessageProvider] - Ok message not received for transaction: 1616005838342, command was switch, retrying again. Retry count 2
2021-03-17 22:31:44.310 [ERROR] [f.internal.messaging.MessageProvider] - Websocket response is not handled, this should be reported to the binding developer: {"error":0,"deviceid":"1000bfd602","apikey":"ac1d2c64-7e8f-41d6-b857-d51133d1c4e4","sequence":"1616005904111"}
2021-03-17 22:31:44.312 [ERROR] [f.internal.messaging.MessageProvider] - Websocket message didnt have any content
2021-03-17 22:33:32.386 [WARN ] [e.internal.SseItemStatesEventBuilder] - Exception while formatting value '0.53000000' of item KidsSensor_Humidity with format '%.2f %': Conversion = '%'
2021-03-17 22:35:06.772 [ERROR] [f.internal.messaging.MessageProvider] - Websocket response is not handled, this should be reported to the binding developer: {"error":0,"deviceid":"1000ba43e9","apikey":"ac1d2c64-7e8f-41d6-b857-d51133d1c4e4","sequence":"1616006106447"}
2021-03-17 22:35:06.773 [ERROR] [f.internal.messaging.MessageProvider] - Websocket message didnt have any content
2021-03-17 22:35:29.333 [WARN ] [e.internal.SseItemStatesEventBuilder] - Exception while formatting value '0.53000000' of item KidsSensor_Humidity with format '%.2f %': Conversion = '%'
2021-03-17 22:35:34.002 [WARN ] [e.internal.SseItemStatesEventBuilder] - Exception while formatting value '0.53000000' of item KidsSensor_Humidity with format '%.2f %': Conversion = '%'
2021-03-17 22:38:33.065 [WARN ] [e.internal.SseItemStatesEventBuilder] - Exception while formatting value '0.53000000' of item KidsSensor_Humidity with format '%.2f %': Conversion = '%'
2021-03-17 22:38:34.248 [WARN ] [e.internal.SseItemStatesEventBuilder] - Exception while formatting value '0.53000000' of item KidsSensor_Humidity with format '%.2f %': Conversion = '%

There’s also this MainSwitch Channel with the below message:

Main Switch
sonoff:15:81579b0ecd:1000aed035:mainSwitch
Not known what this does at present so no control

Can you send me the file for the th16r2 so I can take a look.

Is this what you mean? Can you also see what’s wrong with the humidity % value which appears like 0.5300000 and raises an exception in logs?

# cat 1000aed035.txt 
{"name":"Kids Sensor","deviceid":"1000aed035","apikey":"ac1d2c64-7e8f-41d6-b857-d51133d1c4e4","extra":{"uiid":15,"description":"20191008003","brandId":"5c4c1aee3a7d24c7100be054","apmac":"d0:27:01:5d:9d:bb","mac":"d0:27:01:5d:9d:ba","ui":"恒温恒湿改装件","modelInfo":"5c700feecc248c47441fd24f","model":"PSA-BHA-GL","manufacturer":"深圳松诺技术有限公司","chipid":"00689F4D","staMac":"CC:50:E3:68:9F:4D"},"brandName":"SONOFF","brandLogo":"https://as-ota.coolkit.cc/logo/q62PevoglDNmwUJ9oPE7kRrpt1nL1CoA.png","showBrand":true,"productModel":"TH16R2","devConfig":{},"settings":{"opsNotify":0,"opsHistory":1,"alarmNotify":1,"wxAlarmNotify":0,"wxOpsNotify":0,"wxDoorbellNotify":0,"appDoorbellNotify":1},"devGroups":[],"family":{"familyid":"5ea0a76f4e4fc50007e5dc96","index":-1,"roomid":"5ea0a76f4e4fc50007e5dc95"},"shareTo":[],"devicekey":"98ad2293-c831-4d11-b62f-e8b14bd69763","online":true,"params":{"timers":[],"mainSwitch":"off","deviceType":"normal","currentTemperature":"23.0","currentHumidity":"52","sensorType":"AM2301","pulseWidth":500,"pulse":"off","startup":"off","staMac":"CC:50:E3:68:9F:4D","rssi":-91,"fwVersion":"3.4.1","switch":"off","init":1,"sledOnline":"off","version":8,"bindInfos":{"gaction":["ac1d2c64-7e8f-41d6-b857-d51133d1c4e4_ewelinkGoogleHome"],"smartThings":[]},"targets":[{"targetHigh":"26.5","reaction":{"switch":"on"}},{"targetLow":"25.5","reaction":{"switch":"off"}}]},"denyFeatures":["switchWifi"]}

Already sorted. So what is mainSwitch used for… would like to get done before I compile.
Don’t see why there’s switch and mainswitch

I have no idea frankly speaking. Any way to debug or understand? Could it be the button on the device?
Anyway we can test the normal switch again with your new configuration.

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

@Emre7

  • have added control in for mainSwitch so you can see what it does. You may have to remove the thing and clear cache as its now switch type instead of string type
  • fixed humidity

Thanks. I will try now. For the mainswitch, I found this, which seems it’s the hardware one click button on the device that triggers the on/off state of the relay manually.

Which means that the physical button which is on GPIO 0 (device MainSwitch) triggers the rules which activate the GPIO 12 (the relay) and this in turns activate the rule to activate the LED on or off. This enables to have the LED in the correct position even when a command is sent from domoticz instead of using the physical button.

in Rules, syntax in if ... - Let's Control It

Also for next release, maybe for country code selection, could you inherit from main openhab instance? When setting up openhab, we already choose a region, it would be good if Account team region selection could default to that. Also for cosmetics, It still says “phone number code” while we choose country in latest versions.

Humidity is now showing as a number, without % at the end.
Temperature sensor is still showing UNDEF
Humidity in item details showing ERR

[WARN ] [e.internal.SseItemStatesEventBuilder] - Exception while formatting value '45' of item KidsSensor_Humidity with format '%.2f %': Conversion = %


Ohh that sounds really good, an Ewelink binding…
Please some explanations:
I can read the Ewelink login is required, so we still will use the chinese cloud, or is this just initially?
Can I also include the Sonoff DW2 wifi sensor which is using the OPL1000 chip what doesn’t allow tasmota on it?

Hi @boris03 , this works with Sonoff original firmware, Tasmota is not needed. You choose your region when setting up the account, and it gets authenticated accordingly. Try it…

Dave hi, I did not reply earlier because I was confused. Now I know the answer. As mentioned my device (doortrap) is battery operated , so it seems that for energy conservation purposes is always in sleep mode except when wakes up , door opens / closes. .
It seems it is working perfectly . I will do more tests but I inform you and other people too not to get confused by seeing it is OFFLINE… I will come back when my tests are completed. Thanks again
Dimitri

Next release has the region/countrycode removed completely as I’ve found another way.

What was the result?

Updated, should now read as ‘%RH’

Fixed (hopefully :stuck_out_tongue_closed_eyes:)

Depends on the device, a few posts up I have detailed the uiid’s that allow LAN connection (also shown in Readme)

Add the binding (use version from a few posts up for now), add your account and run discovery. It will let you know in the logs (debug) if the device is not supported (to which you can send me the file under userdata/sonoff and I’ll get added), if it is supported it will add it to the inbox.