mityax / rpi-temperature-alert

Monitor the CPU temperature of a Raspberry Pi, send warn emails if it gets really warm and shutdown the system if it gets too hot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Raspberry Pi temperature alert

Monitor the CPU temperature of a Raspberry Pi, send warn emails and shut down the system if it gets too hot.

The original code comes from here. I modified it to send more detailed warning messages and added a nice CPU temperature graph over the past 60 days to the emails. Below is an example email.

Email Screenshot

Setup

pip install python-simplemail

To run this script periodically (as it is intended) type sudo crontab -e and add this line:

*/15 * * * * python /home/pi/temperature-alert.py

Then adjust the email credentials at the beggining of the script.

That's it. Your Pi is now save.

Setup on systems without pip (e.g. LibreElec and OpenElec)

To use this script on systems without pip just download this python script, rename it to simplemail.py and place it next to temperature-alert.py

Testing the Setup

To test your setup, just type

python temperature-alert.py 70

This will emulate a CPU temperature of 70°C and thus send you a warn e-mail. Use 81°C to test the shutdown function.

About

Monitor the CPU temperature of a Raspberry Pi, send warn emails if it gets really warm and shutdown the system if it gets too hot


Languages

Language:Python 100.0%