Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import subprocess
- import time
- import os
- import urllib2
- serverIP = "your_server_IP"
- nodeID = "node_id"
- apikeyRW = "your_apikey_RW"
- interval = interval_in_secs
- while True:
- currentTemp = subprocess.check_output(["/opt/vc/bin/vcgencmd","measure_temp"])
- currentTemp = float(currentTemp.split("=")[1][:-3])
- urllib2.urlopen("http://" + serverIP + "/emoncms/input/post.json?node=" + nodeID + "&csv=" + str(currentTemp) + "&apikey=" + apikeyRW)
- time.sleep(interval)
Advertisement
Add Comment
Please, Sign In to add comment