This project should achieve the following things:
- Monitor a Linux client if it is reachable and or didn't freeze.
- If the client froze it should send an email notification.
- If the client froze it should cut its power supply shortly to force a reboot.
- ESP32
- Linux client e.g. Raspberry Pi 5
- TP-Link Tapo P110 (optional but required for full functionality)
- Docker installed on the client
- Working WLAN infrastructure
- Platformio
-
Make a git repository.
-
Connect to the ESP32 and check if it works.
-
Connect the ESP to the Wi-Fi.
-
IP address is reachable form another device
-
Make a heartbeat from the client to the ESP
- Mosquitto docker for the client
- Heartbeat script for the client
- Filesystem
- Internet
- DNS
- MQTT
- Dockerize
- Heartbeat script for the ESP
-
Make the ESP send an email when the client goes down.
- Make an ISR that checks the time between the heartbeats
- Make it recognize when the system is down
- Send email when the system is down/up/initialized
-
Secure the application with a .env file
-
Reverse-engineer the Tapo P110 API that controls the power state
-
When several heartbeats are missed the ESP should switch the power state off and back on again to force a reboot of the client.
-
Make the MQTT connection secure.
-
Make a heartbeat from the ESP to the client
-
Let the client send and email if there is no longer a heartbeat
Copy the Heartbeat folder to the desired destination on the client. Execute the following command in the folder:
docker compose up -d
This command starts the docker containers that include the MQTT server and the heartbeat script.
To view logs from the heartbeat script have a look at /Heartbeat/data/log.txt
.
For logs of the MQTT server look into /Heartbeat/mosquitto/log/mosquitto.log