SmartLifeNET is an API written in .NET Standard that allows us to interact directly with the SmartLife API using the user credentials from the official app.
SmartLifeNET is compatible with Windows, Linux, MAC, Android, and iOS, and allows performing actions on devices or retrieving measurements (temperature, humidity, power consumption…) from devices that support such functionality.
Some of the key features of SmartLifeNET are:
- Turn devices on and off
- Read measurements (humidity, temperature…)
- Cross-platform
For devices controlled by eWelink, visit the library eWelinkNET
Basic Usage
Here is a basic example of how to use SmartLifeNET.
var smart = new SmartLife(email, password);
await smart.Connect();
await smart.InitDevices();
var device = smart.Devices.FirstOrDefault(x => x is SmartLifeNet.Classes.SwitchDevice) as SmartLifeNet.Classes.SwitchDevice;
await device?.SetState(1);
Get Credentials
We can obtain the necessary credentials to perform the required actions using our Email and Password.
var smart = new SmartLife(email, password);
var credentials = await smart.GetCredentials();
Alternatively, you can save the obtained credentials to avoid having to log in later.
smart.StoreCredenditalsToFile();
Later, we can retrieve the credentials by doing.
smart.RestoreCredenditalsFromFile();
Get Devices
We can retrieve the devices registered in your SmartLife account.
var smart = new SmartLife(email, password);
await smart.Connect();
await smart.InitDevices();
The devices are converted into the following classes.
- SwitchDevice
- MultiSwitchDevice
All of them derive from the base class ‘Device’.
Interact with Devices
Each class has its own methods to perform the actions allowed by the device type.
For example, ‘SingleSwitchDevice’ provides:
- TurnOn()
- TurnOff()
While ‘MultiSwitchDevice’ provides:
- TurnOn()
- TurnOn(int channel)
- TurnOff()
- TurnOff(int channel)
Download the Code
SmartLife is an OpenSource project. The code for this post is available for download on GitHub.

