# touero/havacation architecture

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

- Interactive diagram: https://gitdiagram.com/touero/havacation
- Repository: https://github.com/touero/havacation

## Overview

##### Project Type and Purpose
- HaVacation is a custom Home-Assistant integration that provides sensors for workdays and vacations based on the Chinese calendar.
- The integration supplies 1–3 sensors (as described in the README) that expose attributes like “Is workday”, “Is vacation”, and “UpdatedAt”.
- It leverages Home-Assistant’s custom component architecture and integrates with Home-Assistant’s configuration flow and sensor ecosystem.

##### File Structure and Main Components
- custom_components/ha_vacation:
- __init__.py: Initializes the integration.
- config_flow.py: Manages the Home-Assistant UI integration setup (the configuration flow).
- sensor.py: Implements one or more sensor entities that provide the workday/vacation data.
- ha_vacation_date.py: Likely contains the logic for computing dates based on the Chinese calendar.
- constants.py / const.py: Define key constants used across the integration.
- manifest.json: Informs Home-Assistant about the integration, its dependencies, and configuration requirements.
- tests: Contains unit and integration tests verifying the integration’s functionality.
- Additional files (requirements.txt, setup.cfg, etc.) support dependency management and package configuration.
- .github and related files: Define CI workflows for testing, linting, releases, etc.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    HA["Home-Assistant Platform"]:::ha

    %% HaVacation Integration Subgraph
    subgraph "HaVacation Integration"
        direction TB
        INIT["Integration Initialization (__init__.py)"]:::internal
        CF["Configuration Flow (config_flow.py)"]:::internal
        SENSOR["Sensor Component (sensor.py)"]:::internal
        DATE["Date Logic Module (ha_vacation_date.py)"]:::internal
        CONST1["Constant (const.py)"]:::internalSmall
        CONST2["Constants (constants.py)"]:::internalSmall
        MANIFEST["Manifest (manifest.json)"]:::internalSmall
    end

    %% External Dependency
    LIB["chinese-calendar Library"]:::externalLib

    %% CI/CD and Testing
    CICD["CI/CD Pipeline (.github/workflows)"]:::ci
    TEST["Testing Suite (tests)"]:::test

    %% Relationships
    HA -->|"loads"| MANIFEST
    MANIFEST -->|"initializes"| INIT
    HA -->|"triggers"| CF
    CF -->|"sets up"| SENSOR
    SENSOR -->|"calls"| DATE
    SENSOR -->|"reads"| CONST1
    SENSOR -->|"reads"| CONST2
    DATE ---|"utilizes"| LIB

    CICD ---|"validates"| INIT
    CICD ---|"validates"| CF
    CICD ---|"validates"| SENSOR
    CICD ---|"validates"| DATE

    TEST ---|"tests"| INIT
    TEST ---|"tests"| CF
    TEST ---|"tests"| SENSOR
    TEST ---|"tests"| DATE

    %% Click Events
    click HA "https://github.com/touero/havacation/tree/main/custom_components/ha_vacation"
    click INIT "https://github.com/touero/havacation/blob/main/custom_components/ha_vacation/__init__.py"
    click CF "https://github.com/touero/havacation/blob/main/custom_components/ha_vacation/config_flow.py"
    click SENSOR "https://github.com/touero/havacation/blob/main/custom_components/ha_vacation/sensor.py"
    click DATE "https://github.com/touero/havacation/blob/main/custom_components/ha_vacation/ha_vacation_date.py"
    click CONST1 "https://github.com/touero/havacation/blob/main/custom_components/ha_vacation/const.py"
    click CONST2 "https://github.com/touero/havacation/blob/main/custom_components/ha_vacation/constants.py"
    click MANIFEST "https://github.com/touero/havacation/blob/main/custom_components/ha_vacation/manifest.json"
    click CICD "https://github.com/touero/havacation/tree/main/.github/workflows"
    click TEST "https://github.com/touero/havacation/tree/main/tests"

    %% Styles
    classDef ha fill:#ccffeb,stroke:#006644,stroke-width:2px;
    classDef internal fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef internalSmall fill:#e6ecff,stroke:#002752,stroke-width:1px;
    classDef externalLib fill:#fff2cc,stroke:#a67c00,stroke-width:2px;
    classDef ci fill:#fbd3ff,stroke:#d63384,stroke-width:2px;
    classDef test fill:#d1e7dd,stroke:#0f5132,stroke-width:2px;
```
