# fapgomes/ha-smartthings-find architecture

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

- Interactive diagram: https://gitdiagram.com/fapgomes/ha-smartthings-find
- Repository: https://github.com/fapgomes/ha-smartthings-find

## Overview

SmartThings Find is a Home Assistant integration that imports Samsung device location and status, exposes them as entities, and can request locations or ring devices. The main flow is sign-in and session setup, polling and device-state coordination, then presentation and commands through Home Assistant entities. Samsung Account authorization and browser-cookie sessions are supported. The README documents the user-facing capabilities; some internal wiring is inferred only where the supplied source index or excerpts support it.

Main entry points: [`custom_components/smartthings_find/coordinator.py`](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/coordinator.py) (Polling coordinator), [`custom_components/smartthings_find/entity.py`](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/entity.py) (Entity base), [`custom_components/smartthings_find/config_flow.py`](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/config_flow.py) (Configuration flow), [`custom_components/smartthings_find/__init__.py`](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/__init__.py) (Integration setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Sign-in"]
  node_config["Configuration flow<br/>[config_flow.py]"]
  node_account["Samsung Account auth<br/>[account.py]"]
end

subgraph group_runtime["Device runtime"]
  node_integration["Integration setup<br/>[__init__.py]"]
  node_coordinator["Polling coordinator<br/>[coordinator.py]"]
  node_api["Find web API client<br/>[api.py]"]
end

subgraph group_entities["Home Assistant entities"]
  node_base_entity["Entity base<br/>[entity.py]"]
  node_tracker["Location tracker<br/>[device_tracker.py]"]
  node_sensors["Battery and status sensors<br/>[sensor.py]"]
  node_binary_sensors["Connection and lock<br/>[binary_sensor.py]"]
  node_buttons["Ring and update buttons<br/>[button.py]"]
  node_switch["Automatic update switch<br/>[switch.py]"]
end

subgraph group_state["State and diagnostics"]
  node_device_state["Device state models<br/>[models.py]"]
  node_session_store[("Session store<br/>[store.py]")]
  node_diagnostics["Diagnostics<br/>[diagnostics.py]"]
end

node_user(("User"))
node_samsung{{"Samsung services"}}

node_user -->|"configures"| node_config
node_config -->|"starts account auth"| node_account
node_account -->|"exchanges authorization"| node_samsung
node_config -.->|"validates session"| node_samsung
node_integration -->|"sets up"| node_coordinator
node_integration -->|"removes on entry deletion"| node_session_store
node_coordinator -->|"requests device data"| node_api
node_coordinator -->|"loads and saves"| node_session_store
node_coordinator -->|"uses state models"| node_device_state
node_api -->|"calls Find endpoints"| node_samsung
node_tracker -->|"extends"| node_base_entity
node_sensors -->|"extends"| node_base_entity
node_binary_sensors -->|"extends"| node_base_entity
node_buttons -->|"extends"| node_base_entity
node_switch -->|"extends"| node_base_entity
node_base_entity -->|"reads device state"| node_coordinator
node_buttons -->|"invokes device commands"| node_coordinator
node_switch -->|"sets update mode"| node_coordinator
node_diagnostics -->|"reads diagnostics"| node_coordinator

click node_config "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/config_flow.py"
click node_account "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/account.py"
click node_integration "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/__init__.py"
click node_coordinator "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/coordinator.py"
click node_api "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/api.py"
click node_device_state "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/models.py"
click node_session_store "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/store.py"
click node_base_entity "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/entity.py"
click node_tracker "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/device_tracker.py"
click node_sensors "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/sensor.py"
click node_binary_sensors "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/binary_sensor.py"
click node_buttons "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/button.py"
click node_switch "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/switch.py"
click node_diagnostics "https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/diagnostics.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,node_account,node_user toneBlue
class node_integration,node_coordinator,node_api toneAmber
class node_base_entity,node_tracker,node_sensors,node_binary_sensors,node_buttons,node_switch toneMint
class node_device_state,node_session_store,node_diagnostics toneRose
class node_samsung toneIndigo
```

## Components

### Sign-in

- [Configuration flow](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/config_flow.py): `custom_components/smartthings_find/config_flow.py`
- [Samsung Account auth](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/account.py): `custom_components/smartthings_find/account.py`

### Device runtime

- [Integration setup](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/__init__.py): `custom_components/smartthings_find/__init__.py`
- [Polling coordinator](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/coordinator.py): `custom_components/smartthings_find/coordinator.py`
- [Find web API client](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/api.py): `custom_components/smartthings_find/api.py`

### Home Assistant entities

- [Entity base](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/entity.py): `custom_components/smartthings_find/entity.py`
- [Location tracker](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/device_tracker.py): `custom_components/smartthings_find/device_tracker.py`
- [Battery and status sensors](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/sensor.py): `custom_components/smartthings_find/sensor.py`
- [Connection and lock](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/binary_sensor.py): `custom_components/smartthings_find/binary_sensor.py`
- [Ring and update buttons](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/button.py): `custom_components/smartthings_find/button.py`
- [Automatic update switch](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/switch.py): `custom_components/smartthings_find/switch.py`

### State and diagnostics

- [Device state models](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/models.py): `custom_components/smartthings_find/models.py`
- [Session store](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/store.py): `custom_components/smartthings_find/store.py`
- [Diagnostics](https://github.com/fapgomes/ha-smartthings-find/blob/main/custom_components/smartthings_find/diagnostics.py): `custom_components/smartthings_find/diagnostics.py`

### Other components

- **User**
- **Samsung services**

## Connections

- User → Configuration flow: configures (evidence: `README.md`)
- Configuration flow → Samsung Account auth: starts account auth (evidence: `custom_components/smartthings_find/config_flow.py`)
- Samsung Account auth → Samsung services: exchanges authorization (evidence: `custom_components/smartthings_find/account.py`)
- Configuration flow → Samsung services: validates session
- Integration setup → Polling coordinator: sets up (evidence: `custom_components/smartthings_find/__init__.py`)
- Integration setup → Session store: removes on entry deletion (evidence: `custom_components/smartthings_find/__init__.py`)
- Polling coordinator → Find web API client: requests device data (evidence: `custom_components/smartthings_find/coordinator.py`)
- Polling coordinator → Session store: loads and saves (evidence: `custom_components/smartthings_find/coordinator.py`)
- Polling coordinator → Device state models: uses state models (evidence: `custom_components/smartthings_find/coordinator.py`)
- Find web API client → Samsung services: calls Find endpoints (evidence: `README.md`)
- Location tracker → Entity base: extends (evidence: `custom_components/smartthings_find/device_tracker.py`)
- Battery and status sensors → Entity base: extends (evidence: `custom_components/smartthings_find/sensor.py`)
- Connection and lock → Entity base: extends (evidence: `custom_components/smartthings_find/binary_sensor.py`)
- Ring and update buttons → Entity base: extends (evidence: `custom_components/smartthings_find/button.py`)
- Automatic update switch → Entity base: extends (evidence: `custom_components/smartthings_find/switch.py`)
- Entity base → Polling coordinator: reads device state (evidence: `custom_components/smartthings_find/entity.py`)
- Ring and update buttons → Polling coordinator: invokes device commands (evidence: `custom_components/smartthings_find/button.py`)
- Automatic update switch → Polling coordinator: sets update mode (evidence: `custom_components/smartthings_find/switch.py`)
- Diagnostics → Polling coordinator: reads diagnostics (evidence: `custom_components/smartthings_find/diagnostics.py`)
