Table of Contents
| Module | Repository | README | License |
|---|---|---|---|
| Project overview | |||
| Cloudflare | |||
| Server | |||
| Microcontroller (ESP32) | |||
| Client |
You can get information about the project on the official website.
If you want to get the system up and running as quickly as possible, consider following the guide.
Alternatively, you can follow the free deployment roadmap.
This roadmap provides the essential steps to get EHSS running.
- Use MQTT broker of your choice or self-host Mosquitto.
- Create three sets of credentials (with Pub/Sub permissions) for:
Server,ESP32, andClient. - Note your Broker URL and Port.
- Create a static "Offline" page repo on GitHub.
- Create a new DNS record (CNAME) in Cloudflare for
username.github.io - Create new DNS records (A) on domain registrar page following the GitHub docs.
- Adjust the configuration file (
wrangler.toml) by modifying the following fields. - Deploy the worker via Wrangler.
- Adjust the configuration file (
wrangler.toml) by modifying the following fields. - Adjust the
build_offline_page()function in theindex.jsfile to customize the page. - Deploy the worker via Wrangler.
- Adjust the configuration file (
config.py) by modifying the following fields. - Deploy via Docker:
sudo docker-compose up -d --build --force-recreate.
- Use Arduino IDE with ESP32 board support.
- Install the required libraries.
- Adjust the configuration file (
config.cpp) by modifying the following fields. - Upload the firmware to the microcontroler.
- Make sure you have required software installed on the PC.
- Adjust the configuration file (
config.py) by modifying the following fields.
- Make sure you have required software installed on the VM.
- Adjust the configuration file (
config.py) by modifying the following fields. - Initialize Buildozer.
- Adjust the Buildozer configuration file (
buildozer.spec) by modifying the following fields. - Build the Android APK
buildozer -v android debug.
- Remote shutdown of the server
- Remote wake-up of the server
- Real-time status monitoring (via TCP port checks and heartbeats)
- TLS support
- Cross-platform client (Windows, Android)
- Works behind CGNAT (no public IP required)
Before starting, make sure you have access to the following components and tools:
- MQTT broker
- Cloudflare account
- GitHub account
- Linux server with static IP
- Linux VM
- ESP32 microcontroller
- Client device
- PC with Windows
- (optional) Android phone
Depending on which components you deploy, you may need the following tools:
| Device | Tool |
|---|---|
| Server | Docker |
| Docker Compose | |
| PC | Python 3.10+ |
| git | |
| pip | |
| Arduino IDE | |
| VM | ADB |
| npm | |
| openjdk 17 | |
| buildozer |
| Library | Author |
|---|---|
| ArduinoJson | Benoit Blanchon |
| LibSSH-ESP32 | Ewan Parker |
| PubSubClient | Nick O'Leary |
| WakeOnLan | a7md0 |
- Receives MQTT commands (all topics)
- Receives MQTT messages (all topics)
- Routes MQTT commands (all topics)
- Routes MQTT messages (all topics)
- Routes traffic when the server is down
(no redirects — the user stays on the same URL) - Displays a static "Server is offline" page
- Receives MQTT commands
(TOPIC_SYSTEM) - Sends MQTT messages
(TOPIC_HEARTBEAT) - Executes server shutdown
- Receives MQTT messages
(TOPIC_CONTROL,TOPIC_HEARTBEAT) - Sends MQTT commands
(TOPIC_SYSTEM) - Sends MQTT messages
(TOPIC_STATE,TOPIC_ESP32_STATE) - Sends WOL magic packets to start the server
- Monitors server state via TCP port checks
- Switches the Cloudflare Worker mode
- Receives MQTT messages
(TOPIC_STATE,TOPIC_ESP32_STATE) - Sends MQTT messages
(TOPIC_CONTROL) - Opens an SSH window on Windows (LAN)
- Cloud broker: HiveMQ Cloud
(Free “Serverless” option) - Separate users for server, ESP32, and client
- Worker name:
offline-mode
- OS: Ubuntu Server 24.04.3 LTS
- Kernel: GNU/Linux 6.8.0-101-generic x86_64
- Model: ESP32-C3-MINI-1
- OS: Windows 10 21H2
- Python: 3.13.7
- OS: Android 16
- OS: Ubuntu Desktop 24.04.4 LTS
| Topic | Publisher | Subscriber(s) | Usage | Supported messages (Payloads) |
|---|---|---|---|---|
| TOPIC_CONTROL | Client | Microcontroller | Sending on/off commands | ON OFF |
| TOPIC_SYSTEM | Microcontroller | Server | Sending system commands | SHUTDOWN |
| TOPIC_HEARTBEAT | Server | Microcontroller | Sending server state | ALIVE DEAD |
| TOPIC_STATE | Microcontroller | Client | Announcing server state | STARTING ONLINE SHUTTING_DOWN OFFLINE |
| TOPIC_ESP32_STATE | Microcontroller | Client | Announcing microcontroller state | ONLINE OFFLINE |
| Topic | Message (Payload) | Meaning | Retained? |
|---|---|---|---|
| TOPIC_CONTROL | ON | Server start request | No |
| OFF | Server shutdown request | No | |
| TOPIC_SYSTEM | SHUTDOWN | Server shutdown command | No |
| TOPIC_HEARTBEAT | ALIVE | Server is active | Yes |
| DEAD | Server is not active | Yes | |
| TOPIC_STATE | STARTING | Server is starting | Yes |
| ONLINE | Server is responding | Yes | |
| SHUTTING_DOWN | Server is shutting down | Yes | |
| OFFLINE | Server is not responding | Yes | |
| TOPIC_ESP32_STATE | ONLINE | ESP32 is active | Yes |
| OFFLINE | ESP32 is not active | Yes |








