Hello, I am using node red since several month successfully. I am running a python3 script by node red. This script is monitoring a gpio port and notifies if there is a falling edge. I could run this python script successfully until Home Assistant OS < 5.8. Since my upgrade I am getting the following error:
16 Jan 19:59:18 - [info] [debug:Debug - Es hat geklingelt - Fehler]
Traceback (most recent call last):
File "/share/doorbell_server.py", line 4, in <module>
16 Jan 19:59:18 - [info] [debug:Debug - Es hat geklingelt - Fehler]
import RPi.GPIO as gpio
File "/usr/lib/python3.8/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!
Does anyone have an idea for a solution? This is my nodered configuration:
credential_secret: admin
dark_mode: false
http_node:
username: ''
password: ''
http_static:
username: ''
password: ''
ssl: false
certfile: fullchain.pem
keyfile: privkey.pem
require_ssl: true
system_packages: []
npm_packages: []
init_commands: []
This is the python script I am running:
#!/usr/bin/env python3
# coding=utf8
import time
import shutil
import RPi.GPIO as gpio
import os
import sys
#Einstellungen
klingel_gpio = 4 #GPIO, der mit der Schaltung verbunden ist
gpio.setmode(gpio.BCM)
gpio.setup(klingel_gpio, gpio.IN, pull_up_down=gpio.PUD_UP)
gpio.add_event_detect(klingel_gpio, gpio.FALLING)
gpio.event_detected(klingel_gpio)
while True:
time.sleep(1)
if gpio.event_detected(klingel_gpio):
print("Es hat gebimmelt.")
time.sleep(5)
gpio.event_detected(klingel_gpio)
For calling the python script, I am using an exec node.