Espartan is a central management portal for ESP32-based smart thermostats and open-door sensors. It provides a user-friendly interface to provision, monitor, and control multiple devices from a single dashboard. It consists of a Python/FastAPI backend, MicroPython-based applications for the ESP32 devices, and a React frontend. It relies on the espark library for seamless communication between the frontend, backend, and the devices.
- Device Provisioning: Easily add new ESP32 devices to the system through a simple web interface.
- Telemetry Collection: Collect and visualise telemetry data from connected devices in real-time.
- Remote Control: Adjust thermostat settings and monitor door sensor status remotely.
- ESP32-C3 development board
- SHT20 temperature and humidity sensor
- Self-locking relay module
- Voltage divider for voltage measurement
- Battery
- ESP32-C3 development board
- Magnetic reed switch
- Active buzzer
- LD2420 human presence sensor
- Battery
Espartan/
├── Master/
│ ├── backend/ # FastAPI backend (Python)
│ │ ├── src/
│ │ │ ├── data/ # Models, repositories
│ │ │ ├── routers/ # API endpoints
│ │ │ ├── schedules/ # Scheduled tasks
│ │ │ ├── services/ # Business logic
│ │ │ ├── strategies/ # Device control strategies
│ │ │ ├── utils/ # Utility functions
│ │ │ └── main.py # Application entry point
│ │ ├── tests/ # Unit tests
│ │ └── Dockerfile # Backend containerisation
│ └── frontend/ # React frontend (TypeScript)
│ ├── public/ # Static assets
│ └── src/
│ └── index.tsx # Application entry point
├── Worker-Door/ # ESP32 door sensor application (MicroPython)
│ ├── src/
│ │ ├── configs.py # Application- and device-specific configurations
│ │ ├── secrets.py # Credentials and sensitive information
│ │ └── worker_node.py # Core application logic
│ ├── main.py # Application entry point
│ └── tests/ # Unit tests
└── Worker-Thermostat/ # ESP32 thermostat application (MicroPython)
├── src/
│ ├── configs.py # Application- and device-specific configurations
│ ├── secrets.py # Credentials and sensitive information
│ └── worker_node.py # Core application logic
├── main.py # Application entry point
└── tests/ # Unit tests
- Install dependencies:
cd Master/backend make venv source venv/bin/activate make upgrade
- Run server:
make
- Configuration:
Edit.envconfig files inMaster/backendas needed.
- Install dependencies:
cd Master/frontend pnpm i - Start development server:
pnpm start
- Install dependencies (only for development):
cd Worker-Door # or cd Worker-Thermostat make venv source venv/bin/activate make upgrade
- Configuration:
Adjust config files insrc/configs.pyas needed. - Flashing firmware:
make flash
- Deployment:
make deploy
- Build backend container:
cd Master make build - Run backend container:
make docker
- Publish image:
make publish