# fustcoma/pi-weather architecture

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

- Interactive diagram: https://gitdiagram.com/fustcoma/pi-weather
- Repository: https://github.com/fustcoma/pi-weather

## Overview

π Weather is a Raspberry Pi weather station that measures temperature, humidity, heat sensation, and estimated wind speed, then publishes readings for a web dashboard. Its main workflow is sensor acquisition, interval aggregation and calculation, local current/history file updates, periodic GitHub push, and browser refresh of current values and charts. The graph includes the anemometer counting/calculation layer and the documented web display capabilities. README statements support the broader deployment and dashboard links; source excerpts show the measurement, persistence, and push calls. Unexcerpted HTML and deployment details are represented only at the documented level.

Main entry points: [`temperatura.py`](https://github.com/fustcoma/pi-weather/blob/main/temperatura.py) (Measurement loop), [`script.js`](https://github.com/fustcoma/pi-weather/blob/main/script.js) (Data loading and refresh), [`index.html`](https://github.com/fustcoma/pi-weather/blob/main/index.html) (Dashboard interface), [`anemometre.py`](https://github.com/fustcoma/pi-weather/blob/main/anemometre.py) (Wind pulse counter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensor acquisition"]
  node_wind["Wind pulse counter<br/>[anemometre.py]"]
end

subgraph group_processing["Measurement processing"]
  node_measure["Measurement loop<br/>[temperatura.py]"]
  node_aggregation["Averages and sensation<br/>[temperatura.py]"]
end

subgraph group_publishing["Data publishing"]
  node_current["Current readings<br/>[pi.txt]"]
  node_history["Measurement history<br/>[historial.csv]"]
  node_gitpush["Git commit and push<br/>[temperatura.py]"]
end

subgraph group_dashboard["Web dashboard"]
  node_page["Dashboard interface<br/>[index.html]"]
  node_browserlogic["Data loading and refresh<br/>[script.js]"]
  node_charts["Weather charts<br/>[script.js]"]
end

node_dht(("DHT11"))
node_reed(("Reed switch"))
node_station(("Raspberry Pi"))
node_github["GitHub repository"]
node_pages["GitHub Pages"]
node_chartjs["Chart.js"]
node_visitor(("Web visitor"))

node_station -->|"runs"| node_measure
node_dht -->|"provides readings"| node_measure
node_reed -->|"signals pulses"| node_wind
node_measure -->|"reads and calculates"| node_wind
node_measure -->|"collects readings"| node_aggregation
node_aggregation -->|"writes latest"| node_current
node_aggregation -->|"appends measurement"| node_history
node_measure -->|"invokes periodically"| node_gitpush
node_gitpush -->|"pushes files"| node_github
node_github -->|"publishes site"| node_pages
node_pages -->|"serves dashboard"| node_page
node_visitor -->|"opens site"| node_pages
node_page -->|"uses dashboard script"| node_browserlogic
node_browserlogic -->|"fetches current data"| node_current
node_browserlogic -->|"fetches history"| node_history
node_browserlogic -->|"updates charts"| node_charts
node_charts -->|"renders with"| node_chartjs

click node_wind "https://github.com/fustcoma/pi-weather/blob/main/anemometre.py"
click node_measure "https://github.com/fustcoma/pi-weather/blob/main/temperatura.py"
click node_aggregation "https://github.com/fustcoma/pi-weather/blob/main/temperatura.py"
click node_current "https://github.com/fustcoma/pi-weather/blob/main/pi.txt"
click node_history "https://github.com/fustcoma/pi-weather/blob/main/historial.csv"
click node_gitpush "https://github.com/fustcoma/pi-weather/blob/main/temperatura.py"
click node_page "https://github.com/fustcoma/pi-weather/blob/main/index.html"
click node_browserlogic "https://github.com/fustcoma/pi-weather/blob/main/script.js"
click node_charts "https://github.com/fustcoma/pi-weather/blob/main/script.js"

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_wind toneBlue
class node_measure,node_aggregation toneAmber
class node_current,node_history,node_gitpush toneMint
class node_page,node_browserlogic,node_charts toneRose
class node_dht,node_reed,node_station,node_github,node_pages,node_chartjs,node_visitor toneIndigo
```

## Components

### Sensor acquisition

- [Wind pulse counter](https://github.com/fustcoma/pi-weather/blob/main/anemometre.py): `anemometre.py`

### Measurement processing

- [Measurement loop](https://github.com/fustcoma/pi-weather/blob/main/temperatura.py): `temperatura.py`
- [Averages and sensation](https://github.com/fustcoma/pi-weather/blob/main/temperatura.py): `temperatura.py`

### Data publishing

- [Current readings](https://github.com/fustcoma/pi-weather/blob/main/pi.txt): `pi.txt`
- [Measurement history](https://github.com/fustcoma/pi-weather/blob/main/historial.csv): `historial.csv`
- [Git commit and push](https://github.com/fustcoma/pi-weather/blob/main/temperatura.py): `temperatura.py`

### Web dashboard

- [Dashboard interface](https://github.com/fustcoma/pi-weather/blob/main/index.html): `index.html`
- [Data loading and refresh](https://github.com/fustcoma/pi-weather/blob/main/script.js): `script.js`
- [Weather charts](https://github.com/fustcoma/pi-weather/blob/main/script.js): `script.js`

### Other components

- **DHT11**
- **Reed switch**
- **Raspberry Pi**
- **GitHub repository**
- **GitHub Pages**
- **Chart.js**
- **Web visitor**

## Connections

- Raspberry Pi → Measurement loop: runs (evidence: `README.md`)
- DHT11 → Measurement loop: provides readings (evidence: `README.md`)
- Reed switch → Wind pulse counter: signals pulses (evidence: `README.md`)
- Measurement loop → Wind pulse counter: reads and calculates (evidence: `temperatura.py`)
- Measurement loop → Averages and sensation: collects readings (evidence: `temperatura.py`)
- Averages and sensation → Current readings: writes latest (evidence: `temperatura.py`)
- Averages and sensation → Measurement history: appends measurement (evidence: `temperatura.py`)
- Measurement loop → Git commit and push: invokes periodically (evidence: `temperatura.py`)
- Git commit and push → GitHub repository: pushes files (evidence: `temperatura.py`)
- GitHub repository → GitHub Pages: publishes site (evidence: `README.md`)
- GitHub Pages → Dashboard interface: serves dashboard (evidence: `README.md`)
- Web visitor → GitHub Pages: opens site (evidence: `README.md`)
- Dashboard interface → Data loading and refresh: uses dashboard script (evidence: `README.md`)
- Data loading and refresh → Current readings: fetches current data (evidence: `script.js`)
- Data loading and refresh → Measurement history: fetches history (evidence: `script.js`)
- Data loading and refresh → Weather charts: updates charts (evidence: `README.md`)
- Weather charts → Chart.js: renders with (evidence: `README.md`)
