flyte/mqtt-io

MQTT Io On OrangePi 5

Opened this issue · 1 comments

Describe the bug
I am running HA (supervised) on my OrangePi 5 Plus under Debian 12 (Bookworm) with latest updates of both OS and HA.
I setup the config.yml file as follows:

Errors appear below in the proper section.

Expected behavior
No errors in the log file (set to debug).

Error messages and traceback
See errors from the log file:
[19:25:01] INFO: Starting MQTT IO... Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/ Collecting OPi.GPIO Downloading OPi.GPIO-0.5.2-py2.py3-none-any.whl (33 kB) Installing collected packages: OPi.GPIO Successfully installed OPi.GPIO-0.5.2 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv /usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/orangepi.py:63: UserWarning: Pull up/down setting are not (yet) fully supported, continuing anyway. Use GPIO.setwarnings(False) to disable warnings. self.io.setup(pin, direction, pull_up_down=pullup, initial=initial_int) 2024-02-10 19:25:09 mqtt_io.__main__ [ERROR] MqttIo crashed! Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/mqtt_io/__main__.py", line 107, in main mqtt_gpio.run() File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 1270, in run self._init_digital_inputs() File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 387, in _init_digital_inputs gpio_module.setup_pin_internal(PinDirection.INPUT, in_conf) File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/__init__.py", line 208, in setup_pin_internal return self.setup_pin( ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/orangepi.py", line 63, in setup_pin self.io.setup(pin, direction, pull_up_down=pullup, initial=initial_int) File "/usr/lib/python3.11/site-packages/OPi/GPIO.py", line 480, in setup raise e File "/usr/lib/python3.11/site-packages/OPi/GPIO.py", line 472, in setup sysfs.export(pin) File "/usr/lib/python3.11/site-packages/OPi/sysfs.py", line 37, in export with open(path, "w") as fp: ^^^^^^^^^^^^^^^ OSError: [Errno 30] Read-only file system: '/sys/class/gpio/export' Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/lib/python3.11/site-packages/mqtt_io/__main__.py", line 115, in <module> main() File "/usr/lib/python3.11/site-packages/mqtt_io/__main__.py", line 107, in main mqtt_gpio.run() File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 1270, in run self._init_digital_inputs() File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 387, in _init_digital_inputs gpio_module.setup_pin_internal(PinDirection.INPUT, in_conf) File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/__init__.py", line 208, in setup_pin_internal return self.setup_pin( ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/orangepi.py", line 63, in setup_pin self.io.setup(pin, direction, pull_up_down=pullup, initial=initial_int) File "/usr/lib/python3.11/site-packages/OPi/GPIO.py", line 480, in setup raise e File "/usr/lib/python3.11/site-packages/OPi/GPIO.py", line 472, in setup sysfs.export(pin) File "/usr/lib/python3.11/site-packages/OPi/sysfs.py", line 37, in export with open(path, "w") as fp: ^^^^^^^^^^^^^^^ OSError: [Errno 30] Read-only file system: '/sys/class/gpio/export' [19:25:09] 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
Paste any error messages and Python traceback if applicable.


**Config**
Here is the config.yml file:

`mqtt:
  host: localhost
  topic_prefix: front_gate
  ha_discovery:
    enabled: yes

gpio_modules:
  - name: orangepi5
    module: orangepi

digital_inputs:
  - name: front_gate_state
    module: orangepi5
    pin: 11`

**Hardware**
 - OrangePi 5Plus
 - Built in GPIO

**System:**
 - OS: Debian 12 (Bookworm)
 - Python version: 3.11.2
 - User you're running as: root
 - Using a virtualenv?: not sure. Followed the installation instructions

**Additional context**
Add any other context about the problem here.

Hi @niraviry,

it looks like, that orangepi module can't set the gpio:

in setup sysfs.export(pin) File "/usr/lib/python3.11/site-packages/OPi/sysfs.py", line 37, in export with open(path, "w") as fp:
OSError: [Errno 30] Read-only file system: '/sys/class/gpio/export'

Any clue, while the file system can't be written?