I try to read more then one value from pond.py
my pond.py code so far:
import syslog
import weewx
from weewx.wxengine import StdService
class PondService(StdService):
def __init__(self, engine, config_dict):
super(PondService, self).__init__(engine, config_dict)
d = config_dict.get('PondService', {})
self.filename = d.get('filename', '/var/www/html/data/reading.txt')
syslog.syslog(syslog.LOG_INFO, "pond: using %s" % self.filename)
self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file)
def read_file(self, event):
try:
with open(self.filename) as f:
#value = f.read()
line = f.readline()
value = line.split(',')
syslog.syslog(syslog.LOG_DEBUG, "pond: found value of %s" %
value)
event.record['extraTemp1'] = float(value[0])
event.record['extraTemp2'] = float(value[1])
except Exception, e:
syslog.syslog(syslog.LOG_ERR, "pond: cannot read value: %s" % e)
--
i get no error but i get no pond temperature in web template. syslog shows
no error.
When i use a single value it works.
in my reading.txt the values are comma separeted
24.1,12.5
i am using weewx 3.5.0 on a rasperry PI 3
here is with 1 pond temperature
http://wetter.aotten.de/
Where is my error?
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.