# joyfulhouse/pylxpweb architecture

> Architecture diagram of the GitHub repository joyfulhouse/pylxpweb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/joyfulhouse/pylxpweb
- Repository: https://github.com/joyfulhouse/pylxpweb

## Overview

pylxpweb is an async Python client for monitoring and controlling Luxpower/EG4 solar equipment. Its main workflow is to connect through a selected cloud or local transport, load a station and its device hierarchy, refresh device data, and expose scaled runtime and energy properties. A lower-level API also supports endpoint operations and inverter controls. The README documents firmware updates, regional cloud access, and several transport modes; source excerpts and the SOURCE INDEX show only some internal wiring, so unsampled relationships are omitted or marked unverified.

Main entry points: [`src/pylxpweb/transports/factory.py`](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/factory.py) (Transport factory), [`src/pylxpweb/transports/data.py`](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/data.py) (Transport data), [`src/pylxpweb/devices/station.py`](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/station.py) (Station hierarchy), [`src/pylxpweb/devices/inverters/base.py`](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/inverters/base.py) (Inverter devices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client and API"]
  node_client["Async client<br/>[client.py]"]
  node_api["API namespace<br/>[api_namespace.py]"]
  node_endpoints["Cloud endpoints"]
  node_controls["Control operations<br/>[control.py]"]
end

subgraph group_devices["Device model"]
  node_station["Station hierarchy<br/>[station.py]"]
  node_inverter["Inverter devices<br/>[base.py]"]
  node_device_base["Device properties<br/>[base.py]"]
  node_battery["Battery models<br/>[battery.py]"]
  node_firmware["Firmware updates"]
end

subgraph group_connectivity["Transports"]
  node_factory["Transport factory<br/>[factory.py]"]
  node_cloud_transport["Cloud HTTP<br/>[http.py]"]
  node_dongle["WiFi dongle<br/>[dongle.py]"]
  node_modbus["Modbus links<br/>[modbus.py]"]
  node_hybrid["Hybrid fallback<br/>[hybrid.py]"]
end

subgraph group_data["Data and registers"]
  node_runtime_data["Transport data<br/>[data.py]"]
  node_register_map["Canonical registers<br/>[inverter_input.py]"]
  node_register_defs["Register mappings<br/>[registers.py]"]
  node_scaling["Value scaling<br/>[scaling.py]"]
  node_models["Validated models<br/>[models.py]"]
end

node_user(("Python application"))
node_device_service["Inverter or dongle"]
node_cloud_service["Regional cloud API"]

node_user -->|"creates client"| node_client
node_user -->|"loads station"| node_station
node_client -->|"exposes"| node_api
node_api -->|"provides endpoints"| node_endpoints
node_client -->|"calls"| node_endpoints
node_user -->|"sets parameters"| node_controls
node_station -->|"builds hierarchy"| node_inverter
node_station -->|"builds hierarchy"| node_battery
node_inverter -->|"inherits properties"| node_device_base
node_inverter -->|"uses update mixin"| node_firmware
node_station -->|"loads through"| node_client
node_user -->|"selects transport"| node_factory
node_factory -.->|"creates"| node_cloud_transport
node_factory -->|"creates"| node_dongle
node_factory -->|"creates"| node_modbus
node_factory -->|"creates"| node_hybrid
node_cloud_transport -->|"sends requests"| node_cloud_service
node_dongle -->|"reads locally"| node_device_service
node_modbus -->|"reads registers"| node_device_service
node_hybrid -->|"falls back"| node_cloud_service
node_inverter -->|"reads transport data"| node_runtime_data
node_runtime_data -->|"decodes registers"| node_register_map
node_runtime_data -->|"uses mappings"| node_register_defs
node_runtime_data -->|"scales values"| node_scaling
node_runtime_data -->|"builds data models"| node_models

click node_client "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/client.py"
click node_api "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/api_namespace.py"
click node_endpoints "https://github.com/joyfulhouse/pylxpweb/tree/main/src/pylxpweb/endpoints"
click node_controls "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/endpoints/control.py"
click node_station "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/station.py"
click node_inverter "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/inverters/base.py"
click node_device_base "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/base.py"
click node_battery "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/battery.py"
click node_firmware "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/_firmware_update_mixin.py"
click node_factory "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/factory.py"
click node_cloud_transport "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/http.py"
click node_dongle "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/dongle.py"
click node_modbus "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/modbus.py"
click node_hybrid "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/hybrid.py"
click node_runtime_data "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/data.py"
click node_register_map "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/registers/inverter_input.py"
click node_register_defs "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/constants/registers.py"
click node_scaling "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/constants/scaling.py"
click node_models "https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/models.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_api,node_endpoints,node_controls toneBlue
class node_station,node_inverter,node_device_base,node_battery,node_firmware toneAmber
class node_factory,node_cloud_transport,node_dongle,node_modbus,node_hybrid,node_cloud_service toneMint
class node_runtime_data,node_register_map,node_register_defs,node_scaling,node_models toneRose
class node_user,node_device_service toneIndigo
```

## Components

### Client and API

- [Async client](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/client.py): `src/pylxpweb/client.py`
- [API namespace](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/api_namespace.py): `src/pylxpweb/api_namespace.py`
- [Cloud endpoints](https://github.com/joyfulhouse/pylxpweb/tree/main/src/pylxpweb/endpoints): `src/pylxpweb/endpoints`
- [Control operations](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/endpoints/control.py): `src/pylxpweb/endpoints/control.py`

### Device model

- [Station hierarchy](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/station.py): `src/pylxpweb/devices/station.py`
- [Inverter devices](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/inverters/base.py): `src/pylxpweb/devices/inverters/base.py`
- [Device properties](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/base.py): `src/pylxpweb/devices/base.py`
- [Battery models](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/battery.py): `src/pylxpweb/devices/battery.py`
- [Firmware updates](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/devices/_firmware_update_mixin.py): `src/pylxpweb/devices/_firmware_update_mixin.py`

### Transports

- [Transport factory](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/factory.py): `src/pylxpweb/transports/factory.py`
- [Cloud HTTP](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/http.py): `src/pylxpweb/transports/http.py`
- [WiFi dongle](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/dongle.py): `src/pylxpweb/transports/dongle.py`
- [Modbus links](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/modbus.py): `src/pylxpweb/transports/modbus.py`
- [Hybrid fallback](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/hybrid.py): `src/pylxpweb/transports/hybrid.py`

### Data and registers

- [Transport data](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/transports/data.py): `src/pylxpweb/transports/data.py`
- [Canonical registers](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/registers/inverter_input.py): `src/pylxpweb/registers/inverter_input.py`
- [Register mappings](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/constants/registers.py): `src/pylxpweb/constants/registers.py`
- [Value scaling](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/constants/scaling.py): `src/pylxpweb/constants/scaling.py`
- [Validated models](https://github.com/joyfulhouse/pylxpweb/blob/main/src/pylxpweb/models.py): `src/pylxpweb/models.py`

### Other components

- **Python application**
- **Inverter or dongle**
- **Regional cloud API**

## Connections

- Python application → Async client: creates client
- Python application → Station hierarchy: loads station
- Async client → API namespace: exposes (evidence: `src/pylxpweb/client.py`)
- API namespace → Cloud endpoints: provides endpoints (evidence: `src/pylxpweb/api_namespace.py`)
- Async client → Cloud endpoints: calls (evidence: `src/pylxpweb/client.py`)
- Python application → Control operations: sets parameters
- Station hierarchy → Inverter devices: builds hierarchy (evidence: `src/pylxpweb/devices/station.py`)
- Station hierarchy → Battery models: builds hierarchy (evidence: `src/pylxpweb/devices/station.py`)
- Inverter devices → Device properties: inherits properties (evidence: `src/pylxpweb/devices/inverters/base.py`)
- Inverter devices → Firmware updates: uses update mixin (evidence: `src/pylxpweb/devices/inverters/base.py`)
- Station hierarchy → Async client: loads through
- Python application → Transport factory: selects transport
- Transport factory → Cloud HTTP: creates
- Transport factory → WiFi dongle: creates (evidence: `src/pylxpweb/transports/__init__.py`)
- Transport factory → Modbus links: creates (evidence: `src/pylxpweb/transports/__init__.py`)
- Transport factory → Hybrid fallback: creates (evidence: `src/pylxpweb/transports/__init__.py`)
- Cloud HTTP → Regional cloud API: sends requests
- WiFi dongle → Inverter or dongle: reads locally
- Modbus links → Inverter or dongle: reads registers
- Hybrid fallback → Regional cloud API: falls back
- Inverter devices → Transport data: reads transport data (evidence: `src/pylxpweb/devices/inverters/base.py`)
- Transport data → Canonical registers: decodes registers (evidence: `src/pylxpweb/transports/data.py`)
- Transport data → Register mappings: uses mappings (evidence: `src/pylxpweb/transports/data.py`)
- Transport data → Value scaling: scales values (evidence: `src/pylxpweb/transports/data.py`)
- Transport data → Validated models: builds data models (evidence: `src/pylxpweb/transports/data.py`)
