# rgerbranda/rbfa architecture

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

- Interactive diagram: https://gitdiagram.com/rgerbranda/rbfa
- Repository: https://github.com/rgerbranda/rbfa

## Overview

This Home Assistant integration turns a configured RBFA team number into calendar events and match-related sensors. The setup flow stores team and display options; a 15-minute coordinator refreshes RBFA team, calendar, match-detail, and optionally ranking data, then exposes it through calendar and sensor platforms. Match enrichment and ranking are distinct data stages within the API implementation. The README also documents ranking attributes and sensor-based dashboard cards. Relationships are limited to those shown in excerpts or stated in the README; no unsampled modules are assumed.

Main entry points: [`custom_components/rbfa/API.py`](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/API.py) (Team data collector), [`custom_components/rbfa/coordinator.py`](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/coordinator.py) (Refresh coordinator), [`custom_components/rbfa/calendar.py`](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/calendar.py) (Team calendar), [`custom_components/rbfa/sensor.py`](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/sensor.py) (Match sensors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Configuration &amp; setup"]
  node_flow["Team configuration<br/>[config_flow.py]"]
  node_setup_entry["Entry setup<br/>[__init__.py]"]
end

subgraph group_fetch["RBFA data retrieval"]
  node_api["Team data collector<br/>[API.py]"]
  node_team_calendar["Team &amp; calendar retrieval<br/>[API.py]"]
  node_match_details["Match detail enrichment<br/>[API.py]"]
  node_ranking["Series rankings<br/>[API.py]"]
end

subgraph group_entities["Home Assistant entities"]
  node_calendar["Team calendar<br/>[calendar.py]"]
  node_sensor["Match sensors<br/>[sensor.py]"]
end

subgraph group_shared["Shared integration layer"]
  node_constants["Integration constants<br/>[const.py]"]
  node_coordinator["Refresh coordinator<br/>[coordinator.py]"]
  node_base_entity["Coordinator entity base<br/>[entity.py]"]
end

node_user(("Home Assistant user"))
node_rbfa["RBFA service"]
node_ha_calendar(("Home Assistant calendar"))
node_ha_sensors(("Home Assistant sensors"))

node_user -->|"configures team"| node_flow
node_setup_entry -->|"creates"| node_coordinator
node_setup_entry -->|"forwards platform"| node_calendar
node_setup_entry -->|"forwards platform"| node_sensor
node_coordinator -->|"refreshes via"| node_api
node_api -->|"retrieves"| node_team_calendar
node_api -->|"retrieves"| node_match_details
node_api -->|"optionally retrieves"| node_ranking
node_api -->|"queries GraphQL"| node_rbfa
node_api -->|"returns match data"| node_coordinator
node_calendar -->|"reads events"| node_coordinator
node_sensor -->|"reads match data"| node_coordinator
node_calendar -->|"inherits"| node_base_entity
node_sensor -->|"inherits"| node_base_entity
node_calendar -->|"provides events"| node_ha_calendar
node_sensor -->|"exposes match values"| node_ha_sensors

click node_flow "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/config_flow.py"
click node_setup_entry "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/__init__.py"
click node_constants "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/const.py"
click node_coordinator "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/coordinator.py"
click node_api "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/API.py"
click node_team_calendar "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/API.py"
click node_match_details "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/API.py"
click node_ranking "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/API.py"
click node_base_entity "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/entity.py"
click node_calendar "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/calendar.py"
click node_sensor "https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/sensor.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_flow,node_setup_entry,node_user toneBlue
class node_api,node_team_calendar,node_match_details,node_ranking toneAmber
class node_calendar,node_sensor toneMint
class node_constants,node_coordinator,node_base_entity toneRose
class node_rbfa,node_ha_calendar,node_ha_sensors toneIndigo
```

## Components

### Configuration & setup

- [Team configuration](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/config_flow.py): `custom_components/rbfa/config_flow.py`
- [Entry setup](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/__init__.py): `custom_components/rbfa/__init__.py`

### RBFA data retrieval

- [Team data collector](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/API.py): `custom_components/rbfa/API.py`
- [Team & calendar retrieval](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/API.py): `custom_components/rbfa/API.py`
- [Match detail enrichment](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/API.py): `custom_components/rbfa/API.py`
- [Series rankings](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/API.py): `custom_components/rbfa/API.py`

### Home Assistant entities

- [Team calendar](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/calendar.py): `custom_components/rbfa/calendar.py`
- [Match sensors](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/sensor.py): `custom_components/rbfa/sensor.py`

### Shared integration layer

- [Integration constants](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/const.py): `custom_components/rbfa/const.py`
- [Refresh coordinator](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/coordinator.py): `custom_components/rbfa/coordinator.py`
- [Coordinator entity base](https://github.com/rgerbranda/rbfa/blob/main/custom_components/rbfa/entity.py): `custom_components/rbfa/entity.py`

### Other components

- **Home Assistant user**
- **RBFA service**
- **Home Assistant calendar**
- **Home Assistant sensors**

## Connections

- Home Assistant user → Team configuration: configures team (evidence: `custom_components/rbfa/config_flow.py`)
- Entry setup → Refresh coordinator: creates (evidence: `custom_components/rbfa/__init__.py`)
- Entry setup → Team calendar: forwards platform (evidence: `custom_components/rbfa/__init__.py`)
- Entry setup → Match sensors: forwards platform (evidence: `custom_components/rbfa/__init__.py`)
- Refresh coordinator → Team data collector: refreshes via (evidence: `custom_components/rbfa/coordinator.py`)
- Team data collector → Team & calendar retrieval: retrieves (evidence: `custom_components/rbfa/API.py`)
- Team data collector → Match detail enrichment: retrieves (evidence: `custom_components/rbfa/API.py`)
- Team data collector → Series rankings: optionally retrieves (evidence: `custom_components/rbfa/API.py`)
- Team data collector → RBFA service: queries GraphQL (evidence: `custom_components/rbfa/API.py`)
- Team data collector → Refresh coordinator: returns match data (evidence: `custom_components/rbfa/coordinator.py`)
- Team calendar → Refresh coordinator: reads events (evidence: `custom_components/rbfa/calendar.py`)
- Match sensors → Refresh coordinator: reads match data (evidence: `custom_components/rbfa/sensor.py`)
- Team calendar → Coordinator entity base: inherits (evidence: `custom_components/rbfa/calendar.py`)
- Match sensors → Coordinator entity base: inherits (evidence: `custom_components/rbfa/sensor.py`)
- Team calendar → Home Assistant calendar: provides events (evidence: `README.md`)
- Match sensors → Home Assistant sensors: exposes match values (evidence: `README.md`)
