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)
        self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_sensors)

    def read_sensors(self, event):
        sensor = BME280(t_mode=BME280_OSAMPLE_8, p_mode=BME280_OSAMPLE_8, h_mode=BME280_OSAMPLE_8)
        degrees = sensor.read_temperature()
        pascals = sensor.read_pressure()
        event.record['inTemp'] = float((degrees*9/5)+32)
        event.record['pressure'] = float(pascals * 0.00029530)

It is reporting both pressure and indoor temp, I don't have the one that has humidity.

On 8/21/2018 11:18 AM, David Moore wrote:
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 out as he's running it as a service:

I then took his file, bmp280.py amd put it in /usr/share/weewx/user/
I then added to weewx.conf as above.

However i ALSO had to add this to the engine services part:

|
archive_services =weewx.engine.StdArchive,user.bmp280.bmp
|

(I was getting errors before that)

So, now weewx runs without error

In the logs I can see this:

|
Aug2117:27:38WeatherPiweewx[1589]:manager:Dailysummary version is2.0
Aug2117:27:38WeatherPiweewx[1589]:engine:Usingbinding 'wx_binding'to database 'weewx' Aug2117:27:38WeatherPiweewx[1589]:manager:Startingbackfill of daily summaries Aug2117:27:38WeatherPiweewx[1589]:engine:Finishedloading service weewx.engine.StdArchive
Aug2117:27:38WeatherPiweewx[1589]:engine:Loadingservice user.bmp280.bmp
Aug2117:27:38WeatherPiweewx[1589]:engine:Finishedloading service user.bmp280.bmp Aug2117:27:38WeatherPiweewx[1589]:engine:Loadingservice weewx.restx.StdStationRegistry
Aug2117:27:38WeatherPiweewx[1589]:restx:StationRegistry:Registrationnotrequested.
Aug2117:27:38WeatherPiweewx[1589]:engine:Finishedloading service weewx.restx.StdStationRegistry
|

However, nothing is getting written to db.

I tried this to check everything on the sensor was ok:

|
git clone https://github.com/adafruit/Adafruit_Python_GPIO.git <https://github.com/adafruit/Adafruit_Python_GPIO.git>
cd Adafruit_Python_GPIO
sudo python setup.py install
cd ../
git clone https://github.com/adafruit/Adafruit_Python_BME280.git <https://github.com/adafruit/Adafruit_Python_BME280.git>
cd Adafruit_Python_BME280
python ./Adafruit_BME280_Example.py


Temp=29.053deg C
Pressure=890.79hPa
Humidity=0.00%
|



So, I'm stumped now.  Will let you know if I get it working, however I feel I'm going to need some help...









On Tuesday, 26 June 2018 20:15:21 UTC+2, Tim Urberg wrote:

    I know it's been a while, but just wondering if there's any update
    on this, I was thinking of using this and wanted to make sure it
    worked before buying one.

    Thanks!
    Tim

    On Saturday, April 8, 2017 at 6:35:33 AM UTC-5, Craig Thom wrote:

        col_pres should be "pressure. I read that part of the weewx
        documentation, but I didn't remember it right.

        The pressure from the BMP280 does not take elevation into account.




---
This email has been checked for viruses by AVG.
https://www.avg.com

Reply via email to