Support #982
Updated by Daniel Curtis 4 days ago
This is a guide on using systemd timers to automatically turn on and off an HDMI display at specified times. h2. Setup the Timers h3. Display Off Timer * Create a service file to turn off the display: <pre> sudo nano /etc/systemd/system/display-off.service </pre> #* Add the following: <pre> [Service] ExecStart=/usr/bin/vcgencmd display_power 0 </pre> * Create a timer file to turn off the display: <pre> sudo nano /etc/systemd/system/display-off.timer </pre> #* Add the following: <pre> [Unit] Description=Run display power off at 10pm Everyday [Timer] OnCalendar=*-*-* 22:00:00 [Install] WantedBy=timers.target </pre> h3. Display On Timer * Create a service file to turn on the display: <pre> sudo nano /etc/systemd/system/display-on.service </pre> #* Add the following: <pre> [Service] ExecStart=/usr/bin/vcgencmd display_power 1 </pre> * Create a timer file to turn off the display: <pre> sudo nano /etc/systemd/system/display-off.timer </pre> #* Add the following: <pre> [Unit] Description=Run display power on at 7am Everyday [Timer] OnCalendar=*-*-* 07:00:00 [Install] WantedBy=timers.target </pre> * Reload systemd, then start systemd and enable both timers: <pre> sudo systemctl daemon-reload sudo systemctl enable display-off.timer sudo systemctl enable display-on.timer sudo systemctl start display-off.timer sudo systemctl start display-on.timer </pre> * Verify the timer is added to the timers list: <pre> sudo systemctl list-timers </pre> h2. Resources * https://wiki.archlinux.org/title/Systemd/Timers * https://seb.jambor.dev/posts/systemd-by-example-part-5-timers/