Appdaemon and RPi.GPIO

Thanks, all good advice. Will try contacting frenk first then, if no luck, your other suggestions. I’m a bit of a noob here so could you point me to some webpage that explains alternative suitable ways to install Home Assistant and AD on the same raspberry Pi?

the best way is to go to the AD discord.
were always there.

but i advise to keep hassio, and then get a second RPI and install AD on that one.
(you could still keep what you already got, but just add a new RPI)

if you dont want extra hardware:

then i advise:

  1. save your ha configuration
  2. reinstall the PI with pinoob or whatever linux version is im moment normal for RPI
  3. read about pi venv (its just a few commands to create a venv)
  4. create 1 venv in which you install HA
  5. create another venv in which you install AD.
  6. read the docs from AD to configure AD correct

then you can do what you want,m whenever you want.
support for every step is there daily on our discord server.

Excellent! Will do and thanks so much for your prompt responses.

1 Like

I got in touch with frenck. You might be interested to read his reply. If I understand it correctly, it is not a permissions problem but instead a bug in Appdaemon.

you understand it wrong.

its a bug in the addon.
and the addon has nothing to do with appdaemon.
the addon is a small piece of code written by frenck that makes it possible to run appdaemon on hassio.

thats why frenck says that he will correct it, while he cant correct anything in appdaemon, because frenck is no dev from appdaemon.

thats also why it can be used when you install AD stand alone, and get in trouble with hassio. :wink:
its like i suspected the bug in the addon makes that AD cant reach the pins.

Oh I see! Thanks. All clear now.

Ok, I have followed your six steps and all seems to be working fine now. I am able to access the GPIO pins without any difficulty from an app I wrote running under AD.
Would you mind if I asked another question?
I want to switch HomeAssistant from using its default SQlite to MySQL (or Maria). Should this database be set up in the HA venv or AD venv or its own? I wish to write more AppDaemon apps that will process received 433mhz signals on the RPI GPIO pin (27) and insert a subset of these into the states (etc) tables directly of HA.
I hope this makes sense!

this question is not really related to this topic, it would have been better to call me in new topic or to come to our discord server.

but when i respond anyway ill give you an answer.

is mySQL or mariaDB a python program??
i dont think so, so its not setup in any venv, because you use python venv for AD and HA :wink:

apps that respond to a GPIO pin make sense, but you dont want to input GPIO data directly into the HA DB!!!
the only one that puts data into the DB should be HA.
the way you would need to handle it is to write apps, that give commands to HA, and HA then writes it into the DB.
if you try to write to the HA states table directly, then HA doesnt see that. so that info goes completely unknown.
if you want that just to save data, then you can, but i would advise to use a different DB for that.

if this answers your questions enough then great. if not, please PM me or come to the AD discord server: https://discord.gg/pHsjADY

Thanks. I think I see where to go next. Maybe something like the command line sensor… The reason why I’m following this approach is that HA, though it has the GPIO switch platform, doesn’t seem capable of reading varying data arriving via a GPIO pin then filtering and dealing with it. As in this page:

But my variation on the rpi-rf receive script rpi-rf_receive will be able to do this (sorting out the wanted sniffed codes from the noise arriving from the hundreds of nearby 433Mhz sensors in my neighbourhood). The idea is to put only those signals coming from a list (a sort of list of “paired sensors”) into HA. I will continue this discussion soon on Discord once I have thought it over. Thanks again.

1 Like

I know this is an old thread, but I wanted to share my solution because it took forever to figure out.
I am running HA and AppDaemon in Docker containers and attempting to use RPi.GPIO through the Adafruit Neopixel library. The solution to No access to /dev/mem (at least for my case) was to allow access to the gpiomem and spidev0.0 devices from the docker container. So docker run --name=appdaemon <other arguments> --device /dev/gpiomem --device /dev/spidev0.0 when initializing the container. I don’t have enough knowledge to comment on the device security risks of this, so that’s worth looking into.