TeslaPowerwallLibrary 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TeslaPowerwallLibrary --version 1.0.0
                    
NuGet\Install-Package TeslaPowerwallLibrary -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TeslaPowerwallLibrary" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TeslaPowerwallLibrary" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="TeslaPowerwallLibrary" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TeslaPowerwallLibrary --version 1.0.0
                    
#r "nuget: TeslaPowerwallLibrary, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TeslaPowerwallLibrary@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TeslaPowerwallLibrary&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=TeslaPowerwallLibrary&version=1.0.0
                    
Install as a Cake Tool

TeslaPowerwallLibrary

A .NET client library for the Tesla™ Powerwall™ Energy Gateway, providing direct local-network access and Tesla Owners (cloud) API access to status, power flow, energy history, and control operations.

Tesla and Powerwall are trademarks of Tesla, Inc. This project is an independent, unofficial .NET library and is not affiliated with or endorsed by Tesla.

License: MIT

Supported Platforms

Target Framework Supported
.NET 10
.NET Framework 4.7.2

Overview

TeslaPowerwallLibrary provides a strongly typed, async-first .NET wrapper around the Tesla Energy Gateway's local API and the Tesla Owners cloud API. It supports:

  • Local network access to the Powerwall gateway (status, power flow, grid status, system status, and energy/calendar history)
  • Tesla Owners (cloud) API access, including interactive OAuth login and automatic token persistence
  • Control operations such as backup reserve level, operating mode, grid charging, and grid export
  • Response caching with configurable expiry to reduce load on the gateway
  • Multi-target support for .NET Framework 4.7.2 and .NET 10

This .NET library is adapted from the Python pypowerwall project by Jason A. Cox. See the license for attribution details.

Connection modes

Mode Status Notes
Local ✅ Implemented Direct HTTPS/JSON access to the gateway using the customer password. Targets the Gateway 2 / Powerwall+ local REST API (see hardware note below).
Cloud ✅ Implemented Tesla Owners API access using interactive OAuth login and cached tokens. Works regardless of gateway generation.
FleetAPI 🚧 Not yet implemented Scaffolded for a future milestone; currently throws a not-implemented exception.
TEDAPI 🚧 Not yet implemented Scaffolded protobuf-based local link-local access for a future milestone; currently throws a not-implemented exception.

Gateway hardware compatibility: Local mode's plain HTTPS/JSON REST API (/api/login/Basic plus endpoints such as /api/system_status/soe and /api/meters/aggregates) is the original Gateway 2 / Powerwall+ local interface and is well established on that hardware. On Powerwall 3, Tesla replaced this local REST API with TEDAPI (protobuf-encoded, RSA-signed); the plain REST endpoints return 403 Unable to GET to resource on a Powerwall 3 gateway. Powerwall 3 owners need TEDAPI support (not yet implemented — see the table above) for local access; Cloud mode works today regardless of gateway generation.

Installation

The library is available as the TeslaPowerwallLibrary NuGet package.

dotnet add package TeslaPowerwallLibrary

Quick Start

Connect to a local gateway

using TeslaPowerwallLibrary;

var options = new PowerwallOptions
{
	 Host = "10.0.1.99",
	 Password = "your-customer-password"
};

using var powerwall = new Powerwall(options);
await powerwall.ConnectAsync();

var status = await powerwall.StatusAsync();

Connect using the Tesla Owners cloud API

using TeslaPowerwallLibrary;

var options = new PowerwallOptions
{
	 Email = "you@example.com",
	 CloudMode = true,
	 AccessToken = "your-access-token",
	 RefreshToken = "your-refresh-token"
};

using var powerwall = new Powerwall(options);
await powerwall.ConnectAsync();

After the first successful cloud connect, the library persists the (possibly rotated) tokens internally, keyed by Email, so later runs can omit AccessToken and RefreshToken entirely. When a non-empty AuthPath is supplied, that location is authoritative — no fallback is attempted, and an inaccessible path throws PowerwallCloudTokenCacheStorageException instead of silently continuing without persistence.

Cloud mode without library-owned token storage

Set NoCloudTokenPersistence when the host has no suitable place for the library to keep a file (for example a Mono-hosted embedded environment). No cache file is ever read or written; AuthPath is ignored, AccessToken/RefreshToken must be supplied on every run, and Email is not validated since it is otherwise used only as the cache key:

using TeslaPowerwallLibrary;

var options = new PowerwallOptions
{
	 CloudMode = true,
	 AccessToken = "your-access-token",
	 RefreshToken = "your-refresh-token",
	 NoCloudTokenPersistence = true
};

using var powerwall = new Powerwall(options);
powerwall.CloudTokensRefreshed += (sender, e) =>
{
	 // Persist e.AccessToken / e.RefreshToken using your own storage.
};

await powerwall.ConnectAsync();

Repository Contents

  • TeslaPowerwallLibrary — the main library project published to NuGet
  • TeslaPowerwallLibrary.Login — shared Tesla cloud OAuth login library (interactive WebView2-based browser login), used by both the app and the test console; not published to NuGet, distributed as a DLL attached to each GitHub release — see the Tesla cloud login guide
  • TeslaPowerwallLibrary.App — a WPF dashboard application with live energy charts, system status, and site/account management
  • TeslaPowerwallLibrary.TestConsole — a command-line and interactive test harness covering the library's read and control operations
  • TeslaPowerwallLibrary.Setup — a small WPF wrapper around TeslaPowerwallLibrary.Login that performs a standalone Tesla cloud login and displays the resulting tokens
  • TeslaPowerwallLibrary.Tests — MSTest-based deterministic unit test coverage

Documentation

Public documentation for this repository is available on GitHub Pages:

Acknowledgements

This library is adapted from the Python pypowerwall project by Jason A. Cox.

License

MIT © 2026 Neil Colvin, © 2022 Jason Cox — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.2 45 7/10/2026
1.2.1 53 7/10/2026
1.2.0 47 7/10/2026
1.1.1 95 7/8/2026
1.1.0 80 7/8/2026
1.0.3 88 7/7/2026
1.0.2 96 7/6/2026
1.0.1 96 7/6/2026
1.0.0 51 7/6/2026
0.2.0-preview 67 7/6/2026
0.1.0-preview1 51 7/5/2026

First stable release. Provides local-network and Tesla Owners cloud API access to status, power flow, energy history, and control operations, with configurable cloud token persistence (library-managed cache, explicit authoritative AuthPath, or fully caller-owned via NoCloudTokenPersistence).