EwelinkNET is an API writen in .NET Standard to interact directly with eWeLink API using your regular credentials. Compatible with Windows, Linux and MAC.
var ewelink = new Ewelink(Email, Password, Region);
await ewelink.GetCredentials();
await ewelink.GetDevices();
var device = ewelink.Devices.First(x=> x.deviceid == deviceId) as SwitchDevice;
device.TurnOn();
Use Email, Password and Region to get Ewelink credentials, that includes required information to perform actions.
var ewelink = new Ewelink(Email, Password, Region);
var credentials = await ewelink.GetCredentials();
Alternately, you can save credentials to avoid login.
ewelink.StoreCredenditalsFromFile();
And later restore with,
ewelink.RestoreCredenditalsFromFile();
EwelinkNET uses a hardcoded API_ID and API_SECRET to authenticate. But Ewelink is changing their Auth process. So you can log into official https://dev.ewelink.cc/ and generate your own API_ID and API_SECRET
var ewelink = new Ewelink(Email, Password, YOUR_API_ID, YOUR_API_SECRET, Region);
var credentials = await ewelink.GetCredentials();
Get Devices registered in you Ewelink account.
var ewelink = new Ewelink(Email, Password, Region);
await ewelink.GetCredentials();
await ewelink.GetDevices();
Devices are converted to one of the following classes.
All of them are derived classes of generic Device
class.
Each class provides there own methods to perform actions or retrieve measurement.
For example, ThermostatDevice
provides
And, MultiSwitchDevice
provides
Changes in devices status are obtain through websocket connection, and provided events.
ewelink.OnDeviceChanged += (s, e) => Console.WriteLine(e.AsJson());
ewelink.OpenWebSocket();
Loaded devices states are updated accordly with new state.
It's possible to interact with eWelink devices throught LAN mode, without the need of internet connection or access to eWelink cloud.
For LAN mode to work, a ArpTable (and list or the Mac - Ip relationship) has to be provided, to allow find the device Ip.
ewelink.RestoreArpTableFromFile();