kbrownlees / bme280 Goto Github PK
View Code? Open in Web Editor NEWPython Driver for the BME280 Temperature/Pressure/Humidity Sensor from Bosch
License: Other
Python Driver for the BME280 Temperature/Pressure/Humidity Sensor from Bosch
License: Other
Hi
I use bme280 0.3 package. As "i2cdetect -y 1" command returns, my BME280 has address 0x77 and "read_bme280 -- help" command works well. But when I test "read_bme280 --i2c-address 0x77" command, following error appears:
Traceback (most recent call last):
File "/usr/local/bin/read_bme280", line 9, in
load_entry_point('bme280==0.3', 'console_scripts', 'read_bme280')()
File "/usr/local/lib/python3.4/dist-package/bme280/bme280.py", line 210, in main
bme280_i2c.set_default_bus(int(args.i2c_bus))
File "/usr/local/lib/python3.4/dist-package/bme280/bme280.py", line 22, in set_default_bus
default_bus = smbus.SMBus(bus_number)
AttributeError: 'NoneType' object has no attribute 'SMBus'
Can anybody help me?
Looking at the read_bme280 script, the minimal script to read a sensor data from Python is:
from bme280 import bme280, bme280_i2c
bme280_i2c.set_default_i2c_address(0x76)
bme280_i2c.set_default_bus(1)
bme280.setup()
data = bme280.read_all()
Instead I would expect the following minimal script, which would make it honor Python unspoken standards (cf. import statistics
):
import bme280
bme280.setup() # or bme280.setup(0x76, 1)
data = bme280.read_all()
This avoids exposing the i2c class, so that once a SPI class becomes available as a backend, it'll be easier to switch.
On Raspbian (Jessie), the read_bme binary is not known by the plugin:
$ sudo munin-run bme280_temperature
/etc/munin/plugins/bme280_humidity: 21: /etc/munin/plugins/bme280_humidity: read_bme280: not found
Dear Sir
Tried to follow your installation description pip install bme280 and it didnt work, it didnt find the read_bme280 file, than I have found out that it did install it in some place pi/.local.
the fix for it was to use sudo pip install or run the pip install as root.
I recommend that you add this info for installation process to run as root or use sudo.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.