A python script to protect raspberry pi against overheating because of omxplayer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
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() | |
print(temp) | |
if temp > '83': | |
print("TEMPCONTROL.PY:quitted_omxplayer_because_of_overheat") | |
os.system('sudo python /home/pi/omxcontrol/examples/omxcommand.py q') | |
elif temp > '86': | |
print("TEMPCONTROL.PY:shutting_down_because_of_oveaheat") | |
os.system("sudo shutdown -h now") | |
time.sleep(7) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment