Menu

#206 Not running on a RPi! on Pi4B running AWS Greengrass

Done
None
Critical
Patch
2022-09-24
2022-09-07
Eric Snyder
No

Having issues getting GPIO input on RPi4B using AWS Greengrass. I get the error:

RuntimeError: Not running on a RPi!.

My code looks like this:

import time
import datetime
import json
import awsiot.greengrasscoreipc
from awsiot.greengrasscoreipc.model import (
    PublishToTopicRequest,
    PublishMessage,
    JsonMessage
)
import RPi.GPIO as GPIO

channel = 20
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

while True:
    if GPIO.input(channel) == GPIO.LOW:
        print("Hello")
    time.sleep(5)

The error happens on the first line that actually uses the library:

   GPIO.setmode(GPIO.BCM)

I do see this two year old issue that is similar but I believe that because this is running in the greengrass framework my issue would be a bit different.

https://sourceforge.net/p/raspberry-gpio-python/tickets/171/

I originally started out with gpiozero and had the same issue. They sent me here. Here is a link to that issue.

Discussion

  • Eric Snyder

    Eric Snyder - 2022-09-08

    I have learned a bit more. When I run commands in the cli as the greengrass user I get the errors. It definitely seems to be a hardware detection error that is happening but only when run a certain users.

     
  • Eric Snyder

    Eric Snyder - 2022-09-08

    Solved. Adding the user that greengrass runs as to the group gpio fixed the issue.

     
  • Ben Croston

    Ben Croston - 2022-09-24
    • status: New --> Done
    • assigned_to: Ben Croston
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.