flyte/mqtt-io

[ERROR] MqttIo crashed! error from RPi import GPIO

megapearl opened this issue · 1 comments

Describe the bug
Does not install, misses Rpi

Expected behavior
Pull image, start, no errors

Error messages and traceback

Collecting adafruit_circuitpython_mcp230xx
  Downloading adafruit_circuitpython_mcp230xx-2.5.9-py3-none-any.whl (18 kB)
Collecting Adafruit-Blinka
  Downloading Adafruit_Blinka-8.16.1-py3-none-any.whl (287 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 287.3/287.3 KB 6.8 MB/s eta 0:00:00
Collecting adafruit-circuitpython-busdevice
  Downloading adafruit_circuitpython_busdevice-5.2.3-py3-none-any.whl (7.4 kB)
Collecting Adafruit-PlatformDetect>=3.13.0
  Downloading Adafruit_PlatformDetect-3.42.0-py3-none-any.whl (20 kB)
Collecting pyftdi>=0.40.0
  Downloading pyftdi-0.54.0-py3-none-any.whl (144 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 144.8/144.8 KB 6.3 MB/s eta 0:00:00
Collecting Adafruit-PureIO>=1.1.7
  Downloading Adafruit_PureIO-1.1.10.tar.gz (28 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting adafruit-circuitpython-typing
  Downloading adafruit_circuitpython_typing-1.9.0-py3-none-any.whl (10 kB)
Collecting pyusb!=1.2.0,>=1.0.0
  Downloading pyusb-1.2.1-py3-none-any.whl (58 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.4/58.4 KB 4.0 MB/s eta 0:00:00
Collecting pyserial>=3.0
  Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.6/90.6 KB 5.5 MB/s eta 0:00:00
Collecting typing-extensions~=4.0
  Downloading typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Collecting adafruit-circuitpython-requests
  Downloading adafruit_circuitpython_requests-1.13.0-py3-none-any.whl (11 kB)
Building wheels for collected packages: Adafruit-PureIO
  Building wheel for Adafruit-PureIO (setup.py): started
  Building wheel for Adafruit-PureIO (setup.py): finished with status 'done'
  Created wheel for Adafruit-PureIO: filename=Adafruit_PureIO-1.1.10-py3-none-any.whl size=11638 sha256=9b09e4c0004f769e7a61b4dc82ae5fb01b160dff305a55d762660d406766fec8
  Stored in directory: /home/mqtt_io/.cache/pip/wheels/8f/c9/50/c0b7eab9b294ddab1669fef324be21c44fbc30a0ebc6bdddba
Successfully built Adafruit-PureIO
Installing collected packages: pyserial, Adafruit-PlatformDetect, typing-extensions, pyusb, Adafruit-PureIO, pyftdi, adafruit-circuitpython-requests, Adafruit-Blinka, adafruit-circuitpython-typing, adafruit-circuitpython-busdevice, adafruit_circuitpython_mcp230xx
  Attempting uninstall: typing-extensions
    Found existing installation: typing-extensions 3.10.0.2
    Uninstalling typing-extensions-3.10.0.2:
      Successfully uninstalled typing-extensions-3.10.0.2
Successfully installed Adafruit-Blinka-8.16.1 Adafruit-PlatformDetect-3.42.0 Adafruit-PureIO-1.1.10 adafruit-circuitpython-busdevice-5.2.3 adafruit-circuitpython-requests-1.13.0 adafruit-circuitpython-typing-1.9.0 adafruit_circuitpython_mcp230xx-2.5.9 pyftdi-0.54.0 pyserial-3.5 pyusb-1.2.1 typing-extensions-4.5.0
WARNING: You are using pip version 22.0.4; however, version 23.0.1 is available.
You should consider upgrading via the '/home/mqtt_io/venv/bin/python -m pip install --upgrade pip' command.
2023-03-24 18:48:20 mqtt_io.__main__ [ERROR] MqttIo crashed!
Traceback (most recent call last):
  File "/home/mqtt_io/mqtt_io/__main__.py", line 107, in main
    mqtt_gpio.run()
  File "/home/mqtt_io/mqtt_io/server.py", line 1227, in run
    self._init_gpio_modules()
  File "/home/mqtt_io/mqtt_io/server.py", line 244, in _init_gpio_modules
    self.gpio_modules[gpio_config["name"]] = _init_module(
  File "/home/mqtt_io/mqtt_io/server.py", line 128, in _init_module
    return module_class(module_config)
  File "/home/mqtt_io/mqtt_io/modules/gpio/__init__.py", line 105, in __init__
    self.setup_module()
  File "/home/mqtt_io/mqtt_io/modules/gpio/mcp23017.py", line 40, in setup_module
    import board  # type: ignore
  File "/home/mqtt_io/venv/lib/python3.8/site-packages/board.py", line 44, in <module>
    from adafruit_blinka.board.raspberrypi.raspi_4b import *
  File "/home/mqtt_io/venv/lib/python3.8/site-packages/adafruit_blinka/board/raspberrypi/raspi_4b.py", line 6, in <module>
    from adafruit_blinka.microcontroller.bcm2711 import pin
  File "/home/mqtt_io/venv/lib/python3.8/site-packages/adafruit_blinka/microcontroller/bcm2711/pin.py", line 5, in <module>
    from RPi import GPIO

Config docker-compose.yaml

version: '3.8'
networks:                                
  default:                               
    driver: bridge                       
  gpio2mqtt:
    container_name: gpio2mqtt
    hostname: gpio2mqtt
    privileged: true
    restart: unless-stopped
    image: flyte/mqtt-io
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/dockers/gpio2mqtt/config.yml:/config.yml
    devices:
      - /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A104PB89-if00-port0:/dev/ttyUSB0
      - /dev/i2c-1:/dev/i2c-1
    environment:
      - PUID=1014
      - PGID=104
      - TZ=Europe/Amsterdam

config.yml

mqtt:
  host: shed-mqtt.flissinger.local
  port: 1883
  user: *****
  password: *****
  topic_prefix: home-domotica

gpio_modules:
  - name: mcp23017_input
    module: mcp23017
    chip_addr: 0x20
  - name: mcp23017_output
    module: mcp23017
    chip_addr: 0x21

digital_inputs:
  - name: Livingroom Wall 1
    module: mcp23017_input
    pin: 0
  - name: Livingroom Wall 2
    module: mcp23017_input
    pin: 1
  - name: Livingroom Wall 3
    module: mcp23017_input
    pin: 2
  - name: Livingroom Wall 4
    module: mcp23017_input
    pin: 3
  - name: Livingroom Bar 1
    module: mcp23017_input
    pin: 4
  - name: Livingroom Bar 2
    module: mcp23017_input
    pin: 5
  - name: Livingroom Bar 3
    module: mcp23017_input
    pin: 6
  - name: Livingroom Bar 4
    module: mcp23017_input
    pin: 7
  - name: Hallway Light
    module: mcp23017_input
    pin: 8
  - name: Frontdoor Light
    module: mcp23017_input
    pin: 9
  - name: Frontdoor Pushbutton
    module: mcp23017_input
    pin: 10
  - name: Frontdoor Phone
    module: mcp23017_input
    pin: 11

digital_outputs:
  - name: Frontdoor Lock
    module: mcp23017_output
    pin: 0
  - name: Hallway Light
    module: mcp23017_output
    pin: 1
  - name: Frontdoor Light
    module: mcp23017_output
    pin: 2
  - name: Livingroom Light Table
    module: mcp23017_output
    pin: 3
  - name: Livingroom Light Wall
    module: mcp23017_output
    pin: 4

stream_modules:
  - name: Cupboard Alarm
    module: serial
    device: /dev/ttyUSB0
    baud: 19200

Hardware

  • Platform: Raspberry Pi 4 powered by PoE
  • Connected hardware: dual mcp23017, ssd via usb3

System:

  • OS: raspbian lite x64 (6.1.19-v8+ #1637 SMP PREEMPT Tue Mar 14 11:11:47 GMT 2023 aarch64 GNU/Linux)
  • Python version: v3.9.2
  • User you're running as: gpio2mqtt
  • Using a virtualenv?: no, docker

Additional context
None

Started from scratch, installed raspbian lite on pi, and installed using pip, and working fine.