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.