Read the statement by Michael Teeuw here.
Switching the Magic Mirror display on/off
- 
 @Klinge at least this one 
 https://github.com/ambarusa/MMM-HomeAssistantprovides config options for the on/off commands monitorOnCommand: 'xrandr -d :0 --output HDMI-1 --auto --rotate right', monitorOffCommand: 'xrandr -d :0 --output HDMI-1 --off',
- 
 What you’re describing in Home Assistant sounds like a switch, not a button. They have different behaviours. This is important for what follows. Initially I had our mirror turning on/off on a schedule using crontab. But when I rebuilt it recently, I too wanted some Home Assistant integration to make this a little more intelligent ( turn on/off with the alarm system for e.g. ) I went a different route and installed an SSH integration in Home Assistant ( there are enough modules on the long suffering Pi 3B+ ! ) Using this integration, any SSH command can be turned into button like so :  If you’re using a Pi, you can use the following in the configuration options of the integration :  The actual code for your ease of use : - command: sudo shutdown -h now name: Turn off key: turn_off - command: sudo reboot name: Restart key: restart - command: vcgencmd display_power 0 name: Turn Screen Off key: turn_offf - command: vcgencmd display_power 1 name: Turn Screen On key: turn_onThat vcgencmd display_power command should work on pretty much an HDMI monitor This results in a bunch of buttons that you can use in your Home Assistant automations  
- 
 @Hilt vcgencmd no longer works on Bullseye (last release) or Bookworm (this release) of PI os @Hilt said in Switching the Magic Mirror display on/off: vcgencmd 
- 
 Thanks for the heads up Sam. I’m currently running Bullseye with kernel 6.1.21-v7+ and it still works in this revision. Admittedly I didn’t try with Bookworm as when I originally tried it ( Bookworm ) at launch, the VNC server had gone away on account of Wayland and alternatives were…interesting back then ( didn’t do too much research at the time to be fair ). So for this rebuild I just stuck with Bullseye. 2 quick questions for my own edification : - 
For Bookworm. Could the commands I listed for vcgencmd simply be replaced with wlr-randr --output HDMI-A-1 --on and wlr-randr --output HDMI-A-1 --off ( assuming HDMI port 1 ) for the same result ? 
- 
Another option according the the almighty but not always correct ChatGPT is to switch to X11 and then vcgencmd would work as expected ? 
 I have a spare Pi I could test on. I won’t however have time to tinker in the next few weeks. Curse having to adult !! Really appreciate your input 
- 
- 
 @Hilt said in Switching the Magic Mirror display on/off: Another option according the the almighty but not always correct ChatGPT is to switch to X11 and then vcgencmd would work as expected ? no, this is incorrect, as vcgencmd is no more , altho I see it on my bookworm system , it is not supposed to support display anymore… as for point 1, 
 when running wayland you can use the wlr-randr command
 when running x11 you can use the xrandr commandI don’t know the specifics of what each command needs. all linux commands come with help built in wlr-randr --help many provide more detailed info in the man page 
 man wlr-randr
 I see the man page for vcgencmd is there too
- 
 First of all, thank you for your tips. So, I use the module from ambarusa origin https://github.com/ambarusa/MMM-HomeAssistant/ (fetch) origin https://github.com/ambarusa/MMM-HomeAssistant/ (push)And use the following config module: “MMM-HomeAssistant”, config: { mqttServer: “mqtt://192.168.100.xx”, mqttPort: 1883, username: “mqttxxxx”, password: “xxxxx”, deviceName: “MagicMirror xxxx”, autodiscoveryTopic: “homeassistant”, monitorControl: true, brightnessControl: true, moduleControl: true, monitorStatusCommand: “xrandr --query | awk \”/Screen/ {print ($8 > 320) ? ‘true’ : ‘false’}\“”, monitorOnCommand: “wlr-randr --output HDMI-A-1 --on --transform 90”, monitorOffCommand: “wlr-randr --output HDMI-A-1 --off”, // monitorOnCommand: “xrandr -d :0 --output HDMI-1 --auto --rotate right”, // monitorOffCommand: “xrandr -d :0 --output HDMI-1 --off”, pm2ProcessName: “mm”, }As you can see, I use wlr-randr for on/off and rotate the monitor 90 degrees when switching it on. 
- 
 I think you’re right in calling it a switch. You can see it clearly in the screenshot at the arrow.  
- 
 Many thanks for the input. I’ll have a tinker when I find a gap and explore the commands and their respective soft switches. Just so that I’m future proof ! 
