Hi,
On Raspberry Pi 3 (Home Assistant OS 10.1), i2c enabled, MQTT-IO addon installed. I’ve got an error when try to starting it :
PermissionError: [Errno 1] Operation not permitted: '/dev/i2c-0'
I assume the MQTT-IO addon has no “right to use” i2c hardware…
The config.yml used :
mqtt:
host: localhost
port: 1883
user: ****
password: ****
ha_discovery:
enabled: yes
topic_prefix: home/meteo
sensor_modules:
- name: bme280_sensor
module: bme280
i2c_bus_num: 0
chip_addr: 0x76
sensor_inputs:
- name: temperature
module: bme280_sensor
interval: 30
digits: 1
type: temperature
ha_discovery:
name: temperature_ext
device_class: temperature
unit_of_measurement: "°C"
- name: pressure
module: bme280_sensor
interval: 30
digits: 1
type: pressure
ha_discovery:
name: pressure_ext
device_class: pressure
unit_of_measurement: "hPa"
The full log from the addon :
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
Add-on: MQTT IO
Expose GPIO modules and digital sensors via MQTT for remote control and monitoring.
-----------------------------------------------------------
Add-on version: 0.2.1
You are running the latest version of this add-on.
System: Home Assistant OS 10.1 (aarch64 / raspberrypi3-64)
Home Assistant Core: 2023.5.4
Home Assistant Supervisor: 2023.05.dev2301
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
Log level is set to DEBUG
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service mqtt-io: starting
s6-rc: info: service mqtt-io successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[07:31:17] INFO: Starting MQTT IO...
2023-05-24 07:31:32 mqtt_io.__main__ [ERROR] MqttIo crashed!
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mqtt_io/__main__.py", line 107, in main
mqtt_gpio.run()
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 1242, in run
self._init_sensor_modules()
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 255, in _init_sensor_modules
self.sensor_modules[sens_config["name"]] = _init_module(
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 128, in _init_module
return module_class(module_config)
File "/usr/lib/python3.10/site-packages/mqtt_io/modules/sensor/__init__.py", line 22, in __init__
self.setup_module()
File "/usr/lib/python3.10/site-packages/mqtt_io/modules/sensor/bme280.py", line 38, in setup_module
self.bus = SMBus(self.config["i2c_bus_num"])
File "/usr/lib/python3.10/site-packages/smbus2/smbus2.py", line 280, in __init__
self.open(bus)
File "/usr/lib/python3.10/site-packages/smbus2/smbus2.py", line 310, in open
self.fd = os.open(filepath, os.O_RDWR)
PermissionError: [Errno 1] Operation not permitted: '/dev/i2c-0'
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.10/site-packages/mqtt_io/__main__.py", line 115, in <module>
main()
File "/usr/lib/python3.10/site-packages/mqtt_io/__main__.py", line 107, in main
mqtt_gpio.run()
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 1242, in run
self._init_sensor_modules()
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 255, in _init_sensor_modules
self.sensor_modules[sens_config["name"]] = _init_module(
File "/usr/lib/python3.10/site-packages/mqtt_io/server.py", line 128, in _init_module
return module_class(module_config)
File "/usr/lib/python3.10/site-packages/mqtt_io/modules/sensor/__init__.py", line 22, in __init__
self.setup_module()
File "/usr/lib/python3.10/site-packages/mqtt_io/modules/sensor/bme280.py", line 38, in setup_module
self.bus = SMBus(self.config["i2c_bus_num"])
File "/usr/lib/python3.10/site-packages/smbus2/smbus2.py", line 280, in __init__
self.open(bus)
File "/usr/lib/python3.10/site-packages/smbus2/smbus2.py", line 310, in open
self.fd = os.open(filepath, os.O_RDWR)
PermissionError: [Errno 1] Operation not permitted: '/dev/i2c-0'
[07:31:33] INFO: Service MQTT IO exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service mqtt-io: stopping
s6-rc: info: service mqtt-io successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
Thanks for any help !