# dvd-dev/hilo architecture

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

- Interactive diagram: https://gitdiagram.com/dvd-dev/hilo
- Repository: https://github.com/dvd-dev/hilo

## Overview

Hilo is an unofficial Home Assistant integration. The main workflow is account setup and OAuth authentication, followed by integration-managed device data becoming Home Assistant climate, light, switch, and sensor entities; those entities expose controls and energy/challenge information. The README also documents configurable energy-meter generation and outdoor-weather sensing. Source excerpts show entity implementations and energy managers, but omit much of integration setup and sensor logic, so those relationships are left unverified where necessary.

Main entry points: [`custom_components/hilo/__init__.py`](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/__init__.py) (Integration runtime), [`custom_components/hilo/climate.py`](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/climate.py) (Thermostat controls), [`custom_components/hilo/light.py`](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/light.py) (Light controls), [`custom_components/hilo/switch.py`](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/switch.py) (Switch controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and authentication"]
  node_config_flow["Configuration flow<br/>[config_flow.py]"]
  node_oauth["OAuth2 authentication<br/>[oauth2.py]"]
end

subgraph group_runtime["Integration runtime"]
  node_integration["Integration runtime<br/>[__init__.py]"]
  node_constants["Integration settings<br/>[const.py]"]
end

subgraph group_entities["Device entities"]
  node_base_entity["Shared entity base<br/>[entity.py]"]
  node_climate["Thermostat controls<br/>[climate.py]"]
  node_light["Light controls<br/>[light.py]"]
  node_switch["Switch controls<br/>[switch.py]"]
end

subgraph group_insights["Energy and insights"]
  node_sensors["Sensors and challenges<br/>[sensor.py]"]
  node_managers["Energy managers<br/>[managers.py]"]
end

node_home_assistant(("Home Assistant user"))
node_hilo_service["Hilo service"]

node_home_assistant -->|"configures integration"| node_config_flow
node_config_flow -->|"uses authentication"| node_oauth
node_oauth -->|"requests tokens"| node_hilo_service
node_integration -.->|"connects account"| node_hilo_service
node_integration -->|"uses settings"| node_constants
node_climate -->|"extends"| node_base_entity
node_light -->|"extends"| node_base_entity
node_switch -->|"extends"| node_base_entity
node_climate -->|"reads devices"| node_integration
node_light -->|"reads devices"| node_integration
node_switch -->|"reads devices"| node_integration
node_climate -.->|"sets temperature"| node_hilo_service
node_light -.->|"sets light attributes"| node_hilo_service
node_switch -.->|"sets switch state"| node_hilo_service
node_sensors -->|"uses integration data"| node_integration
node_managers -->|"configures energy meters"| node_home_assistant
node_managers -->|"updates energy dashboard"| node_home_assistant
node_home_assistant -->|"reads energy and weather"| node_sensors

click node_config_flow "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/config_flow.py"
click node_oauth "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/oauth2.py"
click node_integration "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/__init__.py"
click node_constants "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/const.py"
click node_base_entity "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/entity.py"
click node_climate "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/climate.py"
click node_light "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/light.py"
click node_switch "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/switch.py"
click node_sensors "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/sensor.py"
click node_managers "https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/managers.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_oauth,node_home_assistant toneBlue
class node_integration,node_constants toneAmber
class node_base_entity,node_climate,node_light,node_switch toneMint
class node_sensors,node_managers toneRose
class node_hilo_service toneIndigo
```

## Components

### Setup and authentication

- [Configuration flow](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/config_flow.py): `custom_components/hilo/config_flow.py`
- [OAuth2 authentication](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/oauth2.py): `custom_components/hilo/oauth2.py`

### Integration runtime

- [Integration runtime](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/__init__.py): `custom_components/hilo/__init__.py`
- [Integration settings](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/const.py): `custom_components/hilo/const.py`

### Device entities

- [Shared entity base](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/entity.py): `custom_components/hilo/entity.py`
- [Thermostat controls](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/climate.py): `custom_components/hilo/climate.py`
- [Light controls](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/light.py): `custom_components/hilo/light.py`
- [Switch controls](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/switch.py): `custom_components/hilo/switch.py`

### Energy and insights

- [Sensors and challenges](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/sensor.py): `custom_components/hilo/sensor.py`
- [Energy managers](https://github.com/dvd-dev/hilo/blob/main/custom_components/hilo/managers.py): `custom_components/hilo/managers.py`

### Other components

- **Home Assistant user**
- **Hilo service**

## Connections

- Home Assistant user → Configuration flow: configures integration (evidence: `README.md`)
- Configuration flow → OAuth2 authentication: uses authentication (evidence: `custom_components/hilo/config_flow.py`)
- OAuth2 authentication → Hilo service: requests tokens (evidence: `custom_components/hilo/oauth2.py`)
- Integration runtime → Hilo service: connects account
- Integration runtime → Integration settings: uses settings (evidence: `custom_components/hilo/__init__.py`)
- Thermostat controls → Shared entity base: extends (evidence: `custom_components/hilo/climate.py`)
- Light controls → Shared entity base: extends (evidence: `custom_components/hilo/light.py`)
- Switch controls → Shared entity base: extends (evidence: `custom_components/hilo/switch.py`)
- Thermostat controls → Integration runtime: reads devices (evidence: `custom_components/hilo/climate.py`)
- Light controls → Integration runtime: reads devices (evidence: `custom_components/hilo/light.py`)
- Switch controls → Integration runtime: reads devices (evidence: `custom_components/hilo/switch.py`)
- Thermostat controls → Hilo service: sets temperature
- Light controls → Hilo service: sets light attributes
- Switch controls → Hilo service: sets switch state
- Sensors and challenges → Integration runtime: uses integration data (evidence: `custom_components/hilo/sensor.py`)
- Energy managers → Home Assistant user: configures energy meters (evidence: `custom_components/hilo/managers.py`)
- Energy managers → Home Assistant user: updates energy dashboard (evidence: `custom_components/hilo/managers.py`)
- Home Assistant user → Sensors and challenges: reads energy and weather (evidence: `README.md`)
