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

RuntimeError: This module can only be run on a Raspberry Pi! #100

Closed
bobofruit4 opened this issue Jan 7, 2024 · 12 comments
Closed

RuntimeError: This module can only be run on a Raspberry Pi! #100

bobofruit4 opened this issue Jan 7, 2024 · 12 comments
Labels
stale There has not been activity on this issue or PR for quite some time.

Comments

@bobofruit4
Copy link

Freshly installed HA on RPI4 crashes:

[19:47:39] INFO: Starting MQTT IO...
2024-01-07 19:47:44 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 1269, in run
self._init_gpio_modules()
File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 244, in _init_gpio_modules
self.gpio_modules[gpio_config["name"]] = _init_module(
^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 128, in _init_module
return module_class(module_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/init.py", line 106, in init
self.setup_module()
File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 25, in setup_module
import RPi.GPIO as gpio # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/RPi/GPIO/init.py", line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/lib/python3.11/site-packages/mqtt_io/main.py", line 115, in
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 1269, in run
self._init_gpio_modules()
File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 244, in _init_gpio_modules
self.gpio_modules[gpio_config["name"]] = _init_module(
^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 128, in _init_module
return module_class(module_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/init.py", line 106, in init
self.setup_module()
File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 25, in setup_module
import RPi.GPIO as gpio # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/RPi/GPIO/init.py", line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
[19:47:44] INFO: Service MQTT IO exited with code 1 (by signal 0

My config file:

mqtt:
host: core-mosquitto
port: 1883
user: ""
password: "
"
topic_prefix: ha
ha_discovery:
enabled: yes

gpio_modules:

  • name: rpi
    module: raspberrypi

#digital_outputs:

- name: dioda_1

module: rpi

pin: 1

digital_inputs:

  • name: ogrod
    module: rpi
    pin: 0
    pullup: no
  • name: wejscie
    module: rpi
    pin: 1
    pullup: no
  • name: garaz
    module: rpi
    pin: 2
    pullup: no
  • name: alarm
    module: rpi
    pin: 3
    pullup: no

Any help?

@tsrab
Copy link

tsrab commented Jan 7, 2024

Same error here, was working before. After updating HA to 2024.1 things stopped working.

Add-on version: 0.4.0
You are running the latest version of this add-on.
System: Home Assistant OS 11.3 (aarch64 / raspberrypi4-64)
Home Assistant Core: 2024.1.2
Home Assistant Supervisor: 2023.12.0

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
[20:19:02] INFO: Starting MQTT IO...
2024-01-07 20:19:08 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 1269, in run
self._init_gpio_modules()
File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 244, in _init_gpio_modules
self.gpio_modules[gpio_config["name"]] = _init_module(
^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 128, in _init_module
return module_class(module_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/init.py", line 106, in init
self.setup_module()
File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 25, in setup_module
import RPi.GPIO as gpio # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/RPi/GPIO/init.py", line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/lib/python3.11/site-packages/mqtt_io/main.py", line 115, in
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 1269, in run
self._init_gpio_modules()
File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 244, in _init_gpio_modules
self.gpio_modules[gpio_config["name"]] = _init_module(
^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 128, in _init_module
return module_class(module_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/init.py", line 106, in init
self.setup_module()
File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 25, in setup_module
import RPi.GPIO as gpio # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/RPi/GPIO/init.py", line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!

@TBobsin
Copy link

TBobsin commented Jan 9, 2024

Same Problem

Tryed to
Remove & reinstall -> not working
Remove & reboot & reinstall -> not working
Changed Config: removed gpio_modules & digital_outputs -> running
Changed Config: removed digital_outputs -> running with message (yes expected)
Config did not validate due to errors in the following sections:
gpio_modules:
rpi:

  • GPIO module 'rpi' does not have any digital_input or digital_output configs

My System
Core 2024.1.2
Supervisor 2023.12.0
Operating System 11.3
Frontend 20240104.0

My mqtt-io/config.yml:

mqtt:
  host: ha-home
  port: 1883
  user: "mqtt"
  password: "mqtt"
  topic_prefix: mqtt-io/ha-home/gpio

  ha_discovery:
    enabled: yes

gpio_modules:
  - name: rpi
    module: raspberrypi

digital_outputs:
  - name: usbcharger
    module: rpi
    pin: 26


My Error Log

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.4.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 11.3  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2024.1.2
 Home Assistant Supervisor: 2023.12.0
-----------------------------------------------------------
 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
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
[14:56:00] INFO: Starting MQTT IO...
2024-01-09 14:56:05 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 1269, in run
    self._init_gpio_modules()
  File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 244, in _init_gpio_modules
    self.gpio_modules[gpio_config["name"]] = _init_module(
                                             ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 128, in _init_module
    return module_class(module_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/__init__.py", line 106, in __init__
    self.setup_module()
  File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 25, in setup_module
    import RPi.GPIO as gpio  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 23, in <module>
    from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
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 1269, in run
    self._init_gpio_modules()
  File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 244, in _init_gpio_modules
    self.gpio_modules[gpio_config["name"]] = _init_module(
                                             ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mqtt_io/server.py", line 128, in _init_module
    return module_class(module_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/__init__.py", line 106, in __init__
    self.setup_module()
  File "/usr/lib/python3.11/site-packages/mqtt_io/modules/gpio/raspberrypi.py", line 25, in setup_module
    import RPi.GPIO as gpio  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 23, in <module>
    from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
[14:56:05] INFO: Service MQTT IO exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
...

@itsib
Copy link

itsib commented Jan 10, 2024

The most falling apart plugin. If it doesn't update, it stops working. Version 0.4.0 I have the same problem as the guys above. Don't touch him already, let him work as he worked.

Yeah, well, I'm gonna go build my own mqttio plugin, with blackjack and hookers.

@gmoelter
Copy link

Here the same error in a similar addon. The error only occurs in HA OS 11.3 or 11.4.
The HA Core/HA Supervisor versions are not relevant. After downgrading to HA OS 11.2 everything works.

@markendr
Copy link

markendr commented Jan 19, 2024

Thanks @gmoelter for the tip on downgrading HA OS

I have workaround/hack with mqtt-io addon 0.4.0 after downgrading to HA OS 11.2 and turning off protection mode on the plugin settings

# ha os update --version 11.2

Copy link

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Feb 18, 2024
@TBobsin
Copy link

TBobsin commented Feb 19, 2024

The Problem is still there,
This Plug-in is still crashing, maybe the Problem is in the HA OS.
I could temporary use the older System but that is not an permanent Solution
MfG

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Feb 20, 2024
@TBobsin
Copy link

TBobsin commented Mar 14, 2024

Today i have installed the new Version of HomeAssistant OS, but the problem ist still the same :(
Core 2024.3.0
Supervisor 2024.03.0
Operating System 12.1
Frontend 20240306.0

The Plugin Version MQTT IO
Current version: 0.4.0

@gmoelter
Copy link

The RPi.GPIO library should be updated [https://github.com/home-assistant/operating-system/issues/3094].

@tjorim
Copy link

tjorim commented Apr 5, 2024

The RPi.GPIO library should be updated [https://github.com/home-assistant/operating-system/issues/3094].

Feel free to report it there. Be aware there weren't any updates since 2022: https://sourceforge.net/projects/raspberry-gpio-python/

Copy link

github-actions bot commented May 6, 2024

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label May 6, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
@mrk-its
Copy link
Contributor

mrk-its commented Jun 3, 2024

I just fixed this bug in my fork of RPi.GPIO: https://github.com/mrk-its/raspberry-gpio-python, and put following line in addon's mqtt-io/requirements.txt:

RPi.GPIO @ git+https://github.com/mrk-its/raspberry-gpio-python

@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale There has not been activity on this issue or PR for quite some time.
Projects
None yet
Development

No branches or pull requests

8 participants