Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running 2 BME680 on 1 i2c bus with master/slave address - second sensor not initializing #1390

Open
bigfoot996 opened this issue Jul 18, 2024 · 1 comment

Comments

@bigfoot996
Copy link

bigfoot996 commented Jul 18, 2024

Describe the problem/bug

I'm trying to run 2 BME680 on the same i2c bus via master/slave (both sensors recognized by Pi on adresses 0x76 and 0x77).
Set up 2 inputs with the respective adresses in mycodo, but the slave sensor is not giving any measurments. The logs are showing the following:

2024-07-18 12:53:31,680 - ERROR - mycodo.utils.inputs - Error: Cannot add input modules because it does not have a unique name: BME680 2024-07-18 12:53:31,723 - ERROR - mycodo.inputs.bme680_backup_b737f7ce - Error initializing, trying again in 5 seconds: [Errno 121] Remote I/O error Traceback (most recent call last): File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize self.initialize() File "/home/admin/Mycodo/mycodo/inputs/bme680_backup.py", line 363, in initialize self.sensor = bme680.BME680( ^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme680/__init__.py", line 25, in __init__ self.chip_id = self._get_regs(CHIP_ID_ADDR, 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme680/__init__.py", line 296, in _get_regs return self._i2c.read_byte_data(self.i2c_addr, register) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 433, in read_byte_data ioctl(self.fd, I2C_SMBUS, msg) OSError: [Errno 121] Remote I/O error 2024-07-18 12:53:36,725 - ERROR - mycodo.inputs.bme680_backup_b737f7ce - Error initializing, trying again in 5 seconds: [Errno 121] Remote I/O error Traceback (most recent call last): File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize self.initialize() File "/home/admin/Mycodo/mycodo/inputs/bme680_backup.py", line 363, in initialize self.sensor = bme680.BME680( ^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme680/__init__.py", line 25, in __init__ self.chip_id = self._get_regs(CHIP_ID_ADDR, 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme680/__init__.py", line 296, in _get_regs return self._i2c.read_byte_data(self.i2c_addr, register) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 433, in read_byte_data ioctl(self.fd, I2C_SMBUS, msg) OSError: [Errno 121] Remote I/O error 2024-07-18 12:53:41,726 - ERROR - mycodo.inputs.bme680_backup_b737f7ce - Initialization errored 3 times; giving up. Maybe the following traceback can help diagnose the issue. Traceback (most recent call last): File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize self.initialize() File "/home/admin/Mycodo/mycodo/inputs/bme680_backup.py", line 363, in initialize self.sensor = bme680.BME680( ^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme680/__init__.py", line 25, in __init__ self.chip_id = self._get_regs(CHIP_ID_ADDR, 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme680/__init__.py", line 296, in _get_regs return self._i2c.read_byte_data(self.i2c_addr, register) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 433, in read_byte_data ioctl(self.fd, I2C_SMBUS, msg) OSError: [Errno 121] Remote I/O error 2024-07-18 12:53:41,727 - DEBUG - mycodo.controllers.controller_input_b737f7ce - get_measurement() found 2024-07-18 12:53:41,727 - DEBUG - mycodo.controllers.controller_input_b737f7ce - listener() not found 2024-07-18 12:53:41,727 - INFO - mycodo.controllers.controller_input_b737f7ce - Activated in 10128.4 ms 2024-07-18 12:53:41,727 - ERROR - mycodo.inputs.bme680_backup_b737f7ce - Error 101: Device not set up. See https://kizniche.github.io/Mycodo/Error-Codes#error-101 for more info.

Versions:

Mycodo Version: 8.5.13
Raspberry Pi Version: [e.g. 3B+] Raspberry Pi 5 8 GB
Raspbian OS Version: Debian 12 - 6.6.31+rpt-rpi2712

Reproducibility

always the same if you deactivate/activate it.

Expected behavior

Since the logs show something regarding the slave sensor doesn't get a unique name and probably that's the reason it can't be used probably, I would expect that "the logic" gives it a unique name in the initialization process for it to run properly.

Thanks and best greetings :)

@kizniche
Copy link
Owner

kizniche commented Sep 20, 2024

The first error is the result of you manually adding an input to the system that shares the same name as another (they must be unique). This is defined in the INPUT_INFORMATION['input_name_unique'] dict in the Input module. As for why it's not able to initialize, you would need to provide more information, such as: are you using custom code? What input(s) are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants