# shakthisachintha/srne-hybrid-inverter-monitor architecture

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

- Interactive diagram: https://gitdiagram.com/shakthisachintha/srne-hybrid-inverter-monitor
- Repository: https://github.com/shakthisachintha/srne-hybrid-inverter-monitor

## Overview

This repository monitors and controls SRNE hybrid inverters over Modbus RTU. The active TypeScript workflow connects to the inverter, periodically reads and publishes telemetry through MQTT, and listens for broker commands; command writes are not currently active in the sampled handler. The README describes a separate middle-tier API as the intended client-facing path, but it is not present in the tree. The older Python implementation includes a FastAPI/SSE interface and validated setting endpoints. The graph includes both generations; the planned API wiring is documented rather than implemented.

Main entry points: [`inverter-bridge/index.ts`](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/inverter-bridge/index.ts) (Bridge runtime), [`inverter-bridge/src/Inverters/SRNE/SrneInverter.ts`](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/inverter-bridge/src/Inverters/SRNE/SrneInverter.ts) (SRNE client), [`python/src/SRNEinverter.py`](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/SRNEinverter.py) (Python inverter client), [`python/src/main.py`](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/main.py) (FastAPI interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bridge["TypeScript bridge"]
  node_bridge_process["Bridge runtime<br/>[index.ts]"]
end

subgraph group_protocol["Inverter protocol"]
  node_inverter_client["SRNE client<br/>[SrneInverter.ts]"]
  node_register_map["Register maps<br/>[types.ts]"]
end

subgraph group_legacy["Legacy Python"]
  node_python_api["FastAPI interface<br/>[main.py]"]
  node_python_inverter["Python inverter client<br/>[SRNEinverter.py]"]
  node_python_commands["Python register map<br/>[srnecommands.py]"]
  node_validator["Setting validator<br/>[validator.py]"]
end

subgraph group_planned["Planned API"]
  node_middle_tier["Middle-tier API"]
end

node_device{{"SRNE inverter"}}
node_broker["MQTT broker"]
node_clients(("Apps and dashboards"))
node_python_device{{"Legacy inverter"}}

node_bridge_process -->|"connects and reads"| node_inverter_client
node_inverter_client -->|"Modbus RTU"| node_device
node_inverter_client -->|"uses definitions"| node_register_map
node_bridge_process -->|"publishes telemetry"| node_broker
node_broker -->|"delivers commands"| node_bridge_process
node_bridge_process -->|"publishes acknowledgements"| node_broker
node_broker -.->|"telemetry to API"| node_middle_tier
node_middle_tier -.->|"relays commands"| node_broker
node_clients -.->|"uses API"| node_middle_tier
node_python_api -->|"reads and sets"| node_python_inverter
node_python_api -->|"validates settings"| node_validator
node_python_inverter -->|"uses definitions"| node_python_commands
node_python_inverter -->|"Modbus RTU"| node_python_device

click node_bridge_process "https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/inverter-bridge/index.ts"
click node_inverter_client "https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/inverter-bridge/src/Inverters/SRNE/SrneInverter.ts"
click node_register_map "https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/inverter-bridge/src/Inverters/SRNE/types.ts"
click node_python_api "https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/main.py"
click node_python_inverter "https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/SRNEinverter.py"
click node_python_commands "https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/srnecommands.py"
click node_validator "https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/validator.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_bridge_process toneBlue
class node_inverter_client,node_register_map toneAmber
class node_python_api,node_python_inverter,node_python_commands,node_validator toneMint
class node_middle_tier toneRose
class node_device,node_broker,node_clients,node_python_device toneIndigo
```

## Components

### TypeScript bridge

- [Bridge runtime](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/inverter-bridge/index.ts): `inverter-bridge/index.ts`

### Inverter protocol

- [SRNE client](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/inverter-bridge/src/Inverters/SRNE/SrneInverter.ts): `inverter-bridge/src/Inverters/SRNE/SrneInverter.ts`
- [Register maps](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/inverter-bridge/src/Inverters/SRNE/types.ts): `inverter-bridge/src/Inverters/SRNE/types.ts`

### Legacy Python

- [FastAPI interface](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/main.py): `python/src/main.py`
- [Python inverter client](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/SRNEinverter.py): `python/src/SRNEinverter.py`
- [Python register map](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/srnecommands.py): `python/src/srnecommands.py`
- [Setting validator](https://github.com/shakthisachintha/srne-hybrid-inverter-monitor/blob/master/python/src/validator.py): `python/src/validator.py`

### Planned API

- **Middle-tier API**

### Other components

- **SRNE inverter**
- **MQTT broker**
- **Apps and dashboards**
- **Legacy inverter**

## Connections

- Bridge runtime → SRNE client: connects and reads
- SRNE client → SRNE inverter: Modbus RTU
- SRNE client → Register maps: uses definitions
- Bridge runtime → MQTT broker: publishes telemetry
- MQTT broker → Bridge runtime: delivers commands
- Bridge runtime → MQTT broker: publishes acknowledgements
- MQTT broker → Middle-tier API: telemetry to API
- Middle-tier API → MQTT broker: relays commands
- Apps and dashboards → Middle-tier API: uses API
- FastAPI interface → Python inverter client: reads and sets
- FastAPI interface → Setting validator: validates settings
- Python inverter client → Python register map: uses definitions
- Python inverter client → Legacy inverter: Modbus RTU
