MMM-Remote-Control icon indicating copy to clipboard operation
MMM-Remote-Control copied to clipboard

[Change Request] Change code of Turn monitor on/off

Open Fredi009sg opened this issue 2 years ago • 15 comments

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

Fredi009sg avatar Apr 28 '23 21:04 Fredi009sg

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

kurnon avatar May 16 '23 15:05 kurnon

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 (https://github.com/Jopyth/MMM-Remote-Control/issues/284#issue-1453176615) to understand better my point.

Hope you stay well!

ezeholz avatar May 19 '23 01:05 ezeholz

Would appreciate as well!

biejay avatar May 25 '23 23:05 biejay

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 ?

Killator avatar May 29 '23 15:05 Killator

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.

github-actions[bot] avatar Jun 19 '23 01:06 github-actions[bot]

@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.

ezeholz avatar Jun 26 '23 01:06 ezeholz

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 ? ;)

Killator avatar Jul 11 '23 16:07 Killator

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")'

ezeholz avatar Jul 11 '23 16:07 ezeholz

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'

elykkyle avatar Oct 19 '23 20:10 elykkyle

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

ChrisRG711 avatar Nov 20 '23 17:11 ChrisRG711

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?

1a2a3a1q2s3c avatar Dec 09 '23 13:12 1a2a3a1q2s3c

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

Brianmarofsky avatar Jan 03 '24 00:01 Brianmarofsky