# flip-dots/hasolixble architecture

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

- Interactive diagram: https://gitdiagram.com/flip-dots/hasolixble
- Repository: https://github.com/flip-dots/hasolixble

## Overview

Home Assistant Solix BLE discovers Anker devices, lets the user select a model, validates a Bluetooth connection, then establishes the runtime device and exposes sensor and switch entities. The README documents telemetry and controls spanning power, battery, solar, ports, display, lighting, and expansion batteries; the sampled sensor excerpt confirms many of these, while the switch excerpt shows output, display, and charger-port controls. The underlying SolixBLE library implements device communication and is external to this repository; unsampled capabilities are represented at the documented platform level.

Main entry points: [`custom_components/solix_ble/__init__.py`](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/__init__.py) (Entry setup), [`custom_components/solix_ble/config_flow.py`](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/config_flow.py) (Config flow), [`custom_components/solix_ble/sensor.py`](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/sensor.py) (Sensor platform), [`custom_components/solix_ble/switch.py`](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/switch.py) (Switch entities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Discovery &amp; setup"]
  node_config_flow["Config flow<br/>[config_flow.py]"]
  node_model_catalog["Model catalog<br/>[const.py]"]
end

subgraph group_device["Device runtime"]
  node_integration_setup["Entry setup<br/>[__init__.py]"]
  node_solixble["SolixBLE device API"]
end

subgraph group_telemetry["Monitoring"]
  node_sensor_platform["Sensor platform<br/>[sensor.py]"]
  node_sensor_entities["Sensor entities<br/>[sensor.py]"]
end

subgraph group_controls["Controls"]
  node_switch_platform["Switch platform<br/>[switch.py]"]
  node_switch_entities["Switch entities<br/>[switch.py]"]
end

node_ha_user(("Home Assistant user"))
node_ha_bluetooth(("HA Bluetooth scanner"))

node_ha_bluetooth -.->|"discovers device"| node_config_flow
node_ha_user -.->|"selects model"| node_config_flow
node_config_flow -->|"uses models"| node_model_catalog
node_config_flow -->|"validates connection"| node_solixble
node_config_flow -.->|"creates entry"| node_integration_setup
node_integration_setup -->|"selects class"| node_model_catalog
node_integration_setup -->|"connects device"| node_solixble
node_integration_setup -->|"forwards setup"| node_sensor_platform
node_integration_setup -->|"forwards setup"| node_switch_platform
node_sensor_platform -->|"creates entities"| node_sensor_entities
node_sensor_entities -->|"reads telemetry"| node_solixble
node_sensor_platform -->|"uses status labels"| node_model_catalog
node_switch_platform -->|"creates controls"| node_switch_entities
node_switch_entities -->|"invokes device controls"| node_solixble
node_switch_entities -->|"registers state callback"| node_solixble

click node_config_flow "https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/config_flow.py"
click node_model_catalog "https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/const.py"
click node_integration_setup "https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/__init__.py"
click node_sensor_platform "https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/sensor.py"
click node_sensor_entities "https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/sensor.py"
click node_switch_platform "https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/switch.py"
click node_switch_entities "https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/switch.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_flow,node_model_catalog,node_ha_user toneBlue
class node_integration_setup,node_solixble toneAmber
class node_sensor_platform,node_sensor_entities toneMint
class node_switch_platform,node_switch_entities toneRose
class node_ha_bluetooth toneIndigo
```

## Components

### Discovery & setup

- [Config flow](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/config_flow.py): `custom_components/solix_ble/config_flow.py`
- [Model catalog](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/const.py): `custom_components/solix_ble/const.py`

### Device runtime

- [Entry setup](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/__init__.py): `custom_components/solix_ble/__init__.py`
- **SolixBLE device API**

### Monitoring

- [Sensor platform](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/sensor.py): `custom_components/solix_ble/sensor.py`
- [Sensor entities](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/sensor.py): `custom_components/solix_ble/sensor.py`

### Controls

- [Switch platform](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/switch.py): `custom_components/solix_ble/switch.py`
- [Switch entities](https://github.com/flip-dots/hasolixble/blob/main/custom_components/solix_ble/switch.py): `custom_components/solix_ble/switch.py`

### Other components

- **Home Assistant user**
- **HA Bluetooth scanner**

## Connections

- HA Bluetooth scanner → Config flow: discovers device (evidence: `README.md`)
- Home Assistant user → Config flow: selects model (evidence: `README.md`)
- Config flow → Model catalog: uses models (evidence: `custom_components/solix_ble/config_flow.py`)
- Config flow → SolixBLE device API: validates connection (evidence: `custom_components/solix_ble/config_flow.py`)
- Config flow → Entry setup: creates entry (evidence: `custom_components/solix_ble/config_flow.py`)
- Entry setup → Model catalog: selects class (evidence: `custom_components/solix_ble/__init__.py`)
- Entry setup → SolixBLE device API: connects device (evidence: `custom_components/solix_ble/__init__.py`)
- Entry setup → Sensor platform: forwards setup (evidence: `custom_components/solix_ble/__init__.py`)
- Entry setup → Switch platform: forwards setup (evidence: `custom_components/solix_ble/__init__.py`)
- Sensor platform → Sensor entities: creates entities (evidence: `custom_components/solix_ble/sensor.py`)
- Sensor entities → SolixBLE device API: reads telemetry (evidence: `custom_components/solix_ble/sensor.py`)
- Sensor platform → Model catalog: uses status labels (evidence: `custom_components/solix_ble/sensor.py`)
- Switch platform → Switch entities: creates controls (evidence: `custom_components/solix_ble/switch.py`)
- Switch entities → SolixBLE device API: invokes device controls (evidence: `custom_components/solix_ble/switch.py`)
- Switch entities → SolixBLE device API: registers state callback (evidence: `custom_components/solix_ble/switch.py`)
