# lausiv1024/aircondcontrol architecture

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

- Interactive diagram: https://gitdiagram.com/lausiv1024/aircondcontrol
- Repository: https://github.com/lausiv1024/aircondcontrol

## Overview

##### Project Type & Purpose
- This project is a suite of components aimed at analyzing infrared (IR) signals and controlling air conditioners. It includes a web-based interface, command‐line utilities for IR signal generation and data collection, and shared libraries for managing IR formats.

##### Analyzing the File Structure
- There are multiple solutions:
- AEHAFmtSender: Contains a web client (with Blazor/Razor pages such as MainLayout.razor and Pages like AircondControl.razor) along with backend components (e.g. IRFormats, RPi/PWMSender for physical signal transmission) indicating the core application.
- AircondSignalGen: A utility project that likely generates the IR control codes.
- ByteDatagetter: Another tool possibly used for capturing or processing data bytes from remote signals.
- In addition, folders like “irCodes” hold raw IR signal text files and “Spesifications” (with Aircond.md) offer documentation on air conditioner specifications, serving as reference material.

##### Main Components
a. AEHAFmtSender Module:
- AEHAFmtSender.Client: The frontend web UI built with Razor/Blazor pages. This component lets the user interact with the system.
- AEHAFmtSender (Backend): Contains business logic, shared IR format code (in the IRFormats folder), and startup/configuration (Program.cs). It handles commands coming from the front end.
- RPi/PWMSender: A submodule under the AEHAFmtSender backend that deals with sending commands via PWM to physical hardware (likely running on a Raspberry Pi).

b. AircondSignalGen:
- A separate service/utility that generates IR signals (as evidenced by files like NP081.cs and RemoteControlBase.cs). This can be visualized as an independent tool that contributes to the overall IR command generation.

c. ByteDatagetter:
- Another independent utility for data collection or IR signal byte processing.

d. External Data/Specifications:
- The “irCodes” folder serves as a repository of sample or actual IR command codes used by the system.
- The “Spesifications” folder provides the technical and functional guidance for interfacing with the air conditioner.

##### Relationships and Interactions
- The user interacts with the AEHAFmtSender.Client (web UI) which issues control commands.
- These commands flow through the AEHAFmtSender backend, which may consult shared libraries (IRFormats) to interpret and format commands appropriately.
- The RPi/PWMSender module is responsible for translating these commands into physical IR signals that control the air conditioner.
- Meanwhile, AircondSignalGen can be used to generate or validate these IR control signals independently.
- ByteDatagetter might be integrated in scenarios where the system requires monitoring or logging of IR signal data.
- The “irCodes” repository provides the raw command configurations that may be referenced by both the main backend processing and the standalone tools.

##### Architectural Patterns & Design Principles
- Modular Separation: The system is split into distinct projects, each handling a dedicated responsibility (UI, signal generation, data collection).
- Clear API/Communication Channels: While the AEHAFmtSender client and backend work together for live control, the command-line tools are kept separate for offline processing or signal generation.
- Use of Shared Libraries: Common functionality related to IR control (e.g., NP081Model, IRFormats) is centralized to promote code reuse.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U("User"):::external
    U -->|"interacts"| AEFMT["AEHAFmtSender Client (Web UI)"]:::client

    AEFMT -->|"issues_command"| BE

    subgraph "AEHAFmtSender Backend"
        BE["AEHAFmtSender Backend"]:::backend
        IRFL["IRFormats Library"]:::lib
        RPI["RPi Module (Hardware PWM Signal Sender)"]:::hardware
        BE -->|"uses"| IRFL
        BE -->|"sends_to"| RPI
    end

    BE -->|"references"| IRCR

    subgraph "External Resources"
        IRCR["IR Codes Repository"]:::external
        SPEC["Specifications"]:::external
        IRCR -->|"refers_to"| SPEC
    end

    ASG["AircondSignalGen Utility"]:::utility
    BD["ByteDatagetter Utility"]:::utility
    ASG -->|"refers_IR_codes"| IRCR
    BD -->|"refers_IR_codes"| IRCR

    click AEFMT "https://github.com/lausiv1024/aircondcontrol/blob/main/AEHAFmtSender/AEHAFmtSender/AEHAFmtSender.Client"
    click BE "https://github.com/lausiv1024/aircondcontrol/tree/main/AEHAFmtSender/AEHAFmtSender/AEHAFmtSender"
    click IRFL "https://github.com/lausiv1024/aircondcontrol/tree/main/AEHAFmtSender/AEHAFmtSender/AEHAFmtSender/IRFormats"
    click RPI "https://github.com/lausiv1024/aircondcontrol/tree/main/AEHAFmtSender/AEHAFmtSender/AEHAFmtSender/RPi"
    click ASG "https://github.com/lausiv1024/aircondcontrol/tree/main/AircondSignalGen/AircondSignalGen"
    click BD "https://github.com/lausiv1024/aircondcontrol/tree/main/ByteDatagetter/ByteDatagetter"
    click IRCR "https://github.com/lausiv1024/aircondcontrol/tree/main/irCodes"
    click SPEC "https://github.com/lausiv1024/aircondcontrol/tree/main/Spesifications"

    classDef client fill:#f9e79f,stroke:#b9770e,stroke-width:2px;
    classDef backend fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef lib fill:#f0e68c,stroke:#b8860b,stroke-width:2px;
    classDef hardware fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef utility fill:#fadbd8,stroke:#c0392b,stroke-width:2px;
    classDef external fill:#d6eaf8,stroke:#2980b9,stroke-width:2px;
```
