Last active
April 21, 2021 18:00
-
-
Save okalachev/364702ab3c4fb4152e9dcdd287e895d0 to your computer and use it in GitHub Desktop.
Script for plotting RPi temperature graph
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
# Running: PYTHONUNBUFFERED=1 python temp_plot.py | tee temp.csv | |
import time | |
import subprocess | |
print('uptime,temperature,throttling') | |
while True: | |
uptime = float(open('/proc/uptime', 'r').readline().split()[0]) / 60 | |
temp = float(open('/sys/class/thermal/thermal_zone0/temp').read()) / 1000 | |
throttled = subprocess.check_output(['vcgencmd', 'get_throttled']) | |
throttle_mask = int(throttled.split('=')[1], base=16) | |
print('%s,%s,%s' % (uptime, temp, throttle_mask)) | |
time.sleep(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment