OctoPrint-Enclosure icon indicating copy to clipboard operation
OctoPrint-Enclosure copied to clipboard

BME280 not working

Open JanHBade opened this issue 3 years ago • 23 comments

Hello,

running Octoprint on a Pi4 on Python3

Screenshot 2020-09-17 150035

Screenshot 2020-09-17 150059

LogFile: 2020-09-17 14:55:02,488 - octoprint.plugins.enclosure - INFO - Failed to execute python scripts, try disabling use SUDO on advanced section of the plugin. 2020-09-17 14:55:02,488 - octoprint.plugins.enclosure - WARNING - An exception of type TypeError occurred on log_error. Arguments: ("a bytes-like object is required, not 'str'",)

Sensor is working (tested via SSH)

JanHBade avatar Sep 17 '20 13:09 JanHBade

Same issue, turn on / off "use SUDO" option didn't bother

roomme13 avatar Sep 17 '20 16:09 roomme13

Same Issue with a DHT11 here.

mik-at avatar Sep 24 '20 17:09 mik-at

I'm experiencing the same issue with SI7021. The sensor is working properly, but the Enclosure plugin is showing zeros for the temperature and humidity. The problem appeared after migrating from Python2.7 to Python3.8. I've tried rolling back to Python2 and it worked properly again. "Use SUDO" option doesn't affect the behavior.

It seems to me related to the "bytes type" that was introduced in Python 3, but I don't know how to solve it.

f-hnt avatar Sep 29 '20 04:09 f-hnt

have you tried the sudo thing? also as @f-hnt mentioned, plugin only supports python 2.7 at the moment.... working on python 3 now....

vitormhenrique avatar Oct 12 '20 15:10 vitormhenrique

@JanHBade update on this?

vitormhenrique avatar Oct 19 '20 19:10 vitormhenrique

@vitormhenrique Do you have a rough idea when Python3 support will be ready?

f-hnt avatar Oct 20 '20 08:10 f-hnt

Started this week, will probably take couple weeks to maybe month....

I'm completely re-writing the plugin, not re-using a single line of code, and there are probably 10k lines of code on the old plugin....

So don't expect anything too soon...

vitormhenrique avatar Oct 20 '20 14:10 vitormhenrique

Started this week, will probably take couple weeks to maybe month....

I'm completely re-writing the plugin, not re-using a single line of code, and there are probably 10k lines of code on the old plugin....

So don't expect anything too soon...

No pressure. Thanks for the effort. Looking forward to it. :)

f-hnt avatar Oct 22 '20 08:10 f-hnt

so DHT11 will not work on phyton 3 as well ?

jonathanoeijoeng avatar Nov 16 '20 06:11 jonathanoeijoeng

Hello evrerybody,

I'm facing the same issue : my BME280 is working fine, it is correctly seen by the system :

root@octoprint:/home/pi#  i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --

Values are correctly reported by the python script :

/home/pi/bme280.py
Chip ID     : 96
Version     : 0
Temperature :  14.74 C
Pressure :  1010.70826168 hPa
Humidity :  57.2057097606 %

Configuration seems to be correct (I have tried with 0x76 or 76 for address but the result is the same) :

github1

Using "root access" or not is not better :

github2

What ever I'm doing it's always the same result :

github3

other parts of this wonderful plugin are working well

Will-It-Work-42 avatar Jan 03 '21 09:01 Will-It-Work-42

what worked for me was installing adafruit-circuitpython-bme280 with sudo (to be system wide as per the Adafruit instructions), in case you didn't do that. (haven't actually tried installing for current user only) sudo pip3 install adafruit-circuitpython-bme280 for the address 76 (didn't try 0x76) and then had to actually disable the default "use SUDO", and it "magically" worked. (with "use SUDO", I would get 0C 0%)

@vitormhenrique thanks for everything you have done 👍

Squirrelf avatar Jan 03 '21 17:01 Squirrelf

Hi Squirrelf,

MANY thanks to you ! It works like a charm

I had to install pip3 before :

sudo apt install python3-pip

And then as you said :

sudo pip3 install adafruit-circuitpython-bme280

And disable "use SUDO"

and ... tada !

2021-01-04 16_18_09-Window

Hope this will help other users

Will-It-Work-42 avatar Jan 04 '21 15:01 Will-It-Work-42

what worked for me was installing adafruit-circuitpython-bme280 with sudo (to be system wide as per the Adafruit instructions), in case you didn't do that. (haven't actually tried installing for current user only) sudo pip3 install adafruit-circuitpython-bme280 for the address 76 (didn't try 0x76) and then had to actually disable the default "use SUDO", and it "magically" worked. (with "use SUDO", I would get 0C 0%)

@vitormhenrique thanks for everything you have done 👍

I'm so psyched to try this. I've been considering downgrading Octoprint to Pv2.7 version just because of this problem with temp sensor. It drives my enclosure heater, which is the only way I can reliably print in winter (my basement is about 10-12C, and PLA warps big time on larger prints, sometimes detaching). I've been anxiously awaiting an update for Pv3 compatibility; @vitormhenrique is the greatest for keeping this plugin going, and I really appreciate all his dedication and hard work!

ainuke avatar Jan 24 '21 01:01 ainuke

Just to share my experience when I had readings "0" temp and "0" humidity.

After doing all suggestions in this thread, for me the problem still persisted. For some other reasons I had to clear my cookies and cache from the browser (Firefox). After this clean-up the readings from the sensor now work.

Regards.

f-hnt avatar Jan 25 '21 08:01 f-hnt

I've downloaded image 0.17.0 initially and updated as per above and got it working. I had to do a reconfigure yesterday (re-image SD card) and downloaded the 0.18.0 version and tried this, but for me it isn't working now. I've tried both Chrome and Firefox and clearing browser data, but unfortunately I'm still seeing "0" as the values. I've turned on logging for octoprint.plugins.enclosure but I can't see a log generated for this yet? I'm getting a sensor showing up correctly as per the "i2cdetect -y 1". I've also tried restarting using sudo enabled/disabled. No sure if I should downgrade to get functionality back or wait :)

cerulean-yonder avatar Feb 04 '21 09:02 cerulean-yonder

I couldn't get the plugin to work even after installing the adafruit BME280 library as mentioned above.

However, it looks like GH-369 has a fix for this, and it works on my Octoprint 0.17 upgraded to python3 installation.

geoffdavis avatar Jun 10 '21 02:06 geoffdavis

I hit the same problem. After looking into it for a bit, I found that calling BME280.py directly gives me the following error:

pi@octopi:~/oprint/lib/python3.7/site-packages/octoprint_enclosure $ python BME280.py 0x77
Traceback (most recent call last):
  File "BME280.py", line 1, in <module>
    import smbus
ImportError: No module named smbus

Installing smbus via sudo apt-get install python-smbus fixed it for me and it now shows the values properly.

sirinsidiator avatar Sep 24 '21 15:09 sirinsidiator

Hello Does anybody know why I have so many i2c values? I cant get BME280 to work...

Thank you

i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70: 70 71 72 73 74 75 76 77

sajovicd avatar Dec 06 '21 18:12 sajovicd

I had the same problem when I wired the bme280 wrong.

Mcarbuhn avatar Dec 06 '21 20:12 Mcarbuhn

Hello, Thnank you for fast respond... well I check the wires, check the wiring, check the pin, gpio... Have no more idea what culd be wrong. I have rpi3 b+ with the latest octopi installed.

sajovicd avatar Dec 07 '21 17:12 sajovicd

the problem still exists for me

only zeros are displayed :(

sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --
pi@Ender3Pro:~ $ ./bme280.py

Temperature: 13.8 C Humidity: 50.1 % Pressure: 1011.2 hPa

JanHBade avatar Feb 23 '22 19:02 JanHBade

I have a Pimoroni breakout bme280 connected to a hyper pixel 4.0 rectangular touch screen. My i2c bus is i2c-22 so I modified instructions from the hyper pixel page to create a symbolic link for bus 1: sudo ln -s /dev/i2c-22 /dev/i2c-1. Then I disabled the "Use SUDO" option as described above, but I also had to select "Use Board Pin #" as well.

VCOB avatar Mar 25 '22 04:03 VCOB

works for me now, Use Sudo is NOT selected, Use Board Pin seleted but after a reload not in use...

JanHBade avatar May 11 '22 17:05 JanHBade