Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change code of Turn monitor on/off #288

Open
Fredi009sg opened this issue Apr 28, 2023 · 12 comments
Open

Change code of Turn monitor on/off #288

Fredi009sg opened this issue Apr 28, 2023 · 12 comments

Comments

@Fredi009sg
Copy link

Description

Since a while raspi core were modified and has removed "vcgencmd display_power" its not anymore possible to turn on and off the monitor. Which works for me as an alternative is the following code "xrandr -d :0 --output HDMI-1 --off" for turn monitor off and "xrandr -d :0 --output HDMI-1 --auto" for turn monitor on. Is there any change that you adjust the code ?

Changelog

No response

Requirements

No response

Additional info

No response

@kurnon
Copy link

kurnon commented May 16, 2023

This explains why my display hasn't been shutting off. Your suggestion did not work for me.

@ezeholz
Copy link
Collaborator

ezeholz commented May 19, 2023

Hi! Thanks for reporting this issue.

I'm not an owner of a RPi, so I cannot test those commands myself, but since there're many users of RC, we cannot take this change lightly. However, you could set you own config.js to point into the right direction, please check our FAQ and some older issues (#284 (comment)) to understand better my point.

Hope you stay well!

@biejay
Copy link

biejay commented May 25, 2023

Would appreciate as well!

@Killator
Copy link

Hi everyone,

I finally understand why my home automation couldn't turn off my mirror anymore... Thanks @Fredi009sg !
Moreover, your workaround proposal just work fine to turn OFF and ON the HDMI output.
(my setup: rPI3B / Debian Bulleye 64bit Full / Automated install script by sdetweil / MMM-Remote quick install)

Unfortunately we lose the function Monitor STATUS... I did some experiments with the command xrandr -d :0 --prop but I'm not a developer and I'm at the limit of my tweaking skills.

I understand that modification should not be made without careful consideration but maybe it would be possible to support several display managers... The default would remain vcgencmd but, with some configuration, we could support xrandr, tvservice, cec-client, etc... depending on the platforms.

What do you think of this proposal ?

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.

@ezeholz
Copy link
Collaborator

ezeholz commented Jun 26, 2023

@Killator there're certain modifications that can be made through the config file, no development needed. You can take a look into the Remote Control Wiki to understand better what I'm trying to point.

If any of you are up to, we can modify the Wiki and let there established diferent working methods for every RPi and Linux instance, so that anyone can check which commands works in their usecase.

@Killator
Copy link

Hi @ezeholz,

Thanks for your response ! It works perfectly with the customCommand feature !

config: {
  customCommand: {
    monitorOnCommand: 'xrandr -d :0 --output HDMI-1 --auto',
    monitorOffCommand: 'xrandr -d :0 --output HDMI-1 --off'
  }
}

It would be perfect with the monitorStatusCommand to trace the information in my home automation.
I've tried several times but can't find anything that works with xrandr...
Have you another brillant suggestion ? ;)

@ezeholz
Copy link
Collaborator

ezeholz commented Jul 11, 2023

Hey @Killator!

Glad that worked out perfectly.
About the status, I'm not an expert in this area, but I'll let you a command that I grab from Bard. I'm not sure if it's gonna work, but let me know if you test it or find any other solution.

monitorStatusCommand: 'grep -q "connected" $(xrandr --query | grep -E "HDMI-1|DP-1")'

@elykkyle
Copy link

elykkyle commented Oct 19, 2023

For the monitor status command, here's what i did to get it to work on my RPi3:
Create a script called "monitorstatus.sh":

#!/bin/bash
result=$(xrandr --listmonitors -d :0)
if [ "$result" = "Monitors: 0" ];
then
echo false
else
echo true
fi

make the script executable:
chmod +x monitorstatus.sh

Then add the custom command to the config:
monitorStatusCommand: '/path/to/script/monitorstatus.sh'

@ChrisRG711
Copy link

just in case it helps someone. here is what i just finally got to work
WAYLAND_DISPLAY="wayland-1" wlr-randr --output HDMI-A-1 --off
WAYLAND_DISPLAY="wayland-1" wlr-randr --output HDMI-A-1 --on

@ezeholz ezeholz pinned this issue Nov 25, 2023
@1a2a3a1q2s3c
Copy link

just in case it helps someone. here is what i just finally got to work WAYLAND_DISPLAY="wayland-1" wlr-randr --output HDMI-A-1 --off WAYLAND_DISPLAY="wayland-1" wlr-randr --output HDMI-A-1 --on

Can I know how do I get this to work on a schedule?
If I manually trigger the Wayland command in terminal, it works as per ON or OFF. But I have no luck setting a schedule. I tried cron but it doesn’t work or I’m doing it wrong.

do I install this remote control module and will be able to set a schedule or do I have to do some setting?

@Brianmarofsky
Copy link

The power on\off commands in this module work for me. The randr work but reset my screen rotation when I run it to turn back on.

This crontab works.

#OFF 11PM
00 22   * * *   root    vcgencmd display_power 0
#ON 6AM
00 6    * * *   root   vcgencmd display_power 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants