# udocs-ru/ha_vk_notify architecture

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

- Interactive diagram: https://gitdiagram.com/udocs-ru/ha_vk_notify
- Repository: https://github.com/udocs-ru/ha_vk_notify

## Overview

VK Notify is a Home Assistant integration for sending VK messages and, optionally, receiving VK conversation events through Long Poll. Users configure a token, connection mode, and chat; Home Assistant then exposes notification services for message and chat operations. The notify entity uses helpers for formatting and media uploads, while a shared Long Poll manager emits incoming-message, callback, typing, and read events. The graph reflects the README’s broader service capabilities; unsampled service-registration details are not inferred.

Main entry points: [`custom_components/vk_notify/notify.py`](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/notify.py) (Notify services), [`custom_components/vk_notify/longpoll.py`](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/longpoll.py) (Long Poll manager), [`custom_components/vk_notify/config_flow.py`](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/config_flow.py) (Integration setup), [`custom_components/vk_notify/__init__.py`](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/__init__.py) (Entry lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup"]
  node_config["Integration setup<br/>[config_flow.py]"]
  node_entry["Entry lifecycle<br/>[__init__.py]"]
end

subgraph group_send["Outbound messaging"]
  node_notify["Notify services<br/>[notify.py]"]
  node_message["Message operations<br/>[notify.py]"]
  node_chatops["Chat and profile ops<br/>[notify.py]"]
end

subgraph group_support["Message support"]
  node_format["Text formatting<br/>[helpers.py]"]
  node_uploads["Media uploads<br/>[helpers.py]"]
  node_constants["API configuration<br/>[const.py]"]
end

subgraph group_receive["Inbound events"]
  node_poll["Long Poll manager<br/>[longpoll.py]"]
end

node_user(("HA user"))
node_automations(("HA automations"))
node_vk{{"VK API"}}
node_eventbus["HA event bus"]

node_user -->|"configures"| node_config
node_config -->|"validates token; lists chats"| node_vk
node_config -->|"creates entry"| node_entry
node_entry -->|"forwards notify platform"| node_notify
node_entry -->|"starts and stops"| node_poll
node_automations -->|"calls services"| node_notify
node_notify -->|"dispatches operations"| node_message
node_notify -->|"dispatches operations"| node_chatops
node_message -->|"formats text"| node_format
node_message -->|"uploads media"| node_uploads
node_notify -->|"sends API requests"| node_vk
node_uploads -->|"uploads and saves media"| node_vk
node_chatops -->|"requests operations"| node_vk
node_poll -->|"polls and marks read"| node_vk
node_poll -->|"fires events"| node_eventbus
node_constants -->|"provides API constants"| node_notify
node_constants -->|"provides poll constants"| node_poll

click node_config "https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/config_flow.py"
click node_entry "https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/__init__.py"
click node_notify "https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/notify.py"
click node_message "https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/notify.py"
click node_chatops "https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/notify.py"
click node_format "https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/helpers.py"
click node_uploads "https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/helpers.py"
click node_constants "https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/const.py"
click node_poll "https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/longpoll.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_entry,node_user toneBlue
class node_notify,node_message,node_chatops toneAmber
class node_format,node_uploads,node_constants,node_vk toneMint
class node_poll toneRose
class node_automations,node_eventbus toneIndigo
```

## Components

### Setup

- [Integration setup](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/config_flow.py): `custom_components/vk_notify/config_flow.py`
- [Entry lifecycle](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/__init__.py): `custom_components/vk_notify/__init__.py`

### Outbound messaging

- [Notify services](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/notify.py): `custom_components/vk_notify/notify.py`
- [Message operations](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/notify.py): `custom_components/vk_notify/notify.py`
- [Chat and profile ops](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/notify.py): `custom_components/vk_notify/notify.py`

### Message support

- [Text formatting](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/helpers.py): `custom_components/vk_notify/helpers.py`
- [Media uploads](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/helpers.py): `custom_components/vk_notify/helpers.py`
- [API configuration](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/const.py): `custom_components/vk_notify/const.py`

### Inbound events

- [Long Poll manager](https://github.com/udocs-ru/ha_vk_notify/blob/main/custom_components/vk_notify/longpoll.py): `custom_components/vk_notify/longpoll.py`

### Other components

- **HA user**
- **HA automations**
- **VK API**
- **HA event bus**

## Connections

- HA user → Integration setup: configures (evidence: `README.md`)
- Integration setup → VK API: validates token; lists chats (evidence: `custom_components/vk_notify/config_flow.py`)
- Integration setup → Entry lifecycle: creates entry (evidence: `custom_components/vk_notify/config_flow.py`)
- Entry lifecycle → Notify services: forwards notify platform (evidence: `custom_components/vk_notify/__init__.py`)
- Entry lifecycle → Long Poll manager: starts and stops (evidence: `custom_components/vk_notify/__init__.py`)
- HA automations → Notify services: calls services (evidence: `README.md`)
- Notify services → Message operations: dispatches operations (evidence: `README.md`)
- Notify services → Chat and profile ops: dispatches operations (evidence: `README.md`)
- Message operations → Text formatting: formats text (evidence: `custom_components/vk_notify/notify.py`)
- Message operations → Media uploads: uploads media (evidence: `custom_components/vk_notify/notify.py`)
- Notify services → VK API: sends API requests (evidence: `custom_components/vk_notify/notify.py`)
- Media uploads → VK API: uploads and saves media (evidence: `custom_components/vk_notify/helpers.py`)
- Chat and profile ops → VK API: requests operations (evidence: `custom_components/vk_notify/notify.py`)
- Long Poll manager → VK API: polls and marks read (evidence: `custom_components/vk_notify/longpoll.py`)
- Long Poll manager → HA event bus: fires events (evidence: `custom_components/vk_notify/longpoll.py`)
- API configuration → Notify services: provides API constants (evidence: `custom_components/vk_notify/notify.py`)
- API configuration → Long Poll manager: provides poll constants (evidence: `custom_components/vk_notify/longpoll.py`)
