[External integration] Sonoff / eWeLink: your Sonoff devices locally, cloud as backup

Hello everyone,

Sonoff / eWeLink for Gladys

I present to you a new external integration to control Sonoff and eWeLink devices from Gladys, without reflashing them, by first going through the local network. The eWeLink cloud is only an optional backup.

Why?

The current eWeLink integration depends entirely on the cloud. This one uses the local protocol from the SonoffLAN project (the reference for Home Assistant):

  • your plugs and switches respond even without the internet;
  • commands are instantaneous (sent directly to the device on your network);
  • the cloud complements if you wish: encryption keys, names, Zigbee devices from a gateway, remote control.

Each device displays a Local / Cloud / Unreachable badge, with an orange dot when it is running in degraded mode (and the reason in the tooltip).

What is supported

More than 110 models: Basic, Mini, Micro, T1, TX Ultimate, M5, POW / POWR2 / POWR3 / S40 / S60 / DualR3 / SPM (power, voltage, current, energy), TH, D1, B02, B05, L1, L3, iFan, curtains and garage doors, Wi-Fi and Zigbee sensors (SNZB-01 to 06, DW2), TRVZB, NSPanel, SNZB-09P siren, water valves, RF Bridge 433.

Scenes

  • Triggers: Sonoff button pressed (single / double / long / triple), RF code received, Sonoff device (dis)connected, eWeLink cloud status changed.
  • Actions: Send an RF code, Send an eWeLink command (raw parameters), Restart Sonoff search.

Widgets: Sonoff Network (which goes where, monthly quota), Sonoff Energy (24-hour curve + buttons), RF Remote (your codes in buttons).

Examples: double press on the bedside button → turn everything off; RF code from the front door at night → turn on the entrance and send a message; freezer plug unreachable → notification.

Installation

Gladys 5.2.0 minimum. Integrations → search for « Sonoff Â» → Install, then Discovery tab → search.

  • DIY devices: nothing else to do.
  • Other devices: their messages are encrypted with a key that only the cloud knows. Create your own free developer application on dev.ewelink.cc, choose « Developer Application (OAuth) Â», paste the App ID and App Secret, save, declare the displayed redirect URI, then « Connect Â». The keys are kept: the local continues to work even if the cloud goes down. You can also enter a key manually.

Project status

The code is tested (108 automated tests), but not yet on real hardware. I am looking for testers, especially with POWR3, DualR3, iFan, RF Bridge, TRVZB and NSPanel. Please report the model, firmware and Integration Logs tab.

Repository: William-De71/gladys-sonoff-ewelink · GitHub

1 Like