Same values every Envrio+ print out

Trying to send some values from the new Enviro+ to a telegram chatbot for a home weather update on demand within a group chat.

What I have come to realise though, the bot work fine, but the outputted data is always the same.
The current tempurature is 21.70818430223153 *C
The current pressure is 700.2708792437015hPa
The Current Humidty is 84.54408663293306 %

I also realised that this is always the same in the first print from the weather.py example
Temperature: 21.71 *C
Pressure: 700.27 hPa
Relative humidity: 84.54 %

Just using basic code as a demo and still getting the same:
#!/usr/bin/env python

from bme280 import BME280

try:
from smbus2 import SMBus
except ImportError:
from smbus import SMBus

bus = SMBus(1)
bme280 = BME280(i2c_dev=bus)

temp = bme280.get_temperature()
pressure = bme280.get_pressure()
humidity = bme280.get_humidity()

print(temp)
print(pressure)
print(humidity)

Anyone know a fix for this as I dont want it in a loop unfortunatly, just need a one time print on demand.

Thanks

E

I have the same exact problem

I did find a work around, but I am struggling to remember which file it is, but maybe this would help?

#!/usr/bin/env python

from telegram.ext import Updater, InlineQueryHandler, CommandHandler
import requests
import re
from bme280 import BME280

try:
from smbus2 import SMBus
except ImportError:
from smbus import SMBus

bus = SMBus(1)
bme280 = BME280(i2c_dev=bus)

def weather(bot, update):
chat_id = update.message.chat_id
temperature = bme280.get_temperature()
pressure = bme280.get_pressure()
humidity = bme280.get_humidity()
current_temp = "The current tempurature is " + str(temperature) + " *C " + "\nThe current pressure is " + str(pressure) + “hPa” + “\nThe Current Humidty is " + str(humidity) + " %”
bot.send_message(chat_id=chat_id, text=current_temp)

def main():
updater = Updater(’**************’)
dp = updater.dispatcher
dp.add_handler(CommandHandler(‘weather’,weather))
updater.start_polling()
updater.idle()

if name == ‘main’:
main()

Stared out updater being my bot key

I found that the first set of reading are junk, so I do a dummy read at the beginning of my program and throw the results away. A pressure of 700 hPa seems wrong to me, I have never seen a real pressure that low and 85% humidity is higher than I have ever experienced in the UK.

My Sense Hat will show 0 mb on first boot up and first reading. Next time around it would be fine. I added a line to my code to not display it if = 0. I don’t think I have ever seen a reading below 900 mb here in Atlantic Canada.
My Sense Hat would also sometimes show the humidity above 100%. I added a line to cap it at 100%

Eventually I switched to a BME680 for my readings, the only thing I use on the Sense Hat now is the LED matrix to display my messages and the 5 way switch to adjust display brightness etc. It runs headless. At some point I’d like to swap out the sense hat for a Unicorn Hat. I just have go find my round 2it.
Or buy an Enviro + and swap it all out for that.

Yes, sorry if this wasn’t the right code for the dummy reading, but that seems like what I did the end…

I have recently formatted my PC and lost the code I used in the past unfortunately… quite annoying, Im not that hot on python and takes a while for me to do stuff, but that’s how I worked around it in the long run, I was using one of the Enviro+ boards too, they are alot better now

If that code is running on your Enviro you could get it back. Hook up a monitor and keyboard and drag and drop the py file onto a thumb drive then copy it back to your PC for backup.

Unfortunately, I wiped the pi it was running on to take the card for a pi4 build which is running on a different project now :(

Will try and have a tinker over the Christmas break