# andresricom/axol_pairing architecture

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

- Interactive diagram: https://gitdiagram.com/andresricom/axol_pairing
- Repository: https://github.com/andresricom/axol_pairing

## Overview

Based on an analysis of the provided file tree and README, this project appears to be an embedded IoT system designed for a “home hub” that manages and pairs with a variety of sensors (bucket, tank, and water quality). Its purpose, as hinted by the README title (“Axol Pairing Protocols”), is to establish communication protocols and pairing procedures between a central home hub device and multiple sensor nodes. The project is structured as multiple PlatformIO projects where the main “homehub” unit contains extensive libraries for animations, a captive portal (for configuration), various global utilities (such as time synchronization and weather location), and request modules that manage data exchange (climate data, sensor data, system statistics, etc.). Meanwhile, each sensor type is organized in its own directory under “sensors,” with its independent source, configuration, and testing setup.

##### Main Components
- Homehub Central Unit:
- Modules include:
- Animations: Contains bitmap definitions and drawing routines (e.g., cloud, sun, storm, axol animations).
- Captive Portal: Organized under “include/captiveportal” with controllers, pages, and route definitions, which implies a web-based or local configuration interface.
- Globals: Manages system-wide variables and functions (management, time server, weather location).
- Requests: Handles external API or inter-module communications (climate, homehub-specific, system statistics, sensor data, etc.).
- Core source: Located in “src” for main execution and processing.
- Technologies/Frameworks: Embedded C/C++ with PlatformIO for microcontroller development.
- Sensor Nodes (Peripheral Devices):
- Three sensor subsystems identified:
- Bucket Sensor (sensors/bucket_sensor)
- Tank Sensor (sensors/tank_sensor)
- Water Quality Sensor (sensors/water_quality_sensor)
- Each sensor node is an independent project with its own PlatformIO configuration, source code, and tests.
- Likely responsibilities include capturing sensor-specific data and possibly reporting to the Homehub.

##### Relationships and Interactions
- Data Flow Between Components:
- Sensor nodes gather environmental measurements and transmit sensor readings to the central homehub.
- The homehub aggregates this data and may use it to update display animations or trigger actions via its captive portal.
- Communication Channels:
- There might be bidirectional communication (configuration commands and status updates) facilitated via the captive portal.
- Global modules (timeserver, weather location) indicate integration with external services (data fetching, synchronization).
- Architectural Boundaries:
- Clearly separate the homehub core functions (UI, data aggregation, configuration) from the sensor acquisition modules.
- Demonstrate the independence of the sensor projects (each as a distinct microcontroller firmware) while highlighting their coordinated operation with the central unit.

##### Architectural Patterns and Design Principles
- Modularity: The project components (animations, captive portal, global utilities, request modules) are distinctly separated to promote reusability and easier maintenance.
- Separation of Concerns: Clearly defined responsibilities between the central hub and sensor nodes.
- Embedded System Design: Use of PlatformIO and organization of code into “src,” “include,” and “lib” directories implies standard embedded development practices.
- Event/Data-Driven Communication: Likely designed around real-time data collection from sensors and updating the homehub state accordingly.

##### Relevant Technologies, Frameworks, or Libraries
- PlatformIO for project building and microcontroller development.
- Embedded C/C++ libraries for animations and sensor interfacing.
- Possibly custom or third-party libraries for network communications (for captive portal and external requests).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Homehub Central Unit Subgraph
    subgraph "Homehub Central Unit"
        H1("Core Execution"):::homehub
        H2("Animations Module"):::homehub
        H3("Captive Portal Module"):::homehub
        H4("Global Utilities"):::homehub
        H5("Requests Subsystem"):::homehub
        H1 -.-> H2
        H1 -.-> H3
        H1 -.-> H4
        H1 -.-> H5
    end

    %% Sensor Nodes Subgraph
    subgraph "Sensor Nodes"
        S1("Bucket Sensor"):::sensor
        S2("Tank Sensor"):::sensor
        S3("Water Quality Sensor"):::sensor
    end

    %% External Services Node
    E1("External Services (Time/Weather)"):::external

    %% Data Flow from Sensor Nodes to Homehub Core Execution
    S1 -->|"data"| H1
    S2 -->|"data"| H1
    S3 -->|"data"| H1

    %% Communication from Homehub Global Utilities to External Services
    H4 -->|"sync"| E1

    %% Click Events
    click H1 "https://github.com/andresricom/axol_pairing/blob/main/homehub/src/main.cpp"
    click H2 "https://github.com/andresricom/axol_pairing/tree/main/homehub/include/animations"
    click H3 "https://github.com/andresricom/axol_pairing/tree/main/homehub/include/captiveportal"
    click H4 "https://github.com/andresricom/axol_pairing/tree/main/homehub/include/globals"
    click H5 "https://github.com/andresricom/axol_pairing/tree/main/homehub/include/requests"
    click S1 "https://github.com/andresricom/axol_pairing/tree/main/sensors/bucket_sensor"
    click S2 "https://github.com/andresricom/axol_pairing/tree/main/sensors/tank_sensor"
    click S3 "https://github.com/andresricom/axol_pairing/tree/main/sensors/water_quality_sensor"

    %% Styles
    classDef homehub fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef sensor fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef external fill:#f9844a,stroke:#333,stroke-width:2px;
```
