# davidrapan/ha-solarman architecture

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

- Interactive diagram: https://gitdiagram.com/davidrapan/ha-solarman
- Repository: https://github.com/davidrapan/ha-solarman

## Overview

Solarman is a Home Assistant integration that discovers and configures inverter/logger devices, polls their registers, parses model-specific profiles, and exposes the results as entities and register services. The graph follows setup through coordinator-driven device communication and entity updates, while preserving the documented Modbus TCP support and profile-driven breadth. Several platform and parser details are unsampled; their branches are shown where documented, with uncertain wiring omitted.

Main entry points: [`custom_components/solarman/device.py`](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/device.py) (Device interface), [`custom_components/solarman/entity.py`](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/entity.py) (Entity base), [`custom_components/solarman/coordinator.py`](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/coordinator.py) (Update coordinator), [`custom_components/solarman/pysolarman/__init__.py`](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/pysolarman/__init__.py) (Solarman protocol client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup &amp; Discovery"]
  node_config["Config flow<br/>[config_flow.py]"]
  node_discovery["Device discovery<br/>[discovery.py]"]
  node_settings["Shared config<br/>[const.py]"]
end

subgraph group_runtime["Polling &amp; Profiles"]
  node_coordinator["Update coordinator<br/>[coordinator.py]"]
  node_provider["Profile provider<br/>[provider.py]"]
  node_profiles["Inverter definitions"]
  node_device["Device interface<br/>[device.py]"]
  node_parser["Register parser<br/>[parser.py]"]
  node_common["Shared utilities<br/>[common.py]"]
end

subgraph group_entities["Home Assistant Entities"]
  node_entities["Entity base<br/>[entity.py]"]
  node_sensor["Sensor platforms<br/>[sensor.py]"]
  node_controls["Control platforms<br/>[number.py]"]
  node_calendar["Time platforms<br/>[datetime.py]"]
  node_services["Register services<br/>[services.py]"]
  node_diagnostics["Diagnostics<br/>[diagnostics.py]"]
end

subgraph group_protocol["Modbus Transport"]
  node_solarman["Solarman protocol client<br/>[__init__.py]"]
  node_modbus["Modbus PDU<br/>[functions.py]"]
  node_tcp["Modbus TCP<br/>[tcp.py]"]
  node_serial["Modbus RTU<br/>[rtu.py]"]
end

node_user(("Home Assistant user"))
node_ha["Home Assistant"]
node_external(("Inverter / logger"))

node_user -->|"sets up"| node_ha
node_ha -->|"starts config"| node_config
node_config -->|"uses discovery"| node_discovery
node_config -->|"reads defaults"| node_settings
node_coordinator -->|"creates provider"| node_provider
node_provider -.->|"loads definitions"| node_profiles
node_coordinator -->|"sets up and polls"| node_device
node_provider -->|"uses parser"| node_parser
node_device -->|"gets configuration"| node_provider
node_device -->|"communicates through"| node_solarman
node_device -->|"parses readings"| node_parser
node_device -->|"reads registers"| node_external
node_solarman -->|"encodes requests"| node_modbus
node_solarman -->|"uses TCP transport"| node_tcp
node_solarman -->|"uses RTU transport"| node_serial
node_coordinator -->|"provides updates"| node_entities
node_sensor -->|"builds entities"| node_entities
node_controls -->|"builds entities"| node_entities
node_calendar -->|"builds entities"| node_entities
node_entities -->|"gets descriptions"| node_parser
node_entities -->|"uses helpers"| node_common
node_ha -->|"registers services"| node_services
node_services -->|"resolves device"| node_coordinator
node_services -->|"executes register calls"| node_device
node_ha -.->|"requests diagnostics"| node_diagnostics
node_diagnostics -->|"reads coordinator"| node_coordinator

click node_config "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/config_flow.py"
click node_discovery "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/discovery.py"
click node_settings "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/const.py"
click node_coordinator "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/coordinator.py"
click node_provider "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/provider.py"
click node_profiles "https://github.com/davidrapan/ha-solarman/tree/main/custom_components/solarman/inverter_definitions"
click node_device "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/device.py"
click node_parser "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/parser.py"
click node_common "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/common.py"
click node_entities "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/entity.py"
click node_sensor "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/sensor.py"
click node_controls "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/number.py"
click node_calendar "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/datetime.py"
click node_services "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/services.py"
click node_diagnostics "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/diagnostics.py"
click node_solarman "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/pysolarman/__init__.py"
click node_modbus "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/pysolarman/umodbus/functions.py"
click node_tcp "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/pysolarman/umodbus/client/tcp.py"
click node_serial "https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/pysolarman/umodbus/client/serial/rtu.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_config,node_discovery,node_settings,node_user toneBlue
class node_coordinator,node_provider,node_profiles,node_device,node_parser,node_common toneAmber
class node_entities,node_sensor,node_controls,node_calendar,node_services,node_diagnostics toneMint
class node_solarman,node_modbus,node_tcp,node_serial toneRose
class node_ha,node_external toneIndigo
```

## Components

### Setup & Discovery

- [Config flow](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/config_flow.py): `custom_components/solarman/config_flow.py`
- [Device discovery](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/discovery.py): `custom_components/solarman/discovery.py`
- [Shared config](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/const.py): `custom_components/solarman/const.py`

### Polling & Profiles

- [Update coordinator](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/coordinator.py): `custom_components/solarman/coordinator.py`
- [Profile provider](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/provider.py): `custom_components/solarman/provider.py`
- [Inverter definitions](https://github.com/davidrapan/ha-solarman/tree/main/custom_components/solarman/inverter_definitions): `custom_components/solarman/inverter_definitions`
- [Device interface](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/device.py): `custom_components/solarman/device.py`
- [Register parser](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/parser.py): `custom_components/solarman/parser.py`
- [Shared utilities](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/common.py): `custom_components/solarman/common.py`

### Home Assistant Entities

- [Entity base](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/entity.py): `custom_components/solarman/entity.py`
- [Sensor platforms](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/sensor.py): `custom_components/solarman/sensor.py`
- [Control platforms](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/number.py): `custom_components/solarman/number.py`
- [Time platforms](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/datetime.py): `custom_components/solarman/datetime.py`
- [Register services](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/services.py): `custom_components/solarman/services.py`
- [Diagnostics](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/diagnostics.py): `custom_components/solarman/diagnostics.py`

### Modbus Transport

- [Solarman protocol client](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/pysolarman/__init__.py): `custom_components/solarman/pysolarman/__init__.py`
- [Modbus PDU](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/pysolarman/umodbus/functions.py): `custom_components/solarman/pysolarman/umodbus/functions.py`
- [Modbus TCP](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/pysolarman/umodbus/client/tcp.py): `custom_components/solarman/pysolarman/umodbus/client/tcp.py`
- [Modbus RTU](https://github.com/davidrapan/ha-solarman/blob/main/custom_components/solarman/pysolarman/umodbus/client/serial/rtu.py): `custom_components/solarman/pysolarman/umodbus/client/serial/rtu.py`

### Other components

- **Home Assistant user**
- **Home Assistant**
- **Inverter / logger**

## Connections

- Home Assistant user → Home Assistant: sets up (evidence: `readme.md`)
- Home Assistant → Config flow: starts config (evidence: `readme.md`)
- Config flow → Device discovery: uses discovery (evidence: `custom_components/solarman/config_flow.py`)
- Config flow → Shared config: reads defaults (evidence: `custom_components/solarman/config_flow.py`)
- Update coordinator → Profile provider: creates provider (evidence: `custom_components/solarman/coordinator.py`)
- Profile provider → Inverter definitions: loads definitions
- Update coordinator → Device interface: sets up and polls (evidence: `custom_components/solarman/coordinator.py`)
- Profile provider → Register parser: uses parser (evidence: `custom_components/solarman/provider.py`)
- Device interface → Profile provider: gets configuration (evidence: `custom_components/solarman/device.py`)
- Device interface → Solarman protocol client: communicates through (evidence: `custom_components/solarman/device.py`)
- Device interface → Register parser: parses readings (evidence: `custom_components/solarman/device.py`)
- Device interface → Inverter / logger: reads registers
- Solarman protocol client → Modbus PDU: encodes requests (evidence: `custom_components/solarman/pysolarman/__init__.py`)
- Solarman protocol client → Modbus TCP: uses TCP transport (evidence: `custom_components/solarman/pysolarman/__init__.py`)
- Solarman protocol client → Modbus RTU: uses RTU transport (evidence: `custom_components/solarman/pysolarman/__init__.py`)
- Update coordinator → Entity base: provides updates (evidence: `custom_components/solarman/coordinator.py`)
- Sensor platforms → Entity base: builds entities (evidence: `custom_components/solarman/sensor.py`)
- Control platforms → Entity base: builds entities (evidence: `custom_components/solarman/number.py`)
- Time platforms → Entity base: builds entities (evidence: `custom_components/solarman/datetime.py`)
- Entity base → Register parser: gets descriptions
- Entity base → Shared utilities: uses helpers (evidence: `custom_components/solarman/entity.py`)
- Home Assistant → Register services: registers services (evidence: `custom_components/solarman/services.py`)
- Register services → Update coordinator: resolves device (evidence: `custom_components/solarman/services.py`)
- Register services → Device interface: executes register calls (evidence: `custom_components/solarman/services.py`)
- Home Assistant → Diagnostics: requests diagnostics
- Diagnostics → Update coordinator: reads coordinator (evidence: `custom_components/solarman/diagnostics.py`)
