Issue with BME280 after upgrade to weewx 4

111 views
Skip to first unread message

Greg Gowins

unread,
May 23, 2020, 8:15:05 PM5/23/20
to weewx-user

I posted this in another thread, but figured it might be better seen if I started a new topic.

For a while I have been running an Acurite 5-n-1 and Acurite Lightning sensor via SDR, and have a BME280 connected to the Pi, with the weewx extension from here to run it:  https://gitlab.com/wjcarpenter/bme280wx.  

I upgraded to Weewx 4  from 3.9.1 last night, and everything seems to be running ok except for weewx processing the data from the BME280.   When I see it process, it appears to be trying to put the BME280 data into fields for the lightning meter:

May 23 10:02:13 weatherstation weewxd: bme280: BME280 data compensated_reading(id=6e6ccd6e-39bd-42bb-8648-d9e1e855719c, timestamp=2020-05-23 10:02:13.100774, temp=27.089 °C, pressure=977.55 hPa, humidity=42.11 % rH)
May 23 10:02:13 weatherstation weewxd: bme280: {u'distance': 0, u'lastStrikeTime': 1590246128, u'strikes_total': 15, u'strikes': 0, 'dateTime': 1590246128, 'usUnits': 1}
May 23 10:02:13 weatherstation weewxd: sdr: MainThread: packet={u'distance': 0, u'lastStrikeTime': 1590246128, 'dateTime': 1590246128, 'usUnits': 1, u'strikes_total': 15}
May 23 10:02:13 weatherstation weewx[593] INFO weewx.restx: MQTT: Published record 2020-05-23 10:02:08 CDT (1590246128)

It appears that somehow the barometric pressure info is making it into the processing engine, as I'm getting barometric pressure successfully calculated and displayed via Belchertown.  But the inTemp in the DB isn't being populated from the BME280 so obviously no data displayed.  Any clue on where to look for troubleshooting this one?  When I upgraded weewx to 4, I used the existing weewx.conf.  I looked through the weewx.conf-4.0.0 to to see if anything jumped out, but nothing did.  Any info is appreciated.  Thanks!

Greg






gjr80

unread,
May 23, 2020, 9:25:48 PM5/23/20
to weewx-user
Hi,

I don't think the BME280 extension is trying to do anything with the lightning data per se. If you look at the BME280 extension code you will see that it attempts to add temperature, pressure and humidity data to the loop packet. The last thing it does is log the packet. What I suspect is happening is the lightning data is already in the loop packet when the BME280 extension is executed (this is almost certainly the case if you are using the SDR driver). The BME280 is unable to obtain any temperature, pressure and humidity data but it still logs the packet before it exits hence you see a bme280: prefixed log entry with lightning data but no BME280 data.

I would be looking at these lines:

if all(must_have in packet for must_have in self.pressure_must_have):
    pressurePA
= (bme280data.pressure, 'mbar', 'group_pressure')
    converted
= converter.convert(pressurePA)
   
for key in self.pressureKeys:
        packet
[key] = converted[0]
if all(must_have in packet for must_have in self.temperature_must_have):
    temperatureC
= (bme280data.temperature, 'degree_C', 'group_temperature')
    converted
= converter.convert(temperatureC)
   
for key in self.temperatureKeys:
        packet
[key] = converted[0]
if all(must_have in packet for must_have in self.humidity_must_have):
    humidityPCT
= (bme280data.humidity, 'percent', 'group_percent')
    converted
= converter.convert(humidityPCT)
   
for key in self.humidityKeys:
        packet
[key] = converted[0]

The first log entry indicates the BME280 data is being successfully read but I suspect those three conditionals are failing somewhere and hence no BME280 data makes it into the packet.

Gary

Greg Gowins

unread,
May 23, 2020, 10:38:10 PM5/23/20
to weewx-user
Thanks, that did give me something to go on.  In the weewx.conf file, you set the 'must_have', to add the value to the packet and here's what I had:

[Bme280wx]
    temperature_must_have = ""
    humidityKeys = inHumidity
    pressureKeys = pressure
    pressure_must_have = outTemp
    i2c_port = 1
    humidity_must_have = ""
    i2c_address = 0x77
    usUnits = US
    temperatureKeys = inTemp

The only thing that is a must have is outTemp, which I have in some other log entries:

May 23 21:25:21 weatherstation weewxd: bme280: BME280 data compensated_reading(id=9d035f02-3164-4c84-9667-8c4e5e6f6034, timestamp=2020-05-23 21:25:21.684878, temp=26.483 °C, pressure=973.67 hPa, humidity=42.11 % rH)
May 23 21:25:21 weatherstation weewxd: bme280: {u'lastStrikeTime': 1590287118, u'outHumidity': 75.0, 'dateTime': 1590287118, u'outTemp': 79.9, u'windSpeed': 5.7650962506369074, u'pressure': 28.752361215071698, 'usUnits': 1}


The pressure key was indeed appearing when the outTemp key was there, so that's how it was working.  I then changed the entries for temperature_must_have and humidity_must_have to be outTemp as well, and when I restarted weewx, it put those entries into the packet.  

May 23 21:32:46 weatherstation weewxd: bme280: BME280 data compensated_reading(id=77b48509-c677-4e4e-80e4-22bb7d69aa2d, timestamp=2020-05-23 21:32:46.365347, temp=26.697 °C, pressure=973.76 hPa, humidity=42.78 % rH)
May 23 21:32:46 weatherstation weewxd: bme280: {u'lastStrikeTime': 1590287562, u'outHumidity': 76.0, 'dateTime': 1590287562, u'outTemp': 79.7, u'windSpeed': 3.193234493643357, u'inHumidity': 42.77779308621109, u'inTemp': 80.05406480135397, u'pressure': 28.755112653832978, 'usUnits': 1}

Thanks again for the suggestion on where to look. 

tldr, you have to now specify something in *_must_have to get the value added to the packet loop.  I guess the "" is now being evaluated in weewx 4 as a value to match.

Greg

Gazza

unread,
May 24, 2020, 12:08:55 AM5/24/20
to weewx-user

Slightly off topic, the info on the bme280wx site says it works with python 2 and not python 3.

I have gone back to python2 so I can use owfs and the next bit to get working was to be the bme280w based barometer.

So what version of python are you running with your V4 weewx ?


Gaz

Greg Gowins

unread,
May 24, 2020, 11:22:36 AM5/24/20
to weewx-user
I'm using v2.7 on my install.
Reply all
Reply to author
Forward
0 new messages