Created
August 20, 2012 09:10
-
-
Save kgleeson/3402555 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import serial | |
import xml.etree.ElementTree as ET | |
import os | |
port = '/dev/ttyUSB0' | |
baud = 57600 | |
ser = serial.Serial(port, baud) | |
data = ser.readline() | |
root = ET.fromstring(data) | |
watts = root[7][0].text | |
temp = root[3].text | |
rrdpath = '/etc/cron.cc/rrd/powertemp.rrd' | |
rrdcmd = '/usr/bin/rrdtool update %s N:%s:%s' % (rrdpath, watts, temp) | |
os.system(rrdcmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment