Use RPi.bme280 #444

Merged
thijstriemstra merged 6 commits from patch-1 into master 2021-11-10 09:04:05 +00:00
thijstriemstra commented 2021-10-26 20:47:40 +01:00 (Migrated from github.com)

This PR introduces usage of RPi.bme280 library, simplifying the temperature/humidity reading code.

It also makes sure the correct python executable is used when running the script. It was using system python before which resolves to /usr/bin/python2.7 on Raspbian, which is plain wrong I think. sys.executable resolves to the Python executable that octoprint uses, so the command becomes:

/home/pi/oprint/bin/python3 /home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/BME280.py 0x76

instead of:

python /home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/BME280.py 0x76

Lastly, it also properly logs errors that occur in the BME280.py script.

Tested with Octopi 0.18.0 and octoprint 1.7.0.

This PR introduces usage of RPi.bme280 library, simplifying the temperature/humidity reading code. It also makes sure the correct python executable is used when running the script. It was using system `python` before which resolves to `/usr/bin/python2.7` on Raspbian, which is plain wrong I think. `sys.executable` resolves to the Python executable that octoprint uses, so the command becomes: ``` /home/pi/oprint/bin/python3 /home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/BME280.py 0x76 ``` instead of: ``` python /home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/BME280.py 0x76 ``` Lastly, it also properly logs errors that occur in the `BME280.py` script. Tested with Octopi 0.18.0 and octoprint 1.7.0.
thijstriemstra commented 2021-11-10 02:33:36 +00:00 (Migrated from github.com)

ping @vitormhenrique

ping @vitormhenrique
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/OctoPrint-Enclosure#444