BME280 not working #346

Open
opened 2020-09-17 14:03:02 +01:00 by JanHBade · 23 comments
JanHBade commented 2020-09-17 14:03:02 +01:00 (Migrated from github.com)

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)

Hello, running Octoprint on a Pi4 on Python**3** ![Screenshot 2020-09-17 150035](https://user-images.githubusercontent.com/3524802/93473752-ae694800-f8f6-11ea-9ec4-5c72cda6c8f5.png) ![Screenshot 2020-09-17 150059](https://user-images.githubusercontent.com/3524802/93473748-add0b180-f8f6-11ea-9240-2ea53891bd83.png) 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)
roomme13 commented 2020-09-17 17:57:44 +01:00 (Migrated from github.com)

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

Same issue, turn on / off "use SUDO" option didn't bother
mik-at commented 2020-09-24 18:18:35 +01:00 (Migrated from github.com)

Same Issue with a DHT11 here.

Same Issue with a DHT11 here.
counterion commented 2020-09-29 05:48:49 +01:00 (Migrated from github.com)

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.

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.
vitormhenrique commented 2020-10-12 16:59:20 +01:00 (Migrated from github.com)

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....

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 commented 2020-10-19 20:42:42 +01:00 (Migrated from github.com)

@JanHBade update on this?

@JanHBade update on this?
counterion commented 2020-10-20 09:47:24 +01:00 (Migrated from github.com)

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

@vitormhenrique Do you have a rough idea when Python3 support will be ready?
vitormhenrique commented 2020-10-20 15:59:47 +01:00 (Migrated from github.com)

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...

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...
counterion commented 2020-10-22 09:53:16 +01:00 (Migrated from github.com)

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. :)

> > > 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. :)
jonathanoeijoeng commented 2020-11-16 06:39:20 +00:00 (Migrated from github.com)

so DHT11 will not work on phyton 3 as well ?

so DHT11 will not work on phyton 3 as well ?
Will-It-Work-42 commented 2021-01-03 09:13:27 +00:00 (Migrated from github.com)

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

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](https://user-images.githubusercontent.com/76900010/103475266-05166700-4dac-11eb-8358-94e6caf627a6.png) Using "root access" or not is not better : ![github2](https://user-images.githubusercontent.com/76900010/103475276-20817200-4dac-11eb-8f62-d834c2b08e9f.png) What ever I'm doing it's always the same result : ![github3](https://user-images.githubusercontent.com/76900010/103475289-3db64080-4dac-11eb-8b6d-052a97afcd85.png) other parts of this wonderful plugin are working well
Squirrelf commented 2021-01-03 17:21:10 +00:00 (Migrated from github.com)

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 👍

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 👍
Will-It-Work-42 commented 2021-01-04 15:23:25 +00:00 (Migrated from github.com)

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

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](https://user-images.githubusercontent.com/76900010/103550381-16916900-4ea9-11eb-8528-93963668f457.png) Hope this will help other users
ainuke commented 2021-01-24 01:32:37 +00:00 (Migrated from github.com)

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!

> 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!
counterion commented 2021-01-25 08:50:14 +00:00 (Migrated from github.com)

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.

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.
cerulean-yonder commented 2021-02-04 09:24:26 +00:00 (Migrated from github.com)

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 :)

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 :)
geoffdavis commented 2021-06-10 03:57:29 +01:00 (Migrated from github.com)

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.

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.
sirinsidiator commented 2021-09-24 16:05:28 +01:00 (Migrated from github.com)

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.

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.
sajovicd commented 2021-12-06 18:23:15 +00:00 (Migrated from github.com)

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

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 `
Mcarbuhn commented 2021-12-06 20:10:41 +00:00 (Migrated from github.com)

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

I had the same problem when I wired the bme280 wrong.
sajovicd commented 2021-12-07 17:10:26 +00:00 (Migrated from github.com)

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.

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.
JanHBade commented 2022-02-23 19:45:15 +00:00 (Migrated from github.com)

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

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
VCOB commented 2022-03-25 04:24:26 +00:00 (Migrated from github.com)

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.

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.
JanHBade commented 2022-05-11 18:48:31 +01:00 (Migrated from github.com)

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

works for me now, Use Sudo is NOT selected, Use Board Pin seleted but after a reload not in use...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/OctoPrint-Enclosure#346