Skip to content

Instantly share code, notes, and snippets.

@elvinio
Created March 28, 2016 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elvinio/f8574f37dd5f55ed0e46 to your computer and use it in GitHub Desktop.
Save elvinio/f8574f37dd5f55ed0e46 to your computer and use it in GitHub Desktop.
Records the temperature readout from the hardware sensor in a linux env.
#!/usr/bin/python
import subprocess
import time
temp = [3, 8, 13, 18, 23, 28, 33, 38, 43, 51, 56, 61, 66, 71, 76, 81, 86, 91, 147, 153, 159, 165, 171, 240, 246, 252, 258, 264]
f = open('temp', 'w')
while True:
output = subprocess.check_output(["sensors", "-u"])
lines = output.split("\n")
printstring = str(int(time.time()))
for t in temp:
ss = lines[t].split(":")
printstring += ss[1]
time.sleep(60)
f.write(printstring + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment