Open john3300 opened 1 year ago
Strange, everything works fine for me (same config)...
What is the result of xrandr --listmonitors
?
pi@magicmirror:~ $ xrandr --listmonitors
Can't open display
pi@magicmirror:~ $ DISPLAY=:0 xrandr --listmonitors
Monitors: 0
Same problem here with this setup:
umberto@magicmirror:~ $ lsb_release -r
No LSB modules are available.
Release: 12
umberto@magicmirror:~ $ uname -a
Linux magicmirror 6.1.0-rpi4-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.54-1+rpt2 (2023-10-05) aarch64 GNU/Linux
umberto@magicmirror:~ $ cat /proc/cpuinfo | grep Model
Model : Raspberry Pi 3 Model B Rev 1.2
and this config:
{
module: "MMM-PIR-Sensor-Lite",
position: "top_right",
config: {
sensorPin: 4, // GPIO pin
commandType: "xrandr",
hdmiPort: "HDMI-1",
rotation: "left",
deactivateDelay: 10 * 60 * 1000, //10 mins
}
},
I found that I needed to set the display when I was connected over SSH. If I ran the commands directly from the machine it worked. I don't know if that helps you, but it might point you in the right direction for finding a solution.
I found that I needed to set the display when I was connected over SSH. If I ran the commands directly from the machine it worked. I don't know if that helps you, but it might point you in the right direction for finding a solution.
And how to set the Display? Can you give more Informations please?
I was just testing your module and was having trouble with the
xrandr
commands not having any effect. I added some additional logging to theexec()
command to capture stderr and found this for both turning the display on and off:[ERROR] stderr: warning: output HDMI-1 not found; ignoring
After a bit of playing around I was able to get it to work by changing the
exec()
lines innode_helper.js
from:exec("xrandr --output " ...
to:exec("DISPLAY=:0 xrandr --output " ...
With this change in place, both on and off are working. I don't know why my system needs that to work, but I thought I would share it with you in case this is something you haven't seen before. Maybe something to add to your implementation? I can submit a PR with the change if you would like.
Here's my system information if you're interested:
And here's my config.js entry: