summaryrefslogtreecommitdiff
path: root/envmon/outdoor2rrd.py
blob: 1c4ca2491bfe7ccf9333363f76c03e7a4b511dab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python

import time
import sys

import rrdlog
import weather

location = '20065491' # Leipzig

while True:
	try:
		data = weather.weather(location)
		rrdlog.TempLog('env-outside.rrd').update(data.temperature)
	except Exception:
		sys.stderr.write('Exception occured at %s:\n' % time.strftime('%a, %d %b %Y %T %z'))
		sys.excepthook(*sys.exc_info())
		sys.stderr.write('========================================\n')
		time.sleep(60)
	else:
		time.sleep(300)