0

Problem with "No access to /dev/mem."
I have HA in docker container on raspberry pi 4.
I can read temperature from the one wire sensor (GPIO4).
sensor:
  - platform: onewire
    names:
     28-3c01f09519d1: Sensor1

But when i wanted to manage gpio i get error.

switch:
  - platform: rpi_gpio
    ports:
      16: light

Error: "Error while setting up rpi_gpio platform for switch. RuntimeError: No access to /dev/mem. Try running as root!" In docker I tried to set:

   privileged: true
     command: ["--privileged"]
     devices:
       - /dev/mem:/dev/mem
       - /dev/gpiomem:/dev/gpiomem
     volumes:
       - /home/pi/homeassistant:/config
       - /dev/gpiomem:/dev/gpiomem
       - /dev/mem:/dev/mem

And I add user pi to group gpio. But nothing helps ...
Anyone know how to solve this?

PMF
  • 14,535
  • 3
  • 23
  • 49
Kamil
  • 51
  • 1
  • 6
  • Do you really have spaces in those paths? – PMF Oct 08 '21 at 08:12
  • oops i don't have it, it's a formatting error, i can't join them now – Kamil Oct 09 '21 at 16:46
  • Hmmm... Have you tried what it suggests, running the command in the container as root? Normally this shouldn't be required any more, though. – PMF Oct 09 '21 at 17:58
  • FYI There is also https://raspberrypi.stackexchange.com/ which may be helpful. – msanford Oct 09 '21 at 17:59
  • yes i tried everything. Download the latest system image and turn it on the docker again and it works for now. We'll see how long ... – Kamil Oct 11 '21 at 14:27

0 Answers0