EWeLink Binding

hi all,

I know there have been several posts about integrating Sonoff devices into OpenHAB using tasmota and re-flashing these devices, but I was wondering whether anyone is working on a binding for EWeLink now given that they offer API access.

Yes, I could write some scripts to do this but before I embark down this route (as I don’t want to re-flash my devices, been there and had to replace a couple due to some failed upgrades) just wondering if anyone is planning anything ?

Many thanks



please if you find solution to ewelink app do share with us here, thanks

yes, i’m really interested in that. i don’t want to flash my devices too. it would be great if someone (you) are willing to code something. i would be really a alpha tester for that.

Hi, it’s gone on the back-burner for a while for me…I had it working a treat and then everything just stopped due to changes implemented by Itead on their cloud platform and could not work out what was wrong, so gave up…

Because of these changes and because there is limited integration out there, IFTT would be the best way to go.

Bumping this hoping things have changed. There’s some aesthetically pleasing ewelink wall switches I would like to integrate.

did you try the trick suggested by @airbone42 using the Ewelink API?

Looks like some work may have started on this.

Guys can you add jar, fill in username and password and region (eu /us/cc/cn) for your ewelink account. run discovery and send me the log for Discover Devices Response (info level). mask apikey/at/rt/username/password but dont remove them from json
i only have powr2 - which by the way you can use (cloud only atm and not running long enough to check if token refreshes correctly (should do but…).

let me know what devices they are (model) as the api just says POW for the R2 so want to be clear.

need to get the json for other devices. do have some but wanna try and get most integrated in one hit.

ill also compile 2.5.11 and 3 once im 90% done.

org.openhab.binding.sonoff-2.5.2-SNAPSHOT.jar.txt (76.8 KB)

Hi Dave PM you with my JSON, thanks.

For others this is how I got it to work.
Dowloaded and copied the .jar.txt file above to the addons directory in openHAB and removed .txt extension

On my RasPi changed the ownership of the .jar

cd /usr/share/openhab2/addons
sudo chown openhab:openhab org.openhab.binding.sonoff-2.5.2-SNAPSHOT.jar
sudo shutdown

After shutdown cycled power and started Log Viewer and opened the Paper UI. In the paper UI I selected ‘inbox’ and the ‘+’ symbol, scrolled down the list and clicked ‘Sonoff Binding’ then clicked ’ Sonoff Account Thing’ and entered my account information.

In the log viewer I go some messages like:

2021-01-17 18:14:07.331 [hingStatusInfoChangedEvent] - 'sonoff:account:xxxxxxxx' changed from UNINITIALIZED to INITIALIZING

2021-01-17 18:14:12.372 [WARN ] [core.thing.internal.ThingManagerImpl] - Initializing handler for thing 'sonoff:account:b5d80086' takes more than 5000ms.

2021-01-17 18:14:15.532 [INFO ] [ding.sonoff.internal.connections.Api] - Get WebSocket Server Response Raw:{"port":8080,"IP":"","reason":"ok","domain":"eu-pconnect2.coolkit.cc","error":0}

2021-01-17 18:14:16.221 [WARN ] [noff.internal.handler.AccountHandler] - Sonoff - Websocket Logged In

2021-01-17 18:14:15.559 [hingStatusInfoChangedEvent] - 'sonoff:account:xxxxxxxx' changed from INITIALIZING to OFFLINE (CONFIGURATION_PENDING): Waiting for api to log in

2021-01-17 18:14:16.222 [hingStatusInfoChangedEvent] - 'sonoff:account:xxxxxxxx' changed from OFFLINE (CONFIGURATION_PENDING): Waiting for api to log in to ONLINE

Back in Paper UI , select ‘Things’ and the ‘+’ button then select ’ sonoff Binding’

The JSON message is then in the log viewer after the response.

2021-01-17 18:20:59.340 [INFO ] [ding.sonoff.internal.connections.Api] - Get Devices Response:

1 Like

Not far off now guys so will have a beta version up very soon. Been a learning curve in communications and encryption and learning the packages available (only ever used http and never AES security) :slight_smile:

At present I have the following implemented:

  • Remote Api
    • initial discovery to get encryption keys etc
    • sending commands to the device
  • Remote websocket
    • streaming data for updates
  • Local mDns/Zeroconf
    • streaming data for updates
    • sending commands to the device

Just got to clean up my code, add supported devices in and it’ll be ready to go.


Hi Dave, happy to help with testing of this binding when you are ready… if it helps

what devices do you have @sam070266?

Try these:
(Files updated 30/01/21 16:37)

DELETED - see further posts


I have 2 x Prolinx 4 port switches and 2 x 2 ports.

@sam070266 can you add binding, set the logging level to debug, add account thing, and send me the logs (hash out username/password).

log:set debug org.openhab.binding.sonoff


Guys, new thread for the binding here so i can keep top post updated at all times with new versions.

Just a question, would this circuit breaker work with this binding?