# frankcrispin/casa_termostato architecture

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

- Interactive diagram: https://gitdiagram.com/frankcrispin/casa_termostato
- Repository: https://github.com/frankcrispin/casa_termostato

## Overview

This is a browser-based smart-home simulation: users inspect a 3D house and adjust room and simulation controls; a Python server advances the home model and returns state to the interface. The model covers occupancy routines, comfort learning, heating and cooling, air quality, alerts, and history. The excerpts show the server routes and 3D interactions, but not the full page or all state-refresh wiring, so those relationships are kept narrow.

Main entry points: [`app.py`](https://github.com/frankcrispin/casa_termostato/blob/main/app.py) (Home state), [`static/casa3d.js`](https://github.com/frankcrispin/casa_termostato/blob/main/static/casa3d.js) (3D house view), [`index.html`](https://github.com/frankcrispin/casa_termostato/blob/main/index.html) (Web page), [`static/OrbitControls.js`](https://github.com/frankcrispin/casa_termostato/blob/main/static/OrbitControls.js) (Orbit controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["3D interface"]
  node_page["Web page<br/>[index.html]"]
  node_house_view["3D house view<br/>[casa3d.js]"]
end

subgraph group_server["HTTP server"]
  node_http_handler["HTTP routes<br/>[app.py]"]
  node_simulation_loop["Simulation loop<br/>[app.py]"]
end

subgraph group_simulation["Home simulation"]
  node_home_state[("Home state<br/>[app.py]")]
  node_occupancy_routine["Occupancy routines<br/>[app.py]"]
  node_comfort_model["Comfort learning<br/>[app.py]"]
  node_thermal_air["Thermal and air model<br/>[app.py]"]
  node_alerts_history["Alerts and history<br/>[app.py]"]
end

subgraph group_integrations["Rendering dependencies"]
  node_orbit_controls["Orbit controls<br/>[OrbitControls.js]"]
  node_three["Three.js"]
end

node_browser_user(("Home user"))

node_browser_user -.->|"uses"| node_page
node_http_handler -->|"serves"| node_page
node_page -.->|"hosts"| node_house_view
node_house_view -->|"imports"| node_orbit_controls
node_house_view -->|"imports"| node_three
node_orbit_controls -->|"imports"| node_three
node_browser_user -->|"interacts"| node_house_view
node_house_view -->|"posts controls"| node_http_handler
node_http_handler -->|"updates"| node_home_state
node_http_handler -->|"returns state"| node_home_state
node_simulation_loop -->|"advances"| node_home_state
node_home_state -->|"applies"| node_occupancy_routine
node_home_state -->|"trains and consults"| node_comfort_model
node_home_state -->|"simulates"| node_thermal_air
node_home_state -->|"records and checks"| node_alerts_history

click node_page "https://github.com/frankcrispin/casa_termostato/blob/main/index.html"
click node_house_view "https://github.com/frankcrispin/casa_termostato/blob/main/static/casa3d.js"
click node_orbit_controls "https://github.com/frankcrispin/casa_termostato/blob/main/static/OrbitControls.js"
click node_http_handler "https://github.com/frankcrispin/casa_termostato/blob/main/app.py"
click node_simulation_loop "https://github.com/frankcrispin/casa_termostato/blob/main/app.py"
click node_home_state "https://github.com/frankcrispin/casa_termostato/blob/main/app.py"
click node_occupancy_routine "https://github.com/frankcrispin/casa_termostato/blob/main/app.py"
click node_comfort_model "https://github.com/frankcrispin/casa_termostato/blob/main/app.py"
click node_thermal_air "https://github.com/frankcrispin/casa_termostato/blob/main/app.py"
click node_alerts_history "https://github.com/frankcrispin/casa_termostato/blob/main/app.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_page,node_house_view,node_browser_user toneBlue
class node_http_handler,node_simulation_loop toneAmber
class node_home_state,node_occupancy_routine,node_comfort_model,node_thermal_air,node_alerts_history toneMint
class node_orbit_controls,node_three toneRose
```

## Components

### 3D interface

- [Web page](https://github.com/frankcrispin/casa_termostato/blob/main/index.html): `index.html`
- [3D house view](https://github.com/frankcrispin/casa_termostato/blob/main/static/casa3d.js): `static/casa3d.js`

### HTTP server

- [HTTP routes](https://github.com/frankcrispin/casa_termostato/blob/main/app.py): `app.py`
- [Simulation loop](https://github.com/frankcrispin/casa_termostato/blob/main/app.py): `app.py`

### Home simulation

- [Home state](https://github.com/frankcrispin/casa_termostato/blob/main/app.py): `app.py`
- [Occupancy routines](https://github.com/frankcrispin/casa_termostato/blob/main/app.py): `app.py`
- [Comfort learning](https://github.com/frankcrispin/casa_termostato/blob/main/app.py): `app.py`
- [Thermal and air model](https://github.com/frankcrispin/casa_termostato/blob/main/app.py): `app.py`
- [Alerts and history](https://github.com/frankcrispin/casa_termostato/blob/main/app.py): `app.py`

### Rendering dependencies

- [Orbit controls](https://github.com/frankcrispin/casa_termostato/blob/main/static/OrbitControls.js): `static/OrbitControls.js`
- **Three.js**

### Other components

- **Home user**

## Connections

- Home user → Web page: uses
- HTTP routes → Web page: serves (evidence: `app.py`)
- Web page → 3D house view: hosts
- 3D house view → Orbit controls: imports (evidence: `static/casa3d.js`)
- 3D house view → Three.js: imports (evidence: `static/casa3d.js`)
- Orbit controls → Three.js: imports (evidence: `static/OrbitControls.js`)
- Home user → 3D house view: interacts (evidence: `static/casa3d.js`)
- 3D house view → HTTP routes: posts controls (evidence: `static/casa3d.js`)
- HTTP routes → Home state: updates (evidence: `app.py`)
- HTTP routes → Home state: returns state (evidence: `app.py`)
- Simulation loop → Home state: advances (evidence: `app.py`)
- Home state → Occupancy routines: applies (evidence: `app.py`)
- Home state → Comfort learning: trains and consults (evidence: `app.py`)
- Home state → Thermal and air model: simulates (evidence: `app.py`)
- Home state → Alerts and history: records and checks (evidence: `app.py`)
