I was just testing your module and was having trouble with thexrandr commands not having any effect. I added some additional logging to the exec() 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 in node_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:
pi@magicmirror:~/MagicMirror $ lsb_release -r
Release: 11
pi@magicmirror:~/MagicMirror $ uname -a
Linux magicmirror 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux
pi@magicmirror:~/MagicMirror $ cat /proc/cpuinfo | grep Model
Model : Raspberry Pi 3 Model B Plus Rev 1.3
And here's my config.js entry:
{
module: "MMM-PIR-Sensor-Lite",
position: "bottom_left",
config: {
sensorPin: 4,
rotation: "right",
deactivateDelay: 1 * 60 * 1000,
}
}
I was just testing your module and was having trouble with the
xrandrcommands 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; ignoringAfter a bit of playing around I was able to get it to work by changing the
exec()lines innode_helper.jsfrom: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: