SunSetup Planner is a Streamlit app that helps people who work or study in front of a screen decide where to place a desk and monitor inside a room to reduce probable screen glare, direct solar heat, and poor daylight ergonomics.
The goal is practical guidance, not fake precision. The model is deliberately transparent: rectangular room in plan view, one main window, one desk, one monitor, real solar position, and human-readable heuristics for glare, heat, and comfort.
You describe a room, place the window, desk, and monitor, and the app tells you when that setup is comfortable and how to improve it.
Many home-office setups fail in very predictable ways:
- a west-facing room feels fine at noon and terrible at 18:00
- a desk looks well placed until the sun hits the monitor directly
- natural light helps in one season and becomes uncomfortable in another
This project turns those tradeoffs into a simple, explainable planning tool.
- Resolves a location by city or manual latitude/longitude.
- Computes solar position across the day with
pvlib. - Estimates when the sun can enter through the main window.
- Flags likely glare on the screen, direct sun on the desk, and ergonomic issues.
- Builds a recommended variant by testing small desk and monitor adjustments.
- Shows a daily timeline, a 2D room plan, a comfort breakdown, a seasonal summary, and a current-vs-recommended comparison.
- Uses Open-Meteo when forecast data is available and falls back to a theoretical clear-sky model when it is not.
- Includes an in-app language switch so the public app can be used in Spanish or English.
- People setting up a home office or study space.
- Users comparing room layouts before moving furniture.
- Anyone who wants a reasonable daylight and glare check without learning a CAD or lighting-simulation tool.
- A visual 2D editor of the room.
- A daily risk timeline across the selected date.
- A current-layout score for glare, heat, and ergonomics.
- A recommended alternative layout when the current one can be improved.
- A short diagnosis in plain language to explain the main problem.
- The main panel starts with an interactive 2D floor-plan editor.
- Users can drag the desk and monitor, rotate them with on-canvas handles, move the window along its wall, and resize the window width.
- The sidebar is reserved for location, date, weather, presets, and advanced numeric fallback controls.
- The analysis reruns when the gesture is committed, not on every drag frame.
- The result charts are intentionally static to avoid confusing less technical users with zoom, pan, or toolbar controls.
- Open the app and choose the interface language.
- Enter your city, or type the latitude and longitude manually.
- Set the room size and place the main window on the correct wall.
- Move and rotate the desk and monitor in the editor until they roughly match the real room.
- Pick the date you care about most, for example a summer afternoon or winter morning.
- Press
Update analysisto compute the results. - Read the diagnosis, timeline, and comparison panels.
- If the app proposes a better layout, compare it with your current one and decide whether the suggested movement is realistic in your room.
comfort_score: overall convenience of the setup for the selected day.glare_score: risk of reflections or uncomfortable backlighting on the screen.heat_score: risk of direct solar exposure on the desk area.ergonomic_score: daylight orientation and monitor/desk placement quality.Current vs recommended: the most practical summary if you only want to know whether moving the setup is worth it.
This is a planning tool, not a scientific certification. A result is most useful as a comparative guide between two or three plausible layouts.
- Rectangular room.
- One main window in the UI.
- One desk and one monitor.
- One detailed day analysis plus a simple seasonal summary.
- Heuristic geometry, not scientific optical simulation.
python -m venv .venv
# Windows PowerShell: .venv\Scripts\Activate.ps1
# Linux/macOS: source .venv/bin/activate
pip install -r requirements.txt
streamlit run streamlit_app.pyRecommended target runtime: Python 3.11+. The project was verified in this workspace with Python 3.12 and keeps the code compatible with Python 3.11 features.
For local development, install the development tools as well:
pip install -r requirements-dev.txtIf you are on Windows PowerShell, a typical first run looks like this:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
streamlit run streamlit_app.pypython -m pytestpython -m ruff check .
python -m ruff format . --check
python -m pyright
python -m pip_audit --localpyright is configured to use the project-local .venv and the repository root as the import base for app.*.
pyrightThe app includes structured console logging designed to work well both locally and on Streamlit Community Cloud.
Environment variables:
SUNSETUP_LOG_LEVEL- default:
INFO - supported values:
DEBUG,INFO,WARNING,ERROR
- default:
SUNSETUP_LOG_TIMINGS- optional flag for more timing-oriented diagnostics
SUNSETUP_DEBUG_CANDIDATES- optional flag to show recommendation candidate improvements in
DEBUG
- optional flag to show recommendation candidate improvements in
Example:
SUNSETUP_LOG_LEVEL=DEBUG streamlit run streamlit_app.pyExample log line:
2026-03-18 13:10:02 INFO app.services.analysis event=analysis_completed comfort_score=71.2 glare_score=48.0 heat_score=33.1 duration_ms=184.0
streamlit_app.py
app/
domain/
services/
ui/
utils/
tests/
assets/
.streamlit/config.toml
requirements.txt
requirements-dev.txt
.github/
README.md
LICENSE
- Python
- Streamlit
- Plotly
- pandas
- numpy
- pvlib
Development tooling:
- pytest
- Ruff
- Pyright
- pip-audit
Weather HTTP access uses Python's standard-library urllib, while Streamlit still brings its own transitive networking dependencies.
- Production dependencies are pinned in
requirements.txt; development-only tools live inrequirements-dev.txt, so Streamlit Community Cloud installs a smaller runtime dependency set. - No secrets are required for the default public app. If secrets are added later, keep
.streamlit/secrets.tomland.env*files out of git and use Streamlit Community Cloud's app settings. - Dependabot is configured for Python dependencies and GitHub Actions in
.github/dependabot.yml. - The GitHub Actions security workflow runs Ruff, Pyright, pytest, Dependency Review on pull requests, and
pip-auditon the installed dependency environment. - Keep these GitHub repository settings enabled: Dependency Graph, Dependabot alerts, Dependabot security updates, code scanning default setup, and secret scanning/push protection when available for the repo.
- The room is represented in 2D with a rectangular footprint and one main window attached to a wall.
- The sun position is computed for each 15-minute slot of the selected day.
- A simplified 3D ray is projected from the window into the room.
- The app checks whether that ray reaches the desk plane, the monitor plane, or a backlighting condition near the user's line of sight.
- It scores:
glare_score: likely screen reflection or bad backlighting.heat_score: direct solar exposure on desk/work zone, modulated by weather when available.ergonomic_score: poor daylight orientation, monitor/desk misalignment, and eye-height mismatch.
- A composite
comfort_scoreis derived from those risks.
Weights used in the MVP:
- Glare:
0.45 - Heat:
0.35 - Ergonomics:
0.20
- No secrets are required.
- No private APIs or paid services are required.
- Open-Meteo is optional and used opportunistically.
- The app remains usable if weather lookups fail.
- The interactive editor is a local Streamlit custom component shipped inside the repo.
- The public UI supports both Spanish and English with an in-app language switch.
- Push this repo to GitHub.
- Create a new app in Streamlit Community Cloud.
- Select the repository, branch, and
streamlit_app.pyas the entrypoint. - In Advanced settings, choose the same Python version used locally. This project is verified with Python
3.12. - Deploy without secrets.
- If Open-Meteo is temporarily unavailable, the app will fall back to the theoretical clear-sky mode automatically.
Deployment notes:
requirements.txtis already in the repository root, which is the expected location for this project layout..streamlit/config.tomlis already in the repository root, which is the correct location for Streamlit app configuration.- No
packages.txtis required for the current dependency set. - No secrets are required for the default public deployment.
- Only
requirements.txtis used for the deployed app.requirements-dev.txtis for local checks and GitHub Actions.
- The model uses heuristics and simplified geometry.
- It does not simulate blinds, curtains, neighboring buildings, deep shading, or multiple reflections.
- The seasonal summary is based on representative dates and theoretical sky assumptions.
- One main window is exposed in the current UI.
- The weather integration only uses forecast data when the selected date is inside the available horizon.
- The editor is 2D only in this MVP. There is no 3D scene or live optical path tracing.
- Multiple windows and wall openings.
- Window height and sill as editable user inputs.
- Blinds and shading presets.
- Better seasonal comparison across custom date ranges.
- Exportable scenario reports.
- Saved scenarios and shareable links.
See assets/README.md for placeholder names to replace with real captures.
SunSetup Planner ayuda a decidir dónde colocar mesa y monitor dentro de una habitación para reducir reflejos en pantalla, calor solar directo y configuraciones incómodas respecto a la luz natural.
- Entrada por ciudad o latitud/longitud.
- Editor 2D para mover ventana, mesa y monitor.
- Análisis detallado de un día en intervalos de 15 minutos.
- Resumen estacional simple.
- Comparador entre configuración actual y recomendada.
- Plano 2D, timeline y recomendaciones accionables.
- Selector visible de idioma entre español e inglés.
- Indica ciudad o coordenadas.
- Dibuja la habitación en el editor y coloca ventana, mesa y monitor.
- Elige fecha.
- Pulsa
Update analysis. - Revisa diagnóstico, timeline y propuesta recomendada.
No es una simulación física exhaustiva. Es un modelo geométrico razonable, explicable y honesto para tomar mejores decisiones domésticas o de teletrabajo.
pip install -r requirements.txt
streamlit run streamlit_app.py
pytest