Skip to content

Instantly share code, notes, and snippets.

Last active August 18, 2019 15:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save louis-e/7e814ffb3befd07eb9dc617b1bf13deb to your computer and use it in GitHub Desktop.
A python script to protect raspberry pi against overheating because of omxplayer.
import os
import time
def measure_temp():
temp = os.popen("vcgencmd measure_temp").readline()
return (temp.replace("temp=","").replace("'C",""))
while True:
temp = measure_temp()
if temp > '83':
os.system('sudo python /home/pi/omxcontrol/examples/ q')
elif temp > '86':
os.system("sudo shutdown -h now")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment