Final problem solved - it was a monitor setting. Thanks to those who helped.
This gpiozero code works, and is a lot shorter and less complex than the RPI.GPIO code I was originally using on the Pi 4:My BENQ monitor has a setting named 'Input Auto Switch' which was set to ON and I have now set to OFF. After the wlr-randr code switched off the HDMI-1 monitor the 'Input Auto Switch' automatically cycled through to HDMI-2, then VGA and then back to HDMI-1 - which woke up HDMI-1. By not automatically cycling through the options the monitor stays off until motion reactivation.
This gpiozero code works, and is a lot shorter and less complex than the RPI.GPIO code I was originally using on the Pi 4:
Code:
from gpiozero import MotionSensorimport subprocessimport timepir = MotionSensor(7)while True: pir.wait_for_motion() subprocess.call(wlr-randr --output HDMI-A-1 --on) pir.wait_for_no_motion(timeout=60) subprocess.call(wlr-randr --output HDMI-A-1 --off)
Statistics: Posted by SimonDuffy — Tue Feb 13, 2024 9:35 pm