BluettiCloud 1.0.1
dotnet add package BluettiCloud --version 1.0.1
NuGet\Install-Package BluettiCloud -Version 1.0.1
<PackageReference Include="BluettiCloud" Version="1.0.1" />
<PackageVersion Include="BluettiCloud" Version="1.0.1" />
<PackageReference Include="BluettiCloud" />
paket add BluettiCloud --version 1.0.1
#r "nuget: BluettiCloud, 1.0.1"
#:package BluettiCloud@1.0.1
#addin nuget:?package=BluettiCloud&version=1.0.1
#tool nuget:?package=BluettiCloud&version=1.0.1
BluettiCloud
A C# library for connecting to Bluetti power stations via their Cloud API, receiving real-time device telemetry over a STOMP/WebSocket connection.
Platform: Windows only (token storage uses Windows Credential Manager)
Runtime: .NET 10
Quick Start
Warning! Telemetry data is pushed by the server only when the device state changes or a heartbeat occurs. The interval between updates is unpredictable: it can be as short as 30 seconds or as long as 5+ minutes.
using BluettiCloud.Services;
using Serilog;
namespace BluettiCloudConsole
{
internal class Program
{
static async Task Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.CreateLogger();
Client client = await ClientFactory.CreateAsync();
client.OnRealtimeStatus += Client_OnRealtimeStatus;
await client.StartAsync();
while (true)
{
await Task.Delay(1000);
}
}
private static void Client_OnRealtimeStatus(object? sender, BluettiCloud.Models.DeviceRealtimeStatus e)
{
if (e.BatterySoc == null)
{
return;
}
Log.Information($"{e.DeviceSn} = {e.BatterySoc}%. Grid In {e.PowerGridIn}W. AC Out {e.PowerAcOut}W. DC Out {e.PowerDcOut}W.");
}
}
}
Device Status Fields
DeviceRealtimeStatus exposes the following fields (all nullable string):
| Property | Description |
|---|---|
BatterySoc |
Battery state of charge (%) |
PowerPvIn |
Solar panel input power (W) |
PowerGridIn |
Grid input power (W) |
PowerAcOut |
AC output power (W) |
PowerDcOut |
DC output power (W) |
BatterySoh |
Battery state of health |
DsgEmptyTime |
Estimated time to discharge |
ChgFullTime |
Estimated time to full charge |
AcSwitch / DcSwitch / PvSwitch |
Switch states |
DeviceActState |
Device activity state |
| (and 40+ more fields) | See Models/DeviceRealtimeStatus.cs |
Known Limitations
- Windows only —
TokenStorageusesWindows.Security.Credentials.PasswordVault. Linux/macOS support would require an alternative storage backend. - Undocumented API — Bluetti does not publish an official API. The endpoints, message format, and authentication flow were reverse-engineered and may change without notice.
Contributing
Issues and pull requests are welcome. If Bluetti changes their API and the library breaks, please open an issue with the raw WebSocket frames if possible.
Credits
This library is a native .NET implementation of the communication protocol used in the Official Bluetti Home Assistant repository (https://github.com/bluetti-official/bluetti-home-assistant). Special thanks to the Bluetti for providing the reference implementation!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows10.0.17763 is compatible. |
-
net10.0-windows10.0.17763
- RestSharp (>= 113.1.0)
- Serilog (>= 4.3.0)
- Serilog.Sinks.Console (>= 6.1.1)
- Serilog.Sinks.File (>= 7.0.0)
- Stomp.Net (>= 2.4.0)
- Websocket.Client (>= 5.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.