Skip to content

Battery System Setup

bolagnaise edited this page Apr 15, 2026 · 44 revisions

Battery System Setup

Tesla Powerwall

PowerSync supports three methods for accessing your Tesla Powerwall. Choose one — you don't need all three.

Option 1: PowerSync (Recommended — Free) ⭐

The easiest and cheapest option. PowerSync is a registered Tesla Fleet API partner — when you sign in, Tesla authorizes PowerSync.cc to read your Powerwall data and send tariff/charge commands on your behalf. We never see your Tesla password.

Pros
Free Tesla doesn't charge for energy product reads or commands
30-second setup Click a link, sign in with Tesla, paste a token
No Tesla developer account We're already a registered Fleet API partner
No HA integration prerequisite Works without tesla_fleet installed
Works in any region NA, EU, APAC, MEA — region detected automatically

Setup:

  1. In Home Assistant, add the PowerSync integration. When asked which Tesla provider to use, choose PowerSync (recommended).
  2. Open this URL in any browser: https://api.powersync.cc/auth/start
  3. Sign in with your Tesla account (Tesla shows a consent screen — approve the energy product scopes)
  4. You'll get a token starting with psync_ — copy it
  5. Paste it back into the PowerSync setup form

That's it. Tesla never sees Home Assistant; PowerSync.cc never sees your Tesla password. The token is the only thing that links your HA install to your Powerwall, and you can revoke it any time at https://accounts.tesla.com/account-settings/security or by removing the integration.

If your token gets invalidated for any reason (revoked, expired, etc.), Home Assistant will automatically prompt you to re-authenticate via the same flow.

Option 2: Tesla Fleet API (Free)

Direct OAuth access via your own Tesla developer app. Free but requires you to do the developer registration and OAuth setup yourself.

Setup:

  1. Install the official Tesla Fleet integration in Home Assistant
    • Settings > Devices & Services > Add Integration > "Tesla Fleet"
    • Follow the OAuth login flow (requires your own Tesla developer app)
  2. PowerSync automatically detects your Tesla Fleet credentials
  3. When PowerSync asks which provider to use, select Tesla Fleet API

Option 3: Teslemetry (~$4/month)

Third-party paid proxy. Use this if you prefer to pay for a managed service or already have a Teslemetry subscription.

Setup:

  1. Sign up at https://teslemetry.com
  2. Connect your Tesla account
  3. Copy your API key
  4. Choose Teslemetry in the PowerSync setup and paste your API key

FoxESS

Supports H1, H3, H3-Pro, H3 Smart, and KH model families via Modbus TCP or RS485 serial. No cloud API required for battery control — all control is done locally via Modbus.

OEM rebrands using identical hardware are also supported — the model family is auto-detected via register probing during setup.

Supported Models

Model Family Type Register Space OEM Rebrands
H1 Single Phase 31xxx/41xxx AIO-H1, a-TroniX AX
H3 Three Phase 31xxx/41xxx AIO-H3, Kuara H3, Sonnenkraft SK-HWR, 1KOMMA5
H3-Pro Three Phase (Higher Power) 37xxx/46xxx/49xxx
H3 Smart Three Phase (Native WiFi) 37xxx/46xxx/49xxx
KH Single Phase Hybrid 31xxx/41xxx

Rebrands: If your inverter is an OEM rebrand (e.g., Kuara, Sonnenkraft, 1KOMMA5), just connect it like any other FoxESS unit. PowerSync identifies the model family automatically from Modbus registers — no special configuration needed.

Connection Options

Modbus TCP (Recommended for H3 Smart)

  • Port: 502 (default)
  • Slave ID: 247 (default)
  • For H3 Smart: Connect directly to the inverter's IP address — no external adapter needed

RS485 Serial

  • Baud rate: 9600 (default)
  • Slave ID: 247 (default)
  • Requires an RS485 adapter (USB or network gateway like Elfin EW11)

H3 Smart Setup

The H3 Smart has a built-in WiFi Modbus TCP server. No external RS485 adapter is needed.

  1. Find the inverter's IP address — it appears as "espressif" on your network (it uses an ESP WiFi module)
  2. Ensure firmware is up to date — the Modbus TCP server requires current firmware
  3. Use default settings — Port 502, Slave ID 247
  4. PowerSync will auto-detect the model as H3 Smart during setup

Troubleshooting: If the connection test fails:

  • Check your router for a device named "espressif" to find the correct IP
  • Update inverter firmware to the latest version
  • Verify port 502 is not blocked by your network

FoxESS Cloud (Optional)

A FoxESS Cloud API key allows PowerSync to sync Amber/Octopus prices as time-based schedules on your inverter (up to 8 periods per day). This is not required for battery control — all control is done locally via Modbus.

Getting your API key:

  1. Log in to foxesscloud.com
  2. Go to User Profile > API Management
  3. Generate a new API key
  4. Enter the API key and your device serial number during PowerSync setup

Note: When Smart Optimization (LP) is enabled, cloud schedule sync is automatically skipped — the LP optimizer controls the inverter directly via Modbus, and uploading schedules to the cloud would conflict.

Work Modes

Mode H1/H3/KH (Reg 41000) H3-Pro/Smart (Reg 49203)
Self Use 0 1
Feed-in First 1 2
Backup 2 3
Peak Shaving 4

Note: H1/H3/KH use 0-based values at register 41000. H3-Pro/Smart use 1-based values at register 49203.

Force Charge/Discharge (v2.5.0+)

Force modes use Modbus remote control registers (46001-46004) rather than the work mode register. This enables precise power targeting.

Feature H1/H3/KH H3-Pro/Smart
Target AC (0x0001) Grid (0x0009)
Power setpoint Configurable kW Configurable kW
Max power Read from inverter max charge current Read from inverter max charge current

H3-Pro/Smart use Grid targeting (0x0009) for force discharge instead of AC targeting. This routes discharge power to the grid rather than just to AC loads, enabling proper VPP-style export.

The power setpoint is read from the inverter's configured maximum charge current and converted to watts using a 300V voltage estimate. This replaces the previous hardcoded 5kW cap.


Sigenergy

Full support for Sigenergy hybrid inverters with integrated battery storage.

Features

  • Tariff Sync via Cloud API — Uploads pricing to Sigenergy Cloud using 30-minute TOU format
  • Real-Time Energy Data via Modbus — Reads solar, battery, grid power and SOC from your inverter
  • DC Solar Curtailment — Controls DC solar via Modbus TCP during negative prices (load-following mode)

Connection Requirements

Connection Purpose Required
Cloud API Tariff sync to Sigenergy Yes
Modbus TCP Real-time energy data + DC curtailment Yes

Important: Modbus TCP Server must be enabled on your Sigenergy inverter before PowerSync can connect. This setting is typically configured by your installer via the SigenStor app or installer portal.

Device ID Note: If you have an AC Charger installed, it uses Device ID 1 by default. The inverter must be set to a higher ID (e.g., 2).

Getting Cloud API Credentials

What You Need:

Credential Description Where to Find
Email Your Sigenergy account email Your login email
Password Your Sigenergy account password Your normal password
Device ID Optional — usually not needed Leave blank (see note below)
Station ID Your Sigenergy station identifier SigenAI or browser dev tools

Device ID (optional):

Sigenergy no longer requires a Device ID for authentication. Leave this field blank. If authentication fails without it, you can find it by:

  1. Go to https://web-aus.sigencloud.com/ in your browser (don't log in yet)
  2. Open Developer Tools (F12) > Network tab > filter by Fetch/XHR > check "Preserve log"
  3. Log in normally
  4. Find the token POST request > Payload tab > look for userDeviceId (13 digits)

Getting Station ID:

  • Ask SigenAI in the app: "Tell me my StationID"
  • Or find it in dev tools network requests

Remote EMS Control (v2.5.0+)

PowerSync uses Sigenergy's Remote EMS mode for direct battery control. Remote EMS stays permanently enabled — mode 2 (Maximum Self Consumption) is equivalent to the inverter's native EMS, so there is no downside.

Feature Description
Force Charge Charges battery from grid at configurable power
Force Discharge Discharges battery to grid using ESS mode (mode 6) with active power targeting
Restore Normal Returns to Maximum Self Consumption mode and restores backup reserve
Backup Reserve Saved before force modes and restored automatically

Note: Force discharge uses DISCHARGE_ESS (mode 6) rather than DISCHARGE_PV (mode 5) to ensure actual battery discharge rather than just solar passthrough. The export safety cap is bypassed during force discharge so full power is available.

Sigenergy Configuration

  1. Select Sigenergy as your battery system
  2. Enter Cloud credentials (email, password)
  3. Select your station from the list
  4. Enter your inverter's Modbus IP address
  5. Optionally enable DC solar curtailment

GoodWe

Full support for GoodWe hybrid inverters via the goodwe Python library. Local connection only — no cloud API required.

Features

  • Auto-Detection — Model family is automatically identified during setup
  • Force Charge/Discharge — Via ECO_CHARGE and ECO_DISCHARGE operation modes
  • Backup Reserve — Set minimum SOC via depth-of-discharge control
  • Grid Export Limit — Configurable export power limit
  • Battery Health — SOH read from inverter

Supported Models

Series Type Battery Control
ET Three Phase Hybrid Full support
EH Three Phase Hybrid Full support
BT Three Phase Hybrid Full support
BH Three Phase Hybrid Full support
ES Single Phase Hybrid Full support
EM Single Phase Hybrid Full support
BP Single Phase Hybrid Full support
DT/MS/XS Grid-only (no battery) Not supported

Connection Options

UDP via WiFi Dongle (Default)

  • Port: 8899
  • Works with most GoodWe inverters out of the box
  • Uses the inverter's WiFi dongle for communication

TCP via LAN Dongle

  • Port: 502
  • Requires a GoodWe LAN dongle (WLA0000-01-00P V2.0)
  • More reliable for installations with poor WiFi

GoodWe Setup

  1. Find the inverter's IP address — check your router's device list for the WiFi or LAN dongle
  2. Select GoodWe as your battery system during PowerSync setup
  3. Enter the inverter's IP address
  4. Select the protocol (UDP or TCP) matching your dongle type
  5. The port defaults automatically (8899 for UDP, 502 for TCP)
  6. PowerSync tests the connection and auto-detects your inverter model

Note: If setup reports "no battery support", your inverter is a grid-only model (DT/MS/XS series) which does not have battery control capabilities.

Operation Modes

Mode Description
General Normal self-consumption operation
ECO Charge Force charge from grid (used by force_charge)
ECO Discharge Force discharge to grid (used by force_discharge)

Backup Reserve

GoodWe uses Depth of Discharge (DOD) internally. PowerSync converts automatically:

  • Setting backup reserve to 20% → DOD = 80%
  • Setting backup reserve to 100% → DOD = 0% (full backup)
  • Maximum DOD is capped at 89% (minimum 11% reserve)

Sungrow SH-series

Full support for Sungrow SH-series hybrid inverters via direct Modbus TCP. No cloud API required.

Features

  • Direct Modbus Control — All control via local Modbus TCP
  • Force Charge/Discharge — Manual or automatic battery control
  • Rate Limiting — Set maximum charge and discharge rates (kW)
  • Export Limit Control — Limit grid export power
  • Backup Reserve — Configure minimum SOC for backup power
  • Battery Health Monitoring — Read SOH directly from BMS
  • AEMO Spike Auto-Discharge — Automatic VPP participation for Globird users

Supported Models

Series Type Battery Control
SH-series Hybrid Inverter Full support
SG-series String Inverter AC curtailment only (no battery)

Connection Settings

Setting Default
Port 502
Slave ID 1

Modbus Registers

Register Function
13021 Battery SOC (0.1%)
13022 Battery SOH (0.1%)
13050 EMS Mode (0=Self-consumption, 2=Forced)
13051 Charge Command (0xAA=Charge, 0xBB=Discharge, 0xCC=Stop)
13059 Minimum SOC / Backup Reserve (0.1%)
13066 Max Discharge Current (0.001A)
13067 Max Charge Current (0.001A)
13074 Export Power Limit (W)

Dual Inverter Setup (Optional)

If you have two Sungrow SH inverters — for example, a grid-facing primary and a secondary on the primary's backup port — PowerSync can manage both as a single combined system.

How it works:

  • During initial setup, after configuring the primary inverter you'll be prompted to optionally add a second inverter's IP address
  • Both inverters are polled independently and their data is aggregated into a single view
  • Solar, battery power, and load are summed across both inverters
  • Grid power uses the primary inverter only (it's the grid-facing unit)
  • Battery SOC is capacity-weighted across both inverters (configurable per-inverter capacity)
  • Commands (force charge, force discharge, restore) are sent to both inverters simultaneously
  • Charge/discharge power is split proportionally based on SOC and battery capacity — the emptier battery gets more charging power, the fuller battery gets more discharging power, and larger batteries get a proportionally larger share
  • Export limits are set on the primary only (the grid-facing inverter)

Battery capacity weights:

If your two inverters have different-sized battery stacks, configure the capacity of each so that SOC averaging and power splitting are accurate. For example, if your primary has 2× SBR256 (51.2 kWh) and your secondary has 4× SBR256 (102.4 kWh):

Setting Value
Primary Battery Capacity 51.2
Secondary Battery Capacity 102.4

With these settings:

  • SOC averaging is capacity-weighted. If the 51.2 kWh stack is at 80% and the 102.4 kWh stack is at 40%, the combined SOC is 53.3% — not the naive 60% average
  • Power splitting accounts for both SOC and capacity. The larger stack receives a proportionally larger share of charge/discharge commands

The default capacity is 25.6 kWh (one SBR256 unit) for both inverters. If your battery stacks are identical, you can leave the defaults — the ratio is what matters, not the absolute values.

Setup:

  1. Configure your primary (grid-facing) Sungrow inverter as normal
  2. On the "Secondary Sungrow Inverter" step, enter the IP of your second inverter
  3. PowerSync tests the connection and stores both configurations
  4. To add/remove a secondary later, go to Settings > Devices & Services > PowerSync > Configure

Grid-forming inverter SOC cap:

In an off-grid scenario the grid-forming (primary) inverter needs headroom in its battery to absorb any excess output from the secondary inverter. The Primary Inverter Max SOC (%) setting caps the primary inverter's maximum charge level — for example, setting it to 90% reserves 10% buffer capacity. This is enforced automatically every poll cycle via Modbus. Set to 100% (default) to disable.

Safety features:

  • If the secondary inverter fails to connect on startup, PowerSync falls back to single-inverter mode automatically
  • Per-inverter SOC is logged when SOC divergence exceeds 5%
  • Each sub-coordinator polls independently — a temporary Modbus failure on one inverter doesn't block the other
  • Removing the secondary IP in the options flow cleanly removes all secondary config

Solax

Support for Solax hybrid inverters via Modbus TCP or HA entity fallback. Covers all generations (GEN2 through GEN6).

Connection Options

Method Description
Modbus TCP (Standalone) Direct connection to the inverter. No additional HA integration required.
HA Entity Fallback Uses entities from the homeassistant-solax-modbus integration

Modbus Registers

Register Function
0x42 Export control user limit (used for curtailment)
0xB5 Factory export limit (read for restore value)

Features

  • AC-Coupled Inverter Curtailment — During negative prices, export is limited via register 0x42. When prices recover, the factory limit from register 0xB5 is restored.
  • Load-Following Curtailment — When home load data is available, curtailment tracks actual consumption to allow solar self-use while blocking grid export.

Solax Configuration

  1. Select Solax as your battery system or AC inverter
  2. Enter the inverter's Modbus IP address and port (default: 502)
  3. If using HA entity fallback, select the appropriate entities from the Solax Modbus integration

AlphaESS

Support for AlphaESS SMILE and Storion hybrid inverter-battery systems via Modbus TCP, with optional Cloud API fallback when Modbus is unreachable. Implemented against the official AlphaESS Modbus parameter address table.

Supported Models

  • SMILE5, SMILE-Hi5, SMILE-Hi10 (residential)
  • SMILE-B3, SMILE-T10, SMILE-G3
  • Storion-T30

Single-phase and three-phase variants share the same register map.

Prerequisites

  • Ethernet cable between your AlphaESS inverter and your LAN. Wi-Fi-only setups work via Ethernet-port repeaters but the inverter accepts only one active Modbus TCP session.
  • Modbus TCP enabled on the inverter (usually default; check with your installer if unsure).
  • Optional: an AlphaESS Open API App ID + App Secret from open.alphaess.com for cloud fallback.

Connection

Parameter Value
Protocol Modbus TCP
Port 502
Slave ID 85 (0x55) — AlphaESS factory default. Not 1 or 247 like other brands.
Timeout 10 s

Features

  • LP-driven dispatch — PowerSync's built-in optimizer writes the dispatch block (registers 0x07220x0728) every 5 minutes to schedule charge / discharge against price forecasts.
  • Force charge / discharge / release — Standard power_sync.force_charge / force_discharge / restore_normal HA services work for AlphaESS. Force-mode auto-restore timers apply as with every other brand.
  • DC Solar Curtailment — When feed-in price drops below 1 c/kWh, PowerSync writes 0x0800 = 0 (0 % MAX feed-into-grid) to block grid export. Solar keeps powering the house and charging the battery.
  • Battery Health — SOC (0x0102), SOH (0x011B), rated capacity (0x0119), and BMS charge/discharge current limits are exposed as sensors.
  • Cloud Fallback — If Modbus goes unreachable, the coordinator polls openapi.alphaess.com (SHA-512 signature auth) for telemetry. Control via cloud is schedule-based and coarser than Modbus.

AlphaESS Configuration

  1. Select AlphaESS as your battery system during PowerSync setup.
  2. Enter the inverter's host / IP, port (default 502), and slave ID (default 85). The setup flow reads the battery SOC register as a connection probe before accepting the entry.
  3. Optionally configure export safety cap (kW) to limit grid export during force-discharge operations.
  4. On the next step, optionally enter Open API App ID + App Secret + serial number for cloud fallback. Leave blank to use Modbus only — cloud is not required.

Quirks to be aware of

  • Battery power sign — AlphaESS reports − = charge, + = discharge in register 0x0126, which already matches the PowerSync convention. No sign flip applied.
  • SOC scale differs between read and write0x0102 is 0.1 %/bit (so raw 955 = 95.5 %) but the dispatch target 0x0728 is 0.4 %/bit (so 100 % = raw 250). PowerSync handles this for you.
  • Dispatch active power offset — Register 0x0723 uses an offset of +32000. Charge values are < 32000, discharge values are > 32000, idle is exactly 32000. Logged in debug mode for visibility.
  • No auto-revert — Once 0x0722 = 1 is written, the inverter stays in forced dispatch until explicitly released. PowerSync releases dispatch (0x0722 = 0) on integration unload and on every restore_normal call, so the battery never stays locked after an HA restart.
  • Single connection limit — AlphaESS firmware allows only one active Modbus TCP session. Don't run alphaess_modbus or Alpha2MQTT in parallel on the same inverter.
  • Flash wear — System-config registers (0x0800+) live in flash; PowerSync reads them once at startup and only writes 0x0800 (export limit) when curtailment state actually changes, to protect flash lifetime.

Status

AlphaESS support was introduced in PowerSync 2.12.47 and is currently experimental — the integration is validated against the official AlphaESS register map but two Modbus enum fields (Note5 inverter work mode, Note7 dispatch mode) are still being mapped against live hardware. Please report deltas in Discord or GitHub issue #39.


Sungrow with Globird VPP

Globird's VPP program pays premium rates during AEMO price spikes ($3000/MWh or above). PowerSync can automatically participate:

  1. Enable AEMO Spike Auto-Discharge in the mobile app Controls screen
  2. Select your NEM region (NSW1, VIC1, QLD1, SA1, TAS1)
  3. When AEMO prices hit $3000/MWh, PowerSync automatically forces battery discharge
  4. When the spike ends, battery returns to normal operation
  5. Push notifications are sent for both spike start and end

Tip: If you also have a separate AC-coupled solar inverter, configure it in the AC Inverter Curtailment section. PowerSync will validate that your Sungrow battery and AC inverter don't use the same Modbus slave ID.

Clone this wiki locally