grenagit / MMM-PIR-Sensor-Lite

[Unmaintained] Magic Mirror Module managing monitor with PIR motion sensor (automatic standby when presence isn't detected)
MIT License
15 stars 10 forks source link

Loading status always displayed #13

Open Selyjohns opened 1 year ago

Selyjohns commented 1 year ago

Hello,

Thank you for this module. All works great since a long time.

But, there'is a strange problem that always display a loading status "Chargement..." See screen here

Here is the config.js

        {
                module: "MMM-PIR-Sensor-Lite",
                position: "top_right",
                config: {
                        title: "",
                        showDetection: false,
                        showCountDown: false,
                        sensorPin: 21, // GPIO pin
                        deactivateDelay: 30000,
                        commandType: 'vcgencmd',
                }
        },

Do you know why ? Thank you.

hervidero commented 10 months ago

You still have this issue? I had it too. Turned out this module wants to read the /dev/gpiomem folder with the pi user, but after upgrading my RPi to Bullseye (from Buster) and upgrading MagicMirror to 2.25 this folder has the wrong permissions for use with the mirror. Have a look here: https://raspberrypi.stackexchange.com/questions/124402/user-getting-removed-from-group-after-reboot

When you run the provided pir.py script from the commandline as user pi it will give an error: RuntimeError: Not running on a RPi!

Check with: ls -l /dev/gpiomem The folder should have crw-rw---- 1 root gpio <size, date, time> /dev/gpiomem for the module to work, but this folder probably only has crw------- 1 root root <etc, etc> on it.

I fixed it by adding below 2 commands to the crontab so it will 'stick' on reboots, as /dev/gpiomem is recreated (in memory) every reboot (note: it changes some of the security on your pi, use with caution):

sudo crontab -e
@reboot sudo chown root.gpio /dev/gpiomem
@reboot sudo chmod g+rw /dev/gpiomem

After this the MMM-PIR-Sensor-Lite worked again for me. (I forked the repo and made some other changes too).