Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pylxpweb

A Python client library for Luxpower/EG4 solar inverters and energy storage systems.

PyPI Version Python Versions License CI GitHub Sponsors Ko-fi

What It Does

pylxpweb provides programmatic access to Luxpower/EG4 inverters — via the cloud web monitoring API or a direct local connection — enabling Python applications and Home Assistant integrations to read real-time inverter data, energy statistics, battery information, and GridBOSS metrics. It is the library backing the EG4 Web Monitor Home Assistant integration.

Features

  • Complete API Coverage: Inverter runtime, energy statistics, battery BMS, and GridBOSS data
  • Device Object Hierarchy: High-level StationParallelGroupBaseInverter / MIDDevice / BatteryBankBattery objects with auto-scaled properties
  • Async/Await: Built on aiohttp for efficient async I/O
  • Session Management: Automatic authentication and session renewal
  • Smart Caching: Configurable TTL caching to minimise API calls
  • Type Safe: Comprehensive type hints and Pydantic models throughout
  • Error Handling: Robust error handling with automatic retry and backoff
  • Regional Endpoints: Supports all global Luxpower and EG4 endpoints
  • Control Operations: Read and write inverter parameters, enable quick charge, set SOC limits
  • Multiple Transports: cloud API, local WiFi dongle, direct Modbus (RS-485), or hybrid local+cloud

Supported Devices

  • Inverters: FlexBOSS21, FlexBOSS18, 18KPV, 12KPV, XP series, and LXP variants
  • GridBOSS: Microgrid interconnection devices (MID)
  • Batteries: All EG4-compatible battery modules with BMS integration

Supported Regional Endpoints

Region Endpoint
US (EG4 Electronics) https://monitor.eg4electronics.com (default)
US (Luxpower) https://us.luxpowertek.com
Americas (Luxpower) https://na.luxpowertek.com
Europe (Luxpower) https://eu.luxpowertek.com
Asia Pacific (Luxpower) https://sea.luxpowertek.com
Middle East & Africa (Luxpower) https://af.luxpowertek.com
China (Luxpower) https://server.luxpowertek.com

The base URL is fully configurable to support regional variations and future endpoints.

Supported Transports

  • Cloud (web API) — the original access method, via the regional endpoints above.
  • WiFi dongle — connects locally to the inverter's WiFi dongle (the same device that uploads data to the cloud), using Modbus encapsulated in a proprietary frame format.
    • The dongle serves the cloud and local clients at the same time but does not clearly separate which side requested what, so occasional "Response mismatch" debug messages are expected — the library detects a response meant for the cloud and retries.
    • Dongles with encryption enabled (label E-WIFI ENC) do not work locally; if you have one, ask Luxpower support to downgrade its firmware.
  • Modbus — a direct Modbus connection to the inverter's RS-485 port.
  • Hybrid — combines one local connection with the cloud API (local polling with cloud fallback and cloud-only supplemental data).

A local connection must have a single client: sharing the same dongle or RS-485 line between multiple applications (e.g. Home Assistant plus a script, or two Home Assistant instances) causes interleaved responses, data corruption, and intermittent errors.

Installation

See INSTALL.md for the complete guide.

pip install pylxpweb
# or
uv add pylxpweb

Requires Python 3.13+.

Quick Start

Using Device Objects (Recommended)

import asyncio
from pylxpweb import LuxpowerClient
from pylxpweb.devices.station import Station

async def main():
    async with LuxpowerClient(
        username="your_username",
        password="your_password",
        base_url="https://monitor.eg4electronics.com"
    ) as client:
        stations = await Station.load_all(client)
        station = stations[0]

        for inverter in station.all_inverters:
            await inverter.refresh()
            print(f"{inverter.model} {inverter.serial_number}:")
            print(f"  PV Power: {inverter.pv_total_power}W")
            print(f"  Battery: {inverter.battery_soc}% @ {inverter.battery_voltage}V")
            print(f"  Grid: {inverter.grid_voltage_r}V @ {inverter.grid_frequency}Hz")
            print(f"  Today: {inverter.total_energy_today}kWh")

asyncio.run(main())

Device objects handle all value scaling automatically — no manual division required.

Usage

Low-Level API Access

For direct endpoint calls without the device-object layer:

async with LuxpowerClient(username, password) as client:
    plants = await client.api.plants.get_plants()
    plant_id = plants.rows[0].plantId
    devices = await client.api.devices.get_devices(str(plant_id))
    serial = devices.rows[0].serialNum

    runtime = await client.api.devices.get_inverter_runtime(serial)
    # Raw API returns scaled integers — divide as needed:
    print(f"Grid Voltage: {runtime.vacr / 10}V")
    print(f"Grid Frequency: {runtime.fac / 100}Hz")
    print(f"Battery Voltage: {runtime.vBat / 10}V")

Control Operations

async with LuxpowerClient(username, password) as client:
    serial = "1234567890"
    await client.set_quick_charge(serial, enabled=True)
    await client.set_charge_soc_limit(serial, limit=90)
    await client.set_operating_mode(serial, mode="standby")
    params = await client.read_parameters(serial, [21, 22, 23])

Error Handling

from pylxpweb import LuxpowerClient, AuthenticationError, ConnectionError, APIError

try:
    async with LuxpowerClient(username, password) as client:
        runtime = await client.get_inverter_runtime(serial)
except AuthenticationError as e:
    print(f"Login failed: {e}")
except ConnectionError as e:
    print(f"Network error: {e}")
except APIError as e:
    print(f"API error: {e}")

Data Scaling

Device objects auto-scale all values. For raw API use, apply these factors manually:

Data Type Factor Example raw Scaled
Inverter Voltage ÷10 2410 241.0 V
Battery Voltage (Bank) ÷10 539 53.9 V
Battery Voltage (Module) ÷100 5394 53.94 V
Cell Voltage ÷1000 3364 3.364 V
Current ÷100 1500 15.00 A
Frequency ÷100 5998 59.98 Hz
Power Direct 1030 1030 W
Temperature Direct 39 39 °C
Energy ÷10 184 18.4 kWh

See docs/SCALING_GUIDE.md for the full reference.

API Reference

Full reference documentation lives in docs/. Key entry points:

Document Contents
docs/api/LUXPOWER_API.md Complete endpoint catalog, authentication, error codes
docs/PROPERTY_REFERENCE.md All device properties with types and scaling
docs/PARAMETER_REFERENCE.md Hold/input register definitions and control parameters
docs/SCALING_GUIDE.md Scaling factors for raw API data
docs/USAGE_GUIDE.md Comprehensive usage examples
docs/DEVICE_TYPES.md Supported device types and capabilities

The docs/ index is at docs/README.md.

Development

See docs/DEVELOPMENT.md. In short:

git clone https://github.com/joyfulhouse/pylxpweb.git
cd pylxpweb
uv sync
uv run pytest
uv run ruff check
uv run mypy

Support

Support Development

If this library is useful to you, please consider supporting its development:

License

This project is licensed under the MIT License — see LICENSE for details.

Related Projects

  • EG4 Web Monitor — the Home Assistant integration built on this library.

Credits

This project builds upon research and knowledge from the Home Assistant community. Special thanks to the Home Assistant community for their pioneering work with EG4 and Luxpower devices — API endpoint research, documentation, and best practices shaped this library from the start.

Disclaimer: Unofficial library, not affiliated with Luxpower or EG4 Electronics. Communicates with the official API using the same endpoints as the official web interface.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylxpweb-0.9.39b2.tar.gz (412.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylxpweb-0.9.39b2-py3-none-any.whl (466.5 kB view details)

Uploaded Python 3

File details

Details for the file pylxpweb-0.9.39b2.tar.gz.

File metadata

  • Download URL: pylxpweb-0.9.39b2.tar.gz
  • Upload date:
  • Size: 412.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pylxpweb-0.9.39b2.tar.gz
Algorithm Hash digest
SHA256 692982d5da3735bd3a292595ab708ecf7a32b7aa1e02513f9a24d4a66412b615
MD5 ecd94a92e83931091bbb71d2738a9fab
BLAKE2b-256 53a295883d55a3952f92c2164204d6397e12c93b61c837cbbcd28fe4019e1dca

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylxpweb-0.9.39b2.tar.gz:

Publisher: release.yml on joyfulhouse/pylxpweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylxpweb-0.9.39b2-py3-none-any.whl.

File metadata

  • Download URL: pylxpweb-0.9.39b2-py3-none-any.whl
  • Upload date:
  • Size: 466.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pylxpweb-0.9.39b2-py3-none-any.whl
Algorithm Hash digest
SHA256 35da07b5f0ba26ba9a82d68441e6e7bf9693e04818ab7ee0e1a312b787d4a88e
MD5 2f380f49aaf0c2ae560c597343fdf928
BLAKE2b-256 e6dfd6f9e49737ef93745ed0e12ef2fcfcf5c351c3b063ec82d9045306b43bd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylxpweb-0.9.39b2-py3-none-any.whl:

Publisher: release.yml on joyfulhouse/pylxpweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.10.0a1

2 files

0.9.40

2 files

0.9.39

2 files

This release

0.9.39b2 This release

2 files

0.9.38

2 files

0.9.37

2 files

0.9.36

2 files

0.9.35

2 files

0.9.34

2 files

0.9.33

2 files

0.9.32

2 files

0.9.31

2 files

0.9.30

2 files

0.9.29

2 files

0.9.28

2 files

0.9.27

2 files

0.9.26

2 files

0.9.25

2 files

0.9.24

2 files

0.9.23

2 files

0.9.22

2 files

0.9.21

2 files

0.9.20

2 files

0.9.19

2 files

0.9.18

2 files

0.9.17

2 files

0.9.16

2 files

0.9.15

2 files

0.9.14

2 files

0.9.13

2 files

0.9.12

2 files

0.9.11

2 files

0.9.10

2 files

0.9.9

2 files

0.9.8

2 files

0.9.7

2 files

0.9.6

2 files

0.9.5

2 files

0.9.4

2 files

0.9.3

2 files

0.9.2

2 files

0.9.0

2 files

0.8.7

2 files

0.8.6

2 files

0.8.5

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.10

2 files

0.7.9

2 files

0.7.8

2 files

0.7.7

2 files

0.7.6

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.0

2 files

0.6.9

2 files

0.6.7

2 files

0.6.6

2 files

0.6.5

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.42

2 files

0.5.41

2 files

0.5.40

2 files

0.5.37

2 files

0.5.36

2 files

0.5.35

2 files

0.5.34

2 files

0.5.33

2 files

0.5.32

2 files

0.5.31

2 files

0.5.30

2 files

0.5.29

2 files

0.5.28

2 files

0.5.27

2 files

0.5.26

2 files

0.5.25

2 files

0.5.24

2 files

0.5.23

2 files

0.5.21

2 files

0.5.20

2 files

0.5.19

2 files

0.5.18

2 files

0.5.17

2 files

0.5.16

2 files

0.5.15

2 files

0.5.14

2 files

0.5.13

2 files

0.5.12

2 files

0.5.11

2 files

0.5.10

2 files

0.5.9

2 files

0.5.8

2 files

0.5.7

2 files

0.5.6

2 files

0.5.5

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.0

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.0

2 files

0.3.25

2 files

0.3.24

2 files

0.3.23

2 files

0.3.22

2 files

0.3.21

2 files

0.3.20

2 files

0.3.19

2 files

0.3.18

2 files

0.3.17

2 files

0.3.16

2 files

0.3.15

2 files

0.3.14

2 files

0.3.13

2 files

0.3.11

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.5

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.1.1

2 files

0.1.0

2 files

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