Skip to main content

alphaess

This Python library uses the Alpha ESS Open API to retrieve data on your Alpha ESS inverter, photovoltaic panels, and battery if you have one. This library is principally intended for use by my Home Assistant integration [https://github.com/CharlesGillanders/homeassistant-alphaESS]

How to use

1. Sign up for an open API account

Register at https://open.alphaess.com/ for a (free) account to get your Developer ID (AppID) and Developer Secret (AppSecret).

Once registered, add your battery/inverter to the developer account via the web UI.

Note

To be good internet citizens, it is advised that your polling frequency for any AlphaCloud endpoints are 10 seconds at a minimum.

API documentation

The developer portal requires registration to read, so the documentation is mirrored here — transcribed from the portal and verified endpoint by endpoint against the live API:

  • docs/API.md — all 19 endpoints. For each one: what you send, what comes back (with every field, its type and its unit), a real captured response, and the matching library method.
  • docs/RETURN_CODES.md — the complete return code table (both pages of the portal's paginated list), grouped by cause, plus codes the portal does not publish.

Things the official documentation gets wrong are corrected in docs/API.md.

Error handling

By default, if the API answers with a non-200 code the method logs it and returns None. Transport failures — connection resets, timeouts, non-2xx HTTP — raise instead.

The catch is that this makes a successful write look identical to a rejected one, since the write endpoints answer with data: null either way. If you need to tell them apart, build the client with raise_on_error=True:

from alphaess.alphaess import alphaess, AlphaESSApiError

client = alphaess(appID, appSecret, raise_on_error=True)

try:
    await client.setTimeChargeBySn(sysSn, 0, charge_list, discharge_list)
except AlphaESSApiError as err:
    print(err.code, err.expMsg)   # e.g. 6001 "time list is null"

Success then just means nothing was raised — return values don't change. It's off by default, so upgrading won't alter how your existing code behaves. Full reference in docs/RETURN_CODES.md.

Methods

There are public methods in this module that duplicate the AlphaESS OpenAPI and provide wrappers for all 19 documented endpoints:

Endpoint Method
https://openapi.alphaess.com/api/getEssList getESSList()
https://openapi.alphaess.com/api/getLastPowerData getLastPowerData(sysSn)
https://openapi.alphaess.com/api/getOneDayPowerBySn getOneDayPowerBySn(sysSn, queryDate=None)
https://openapi.alphaess.com/api/getOneDateEnergyBySn getOneDateEnergyBySn(sysSn, queryDate=None)
https://openapi.alphaess.com/api/getSumDataForCustomer getSumDataForCustomer(sysSn)
https://openapi.alphaess.com/api/getChargeConfigInfo getChargeConfigInfo(sysSn)
https://openapi.alphaess.com/api/updateChargeConfigInfo updateChargeConfigInfo(...)
https://openapi.alphaess.com/api/getDisChargeConfigInfo getDisChargeConfigInfo(sysSn)
https://openapi.alphaess.com/api/updateDisChargeConfigInfo updateDisChargeConfigInfo(...)
https://openapi.alphaess.com/api/getTimeChargeBySn getTimeChargeBySn(sysSn)
https://openapi.alphaess.com/api/setTimeChargeBySn setTimeChargeBySn(...)
https://openapi.alphaess.com/api/getVerificationCode getVerificationCode(sysSn, checkCode)
https://openapi.alphaess.com/api/bindSn bindSn(sysSn, code)
https://openapi.alphaess.com/api/unBindSn unBindSn(sysSn)
https://openapi.alphaess.com/api/getEvChargerConfigList getEvChargerConfigList(sysSn)
https://openapi.alphaess.com/api/getEvChargerCurrentsBySn getEvChargerCurrentsBySn(sysSn)
https://openapi.alphaess.com/api/setEvChargerCurrentsBySn setEvChargerCurrentsBySn(sysSn, currentsetting)
https://openapi.alphaess.com/api/getEvChargerStatusBySn getEvChargerStatusBySn(sysSn, evchargerSn)
https://openapi.alphaess.com/api/remoteControlEvCharger remoteControlEvCharger(sysSn, evchargerSn, controlMode)

All of the above are documented at https://open.alphaess.com/developmentManagement/apiList (Registration required)

Convenience methods

  • getdata(get_power=False, get_ev=False, self_delay=0, get_timecharge=False) - Attempts to get statistical energy data for use in Home Assistant for all registered Alpha ESS systems - will return None if there are issues retrieving data from the Alpha ESS API.
  • authenticate - Attempts to use https://openapi.alphaess.com/api/getEssList to validate authentication to the ALpha ESS API - will return True or False.
  • setbatterycharge (serial, enabled, dp1start, dp1end, dp2start, dp2end, chargecutoffsoc) Parameters:
  • chargecutoffsoc (float) % to stop charging from the grid at
  • enabled (bool) True to charge from the grid, False do not
  • dp1start (datetime.time) The start time of charging period 1 (the minutes must be one of :00, :15, :30, :45)
  • dp1end (datetime.time) The end time of charging period 1 (the minutes must be one of :00, :15, :30, :45)
  • dp2start (datetime.time) The start time of charging period 2 (the minutes must be one of :00, :15, :30, :45)
  • dp2end (datetime.time) The end time of charging period 2 (the minutes must be one of :00, :15, :30, :45)
  • serial (str) The serial number of the battery/inverter.
  • setTimeChargeBySn (sysSn, executeCycleType, chargeTimeList, dischargeTimeList, gridChargeCycle=None, ctrDisCycle=None)

The periodic (weekly) scheduling API. Unlike setbatterycharge/setbatterydischarge it supports up to six periods per day, per-weekday selection, and a power setpoint per period. Not every system is entitled to it — systems without the feature return code 6017 (No operation permissions).

Parameters:

  • sysSn (str) The serial number of the battery/inverter.
  • executeCycleType (int) 0 - daily, 1 - weekly
  • chargeTimeList / dischargeTimeList (list of dict) Each period is {"beginTime": "HH:mm", "endTime": "HH:mm", "chargeLimit": 10-100}, plus optional weeks (a list of 1-7 for Monday-Sunday, required when weekly) and chargePower. Maximum 6 periods per day / 28 per week; charge and discharge periods must not overlap.
  • gridChargeCycle (int) 0 - periodic charging disabled, 1 - enabled
  • ctrDisCycle (int) 0 - periodic discharging disabled, 1 - enabled
await client.setTimeChargeBySn(
    serial, 1,
    chargeTimeList=[{"beginTime": "01:00", "endTime": "05:00", "weeks": [1, 2, 3, 4, 5], "chargeLimit": 90}],
    dischargeTimeList=[{"beginTime": "17:00", "endTime": "21:00", "weeks": [1, 2, 3, 4, 5], "chargeLimit": 20}],
    gridChargeCycle=1, ctrDisCycle=1,
)
  • setbatterydischarge (serial, enabled, dp1start, dp1end, dp2start, dp2end, dischargecutoffsoc) Parameters:
  • dischargecutoffsoc (float) % to stop discharging from the battery at
  • enabled (bool) True to discharge from the battery, False do not
  • dp1start (datetime.time) The start time of charging period 1 (the minutes must be one of :00, :15, :30, :45)
  • dp1end (datetime.time) The end time of charging period 1 (the minutes must be one of :00, :15, :30, :45)
  • dp2start (datetime.time) The start time of charging period 2 (the minutes must be one of :00, :15, :30, :45)
  • dp2end (datetime.time) The end time of charging period 2 (the minutes must be one of :00, :15, :30, :45)
  • serial (str) The serial number of the battery/inverter.

Metadata

Release files for alphaessopenapi 0.0.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alphaessopenapi 0.0.21
File Size Uploaded Provenance Actions
alphaessopenapi-0.0.21.tar.gz 17.1 kB With provenance Details for alphaessopenapi-0.0.21.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for alphaessopenapi 0.0.21
File Interpreter ABI Platform Actions
alphaessopenapi-0.0.21-py3-none-any.whl Python 3 none any Details for alphaessopenapi-0.0.21-py3-none-any.whl

Total release size: 35.2 kB

Release files / alphaessopenapi-0.0.21.tar.gz

Download URL alphaessopenapi-0.0.21.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a46ebe99730632eea9b2907d94bbc828bfcd0e437c9ee8ef60ae1ee7ff81146d
BLAKE2b-256 checksum
How to use checksums
deda4eb78c4bf928ad02afae6f9cebd501362e8866d5fd15b9107c5fea03f0c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.

Transparency log

Release files / alphaessopenapi-0.0.21-py3-none-any.whl

Download URL alphaessopenapi-0.0.21-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6aa12832ee0d53469c434e1c452ff55ff5f9fca185053da280f7d773d3165c7
BLAKE2b-256 checksum
How to use checksums
6123a6318021a829f2adeb7c64cfa6a7adb41c7295b4a414b1a0969c7f88dd41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.

Transparency log

Security for alphaessopenapi 0.0.21

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for alphaessopenapi-0.0.21.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page