# blakeblackshear/frigate-hass-integration architecture

> Architecture diagram of the GitHub repository blakeblackshear/frigate-hass-integration, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/blakeblackshear/frigate-hass-integration
- Repository: https://github.com/blakeblackshear/frigate-hass-integration

## Overview

This is a Home Assistant custom integration for Frigate, a network video recorder. The principal workflow is to configure a Frigate instance, connect through the integration’s API client, and expose Frigate data and controls as Home Assistant entities and services. Users can also browse event and recording media, access camera streams and snapshots, and receive event/review updates over WebSocket. The README documents these product capabilities; some platform implementations were not excerpted, so their internal call paths are not expanded here.

Main entry points: [`custom_components/frigate/__init__.py`](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/__init__.py) (Integration runtime), [`custom_components/frigate/api.py`](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/api.py) (Frigate API client), [`custom_components/frigate/media_source.py`](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/media_source.py) (Media browser), [`custom_components/frigate/ws_api.py`](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/ws_api.py) (WebSocket API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and runtime"]
  node_setup["Integration runtime<br/>[__init__.py]"]
  node_config["Config flow<br/>[config_flow.py]"]
  node_client["Frigate API client<br/>[api.py]"]
  node_diagnostics["Diagnostics<br/>[diagnostics.py]"]
end

subgraph group_entities["Home Assistant entities"]
  node_camera["Camera entities<br/>[camera.py]"]
  node_sensors["Sensor entities<br/>[sensor.py]"]
  node_binary["Motion sensors<br/>[binary_sensor.py]"]
  node_controls["Control entities<br/>[switch.py]"]
  node_other_entities["Other entities<br/>[number.py]"]
  node_image["Image entities<br/>[image.py]"]
  node_update["Update entity<br/>[update.py]"]
end

subgraph group_media["Media and views"]
  node_media["Media browser<br/>[media_source.py]"]
  node_views["HTTP views<br/>[views.py]"]
end

subgraph group_realtime["Realtime and AI"]
  node_ws_api["WebSocket API<br/>[ws_api.py]"]
  node_ws_proxy["MQTT WebSocket proxy<br/>[ws_proxy.py]"]
  node_llm["LLM functions<br/>[llm_functions.py]"]
end

node_ha_user(("Home Assistant user"))
node_ha{{"Home Assistant"}}
node_frigate{{"Frigate server"}}
node_mqtt{{"MQTT broker"}}

node_ha_user -->|"configures"| node_ha
node_ha -.->|"starts setup"| node_config
node_config -->|"configures"| node_client
node_setup -->|"creates client"| node_client
node_client -->|"HTTP requests"| node_frigate
node_ha -.->|"loads integration"| node_setup
node_setup -.->|"sets up platform"| node_camera
node_setup -.->|"sets up platform"| node_sensors
node_setup -.->|"sets up platform"| node_binary
node_setup -.->|"sets up platform"| node_controls
node_setup -.->|"sets up platform"| node_other_entities
node_setup -.->|"sets up platform"| node_image
node_setup -.->|"sets up platform"| node_update
node_camera -->|"requests camera data"| node_client
node_media -->|"fetches media data"| node_client
node_ha -->|"browses media"| node_media
node_media -.->|"uses media routes"| node_views
node_ha -->|"sends commands"| node_ws_api
node_ws_api -->|"requests Frigate data"| node_client
node_ws_api -->|"subscribes updates"| node_ws_proxy
node_ws_proxy -->|"subscribes topics"| node_mqtt
node_mqtt -->|"publishes events"| node_ws_proxy
node_llm -->|"queries Frigate"| node_client
node_ha -.->|"invokes tools"| node_llm
node_ha -.->|"requests diagnostics"| node_diagnostics

click node_setup "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/__init__.py"
click node_config "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/config_flow.py"
click node_client "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/api.py"
click node_diagnostics "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/diagnostics.py"
click node_camera "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/camera.py"
click node_sensors "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/sensor.py"
click node_binary "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/binary_sensor.py"
click node_controls "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/switch.py"
click node_other_entities "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/number.py"
click node_image "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/image.py"
click node_update "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/update.py"
click node_media "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/media_source.py"
click node_views "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/views.py"
click node_ws_api "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/ws_api.py"
click node_ws_proxy "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/ws_proxy.py"
click node_llm "https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/llm_functions.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_setup,node_config,node_client,node_diagnostics,node_ha_user toneBlue
class node_camera,node_sensors,node_binary,node_controls,node_other_entities,node_image,node_update toneAmber
class node_media,node_views,node_frigate toneMint
class node_ws_api,node_ws_proxy,node_llm toneRose
class node_ha,node_mqtt toneIndigo
```

## Components

### Setup and runtime

- [Integration runtime](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/__init__.py): `custom_components/frigate/__init__.py`
- [Config flow](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/config_flow.py): `custom_components/frigate/config_flow.py`
- [Frigate API client](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/api.py): `custom_components/frigate/api.py`
- [Diagnostics](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/diagnostics.py): `custom_components/frigate/diagnostics.py`

### Home Assistant entities

- [Camera entities](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/camera.py): `custom_components/frigate/camera.py`
- [Sensor entities](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/sensor.py): `custom_components/frigate/sensor.py`
- [Motion sensors](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/binary_sensor.py): `custom_components/frigate/binary_sensor.py`
- [Control entities](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/switch.py): `custom_components/frigate/switch.py`
- [Other entities](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/number.py): `custom_components/frigate/number.py`
- [Image entities](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/image.py): `custom_components/frigate/image.py`
- [Update entity](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/update.py): `custom_components/frigate/update.py`

### Media and views

- [Media browser](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/media_source.py): `custom_components/frigate/media_source.py`
- [HTTP views](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/views.py): `custom_components/frigate/views.py`

### Realtime and AI

- [WebSocket API](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/ws_api.py): `custom_components/frigate/ws_api.py`
- [MQTT WebSocket proxy](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/ws_proxy.py): `custom_components/frigate/ws_proxy.py`
- [LLM functions](https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/llm_functions.py): `custom_components/frigate/llm_functions.py`

### Other components

- **Home Assistant user**
- **Home Assistant**
- **Frigate server**
- **MQTT broker**

## Connections

- Home Assistant user → Home Assistant: configures (evidence: `README.md`)
- Home Assistant → Config flow: starts setup
- Config flow → Frigate API client: configures (evidence: `custom_components/frigate/config_flow.py`)
- Integration runtime → Frigate API client: creates client (evidence: `custom_components/frigate/__init__.py`)
- Frigate API client → Frigate server: HTTP requests (evidence: `custom_components/frigate/api.py`)
- Home Assistant → Integration runtime: loads integration
- Integration runtime → Camera entities: sets up platform (evidence: `custom_components/frigate/camera.py`)
- Integration runtime → Sensor entities: sets up platform (evidence: `custom_components/frigate/sensor.py`)
- Integration runtime → Motion sensors: sets up platform (evidence: `custom_components/frigate/binary_sensor.py`)
- Integration runtime → Control entities: sets up platform (evidence: `custom_components/frigate/switch.py`)
- Integration runtime → Other entities: sets up platform (evidence: `custom_components/frigate/number.py`)
- Integration runtime → Image entities: sets up platform (evidence: `custom_components/frigate/image.py`)
- Integration runtime → Update entity: sets up platform (evidence: `custom_components/frigate/update.py`)
- Camera entities → Frigate API client: requests camera data (evidence: `custom_components/frigate/camera.py`)
- Media browser → Frigate API client: fetches media data (evidence: `custom_components/frigate/media_source.py`)
- Home Assistant → Media browser: browses media (evidence: `README.md`)
- Media browser → HTTP views: uses media routes (evidence: `custom_components/frigate/media_source.py`)
- Home Assistant → WebSocket API: sends commands (evidence: `custom_components/frigate/ws_api.py`)
- WebSocket API → Frigate API client: requests Frigate data (evidence: `custom_components/frigate/ws_api.py`)
- WebSocket API → MQTT WebSocket proxy: subscribes updates (evidence: `custom_components/frigate/ws_api.py`)
- MQTT WebSocket proxy → MQTT broker: subscribes topics (evidence: `custom_components/frigate/ws_proxy.py`)
- MQTT broker → MQTT WebSocket proxy: publishes events (evidence: `custom_components/frigate/ws_proxy.py`)
- LLM functions → Frigate API client: queries Frigate (evidence: `custom_components/frigate/llm_functions.py`)
- Home Assistant → LLM functions: invokes tools
- Home Assistant → Diagnostics: requests diagnostics
