# yasnxx/home-assistant-mqtt-assignment architecture

> Architecture diagram of the GitHub repository yasnxx/home-assistant-mqtt-assignment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yasnxx/home-assistant-mqtt-assignment
- Repository: https://github.com/yasnxx/home-assistant-mqtt-assignment

## Overview

This small project publishes a fixed JSON sensor payload every five seconds. The user starts the Python publisher, which sends retained MQTT messages to Mosquitto; Home Assistant reads the topic through an MQTT sensor. The publisher-to-broker interaction is visible in source. The README documents the broker and sensor workflow, but Home Assistant configuration is not present in the repository.

Main entry points: [`mqtt_publish.py`](https://github.com/yasnxx/home-assistant-mqtt-assignment/blob/main/mqtt_publish.py) (MQTT Publisher)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_publisher["MQTT Publisher<br/>[mqtt_publish.py]"]
node_broker["Mosquitto Broker"]
node_sensor["Home Assistant Sensor"]

node_user -->|"runs"| node_publisher
node_publisher -->|"publishes payload"| node_broker
node_broker -->|"provides messages"| node_sensor

click node_publisher "https://github.com/yasnxx/home-assistant-mqtt-assignment/blob/main/mqtt_publish.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_user toneBlue
class node_publisher toneTeal
class node_broker,node_sensor toneIndigo
```

## Components

### Other components

- **User**
- [MQTT Publisher](https://github.com/yasnxx/home-assistant-mqtt-assignment/blob/main/mqtt_publish.py): `mqtt_publish.py`
- **Mosquitto Broker**
- **Home Assistant Sensor**

## Connections

- User → MQTT Publisher: runs (evidence: `README.md`)
- MQTT Publisher → Mosquitto Broker: publishes payload (evidence: `mqtt_publish.py`)
- Mosquitto Broker → Home Assistant Sensor: provides messages (evidence: `README.md`)
