A .NET client library for controlling Eufy Security devices by connecting to Eufy cloud servers and local/remote stations over P2P.
π¨π¨π¨ WARNING π¨π¨π¨ This is absolutely not production ready. As it stands this is JUST the output of the automated conversion and still needs cleanup work. I'm still workign out the auth piece so you can actually connect. STAY TUNED.
π Credits: This project is a C# port of the excellent eufy-security-client TypeScript library by bropat. All credit for the original design, protocol reverse-engineering, and implementation goes to bropat and the contributors of the original project. This .NET port was created with assistance from Claude AI to bring this functionality to the .NET ecosystem.
- π Secure authentication with Eufy cloud
- π‘ P2P communication with stations (local and remote)
- πΉ Livestream support for cameras and doorbells
- π Push notification support via FCM
- π Support for multiple device types:
- Cameras (Indoor, Outdoor, Solo, Floodlight)
- Doorbells (Battery, Wired)
- Locks
- Sensors
- Stations/Hubs (HomeBase)
- β‘ Event-driven architecture
- π Automatic device discovery and updates
- π― Strongly-typed API
dotnet add package MostlyLucid.EufySecurityOr via NuGet Package Manager:
Install-Package MostlyLucid.EufySecurityusing MostlyLucid.EufySecurity;
using MostlyLucid.EufySecurity.Common;
// Configure the client
var config = new EufySecurityConfig
{
Username = "your-email@example.com",
Password = "your-password",
Country = "US",
Language = "en"
};
// Create and connect the client
using var client = new EufySecurityClient(config);
var authResult = await client.ConnectAsync();
if (authResult.RequiresTwoFactor)
{
// Check email for verification code
Console.Write("Enter 2FA code: ");
var code = Console.ReadLine();
authResult = await client.ConnectAsync(code);
}
// Get all devices
var devices = client.GetDevices();
foreach (var device in devices.Values)
{
Console.WriteLine($"Device: {device.Name} ({device.SerialNumber})");
}
// Start livestream from a camera
await client.StartLivestreamAsync(cameraSerial);
// Set guard mode on a station
await client.SetGuardModeAsync(stationSerial, GuardMode.Away);
// Listen for events
client.DeviceAdded += (sender, e) =>
{
Console.WriteLine($"Device added: {e.Device.Name}");
};
client.PushNotificationReceived += (sender, e) =>
{
Console.WriteLine($"Push notification: {e.Message.Type}");
};var config = new EufySecurityConfig
{
// Required
Username = "your-email",
Password = "your-password",
// Optional
Country = "US", // Must match Eufy app setting
Language = "en",
TrustedDeviceName = "MyApp",
PollingIntervalMinutes = 10, // Cloud polling interval
P2PConnectionSetup = P2PConnectionType.Quickest,
AcceptInvitations = true,
DisableAutomaticCloudPolling = false,
PersistentDataPath = "./eufy-data", // For storing credentials
// Logging
Logger = loggerInstance,
Logging = new LoggingConfig
{
Level = LogLevel.Information
}
};- EufyCam (1/E, 2/2C, 2 Pro, 3/3C)
- Indoor Cam (Pan & Tilt, 1080p, 2K, S350)
- SoloCam (E20, E40, L20, L40, S40)
- Floodlight Cam (8422, 8423, 8424, 8425, E340)
- Outdoor Cam (Pan & Tilt)
- Battery Doorbell (1/2, Plus, E340)
- Wired Doorbell
- Doorbell Dual
- Smart Lock (Touch & WiFi, R10, R20)
- Video Smart Lock
- Retrofit Smart Lock
- Entry Sensor
- Motion Sensor
- Keypad
- Smart Safe
- Smart Drop
The library provides comprehensive events for monitoring device state changes:
// Device/Station management
client.DeviceAdded += OnDeviceAdded;
client.DeviceRemoved += OnDeviceRemoved;
client.StationAdded += OnStationAdded;
client.StationRemoved += OnStationRemoved;
// Livestream events
client.LivestreamStarted += OnLivestreamStarted;
client.LivestreamStopped += OnLivestreamStopped;
client.LivestreamDataReceived += OnLivestreamData;
// Push notifications
client.PushNotificationReceived += OnPushNotification;
// Guard mode changes
client.GuardModeChanged += OnGuardModeChanged;var config = new EufySecurityConfig
{
Username = "email",
Password = "password",
Devices = new Dictionary<string, DeviceConfig>
{
["DEVICE_SERIAL"] = new DeviceConfig
{
SimultaneousDetections = true
}
},
Stations = new Dictionary<string, StationConfig>
{
["STATION_SERIAL"] = new StationConfig
{
IpAddress = "192.168.1.100",
P2PPort = 32108
}
}
};// Disable automatic polling
var config = new EufySecurityConfig
{
Username = "email",
Password = "password",
DisableAutomaticCloudPolling = true
};
// Manually refresh when needed
await client.RefreshDevicesAsync();// Connect to a specific station
await client.ConnectToStationAsync(stationSerial);
// Check connection status
var station = client.GetStation(stationSerial);
if (station?.IsConnected == true)
{
// Station is connected via P2P
}The library is organized into four main subsystems:
- HTTP Layer - Eufy Cloud API communication
- P2P Layer - Direct peer-to-peer device communication
- Push Service - Firebase Cloud Messaging for notifications
- MQTT - Protocol support for specific devices
All subsystems are coordinated by the main EufySecurityClient class.
- .NET 8.0 or higher
- Active Eufy Security account
- Network access to Eufy cloud servers
- Country Setting: Must match the country set in your Eufy Security mobile app
- 2FA: Full two-factor authentication support with email verification codes - see 2FA Documentation
- P2P: Local P2P connections work only when on the same network as your devices
- Rate Limiting: The library implements automatic request throttling to avoid API limits
git clone https://github.com/eufy-security/MostlyLucid.EufySecurity.git
cd MostlyLucid.EufySecurity
dotnet build
dotnet testThis project is a C# port of the excellent eufy-security-client TypeScript library created and maintained by bropat.
All credit for the original protocol reverse-engineering, design, and implementation belongs to bropat and the contributors of the original TypeScript project. Without their incredible work, this .NET port would not exist.
Special thanks to:
- bropat - Original author and maintainer of eufy-security-client
- The eufy-security-client contributors - For continuous improvements
- Claude (Anthropic AI) - For assistance in creating this C# port
This project is not affiliated with, endorsed by, or connected to Anker Innovations or Eufy Security in any way. This is an independent, community-driven project maintained in spare time.
This is free and unencumbered software released into the public domain. See UNLICENSE file for details.
This project is a port of the eufy-security-client TypeScript library by bropat, which is licensed under the MIT License. See the original license and THIRD-PARTY-NOTICES for attribution details.
Contributions are welcome! Please feel free to submit a Pull Request.
- π Documentation
- π Issue Tracker
- π¬ Discussions
- Initial port from TypeScript library
- Core HTTP API implementation
- P2P protocol support
- Push notification service
- Support for major device types
- Event-driven architecture
- Comprehensive configuration options