Looks good, one thing you can do to make your code a little more readable
is to make use the available properties of ValueTuple objects.
weewx.units.convertStd returns an object of type ValueTuple. ValueTuple
objects have 3 useful properties; .value, .unit and .group. In your code
you could
So, thanks for all your help, here's what I finally have working.
It's a little more generic, as in I can specify in weewx.conf where my BMP
library is, what my sea level modifier is, and where I want to store the
values, if at all
weewx.conf
[BMP280]
col_pres = pressure
col_temp = ''
Here's what I have working:
#!/usr/bin/env python
import syslog
import weewx
from weewx.wxengine import StdService
from Adafruit_BME280 import *
class PressureService(StdService):
def __init__(self, engine, config_dict):
super(PressureService, self).__init__(engine, config_dict)
Thanks. I read above that Tom suggested
new_valueTuple = weewx.units.convertStd((22.5, "degree_C",
"group_temperature"), packet['usUnits'])
However packet is undefined in eg, the electricity example. (I get an error)
So I am doing
pres_tuple = weewx.units.convertStd((hectopascals, "mbar",
Right.. ok, makes sense now.
The file from Craig Thom seems to do a lot of processing, and converting,
and filtering/massaging... so wasn't clear on that point
So I went back to the electricity example in the customizing guide, and it
sort of makes sense now!
I am not sure what all that
Hi,
In this case order matters. The StdArchive service is the service that does the
final processing of archive records and ultimately saves the archive record to
database. You have placed your service after StdArchive so by the time your
service is obtaining data, and presumably adding it to
I am also interested in this, and here's what I've managed to do / not do.
I attached the sensor, and ran
sudo i2cdetect -y 1
to check it was there.
It was showing as position 0x77, which is decimal 119 just as in Craig's
post above.
These parts were missing above, and I eventually figured
I know I saw, somewhere, a way to call an existing weewx method to convert
units to whatever is needed, but I can't find it again. It may have been
in a service in the Wiki rather than in the documentation, because I can't
find it there.
Is there such a thing?
I didn't like how limited the
The only thing that matters is that the packet yielded by the driver use a
consistent unit system. Doesn't matter what that unit system is, but all
measurements in the packet have to use it.
See the Appendix *Units
* for the
definitions of the three unit systems, US, METRIC, and METRICWX.
-tk
Thanks. In the MySQL database it's a double, so the resolution is there.
My weewx is using American measures and putting inHg in the database. Do i need
to convert from Pascals before handing the data back?
Weewx doesn't round anything. It just passes values on to the database.
How the database handles it depends on the type of database, driver, and
how it's configured.
-tk
On Sat, Apr 1, 2017 at 11:03 AM, Craig Thom wrote:
> I'm working an a RPi SPI service to read a
11 matches
Mail list logo