--
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 weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
At first, thanks a lot for the fast and useful answers!
The sensor I have looks a little different than the one in the datasheet:
sqlite> PRAGMA table_info (archive_day_outTemp);
0|dateTime|INTEGER|1||1
1|min|REAL|0||0
2|mintime|INTEGER|0||0
3|max|REAL|0||0
4|maxtime|INTEGER|0||0
5|sum|REAL|0||0
6|count|INTEGER|0||0
7|wsum|REAL|0||0
8|sumtime|INTEGER|0||0
At first, thanks a lot for the fast and useful answers!
The sensor I have looks a little different than the one in the datasheet:
I have it connected directly to the 3,3 V GPIO of the Raspberry, that's where it gets the power from.
The sensor is working now using the Adafruit Library and logging the temperature and the humidity automatically with a cronjob to a CSV file (I found a very good tutorial for this here, in German though...).
I found out, that weewx stores the temperature records in the SQLite database at '/var/lib/weewx/weewx.sdb', probably in the tables named 'archive_day_outTemperature' and 'archive_day_outHumidity'.
The contents of this table (in this example for the temperature) are the following:sqlite> PRAGMA table_info (archive_day_outTemp);
0|dateTime|INTEGER|1||1
1|min|REAL|0||0
2|mintime|INTEGER|0||0
3|max|REAL|0||0
4|maxtime|INTEGER|0||0
5|sum|REAL|0||0
6|count|INTEGER|0||0
7|wsum|REAL|0||0
8|sumtime|INTEGER|0||0
Where do I have to put the temperatures here? This columns just seem to contain minimum and maximum temperatures - not the current ones that I get in the CSV file.
Or is this the wrong database to transfer the data to?
--
It would be easier if you just wrote a device driver instead of writing directly to the database.See the Customizing Guide for hints on how to do this.Also, take a look at the many existing drivers. One of them may be close to what you need.
class FileParse(weewx.drivers.AbstractDevice):
"""weewx driver that reads data from a file"""
def __init__(self, **stn_dict):
# where to find the data file
self.path = stn_dict.get('path', '/var/tmp/wxdata')
# how often to poll the weather data file, seconds
self.poll_interval = float(stn_dict.get('poll_interval', 2.5))
# mapping from variable names to weewx names
self.label_map = stn_dict.get('label_map', {})
loginf("data file is %s" % self.path)
loginf("polling interval is %s" % self.poll_interval)
loginf('label map is %s' % self.label_map)
def genLoopPackets(self):
while True:
# read whatever values we can get from the file
data = {}
try:
with open(self.path) as f:
for line in f:
eq_index = line.find('=')
name = line[:eq_index].strip()
value = line[eq_index + 1:].strip()
data[name] = value
except Exception, e:
logerr("read failed: %s" % e)
# map the data into a weewx loop packet
_packet = {'dateTime': int(time.time() + 0.5),
'usUnits': weewx.US}
for vname in data:
_packet[self.label_map.get(vname, vname)] = _get_as_float(data, vname)
yield _packet
time.sleep(self.poll_interval)
@property
def hardware_name(self):
return "FileParse"