bugsounet / MMM-Pir

Manage your screen with a pir sensor
MIT License
35 stars 10 forks source link

Screen error detected: wlr-randr command error (mode 3) #120

Closed htilburgs closed 2 weeks ago

htilburgs commented 2 weeks ago

Using v2.0.0 for several weeks now (first tested with DEV and now with the official release) without problems. Suddenly I get an error on my MagicMirror, everytime it wakes up:

Screen error detected: wlr-randr command error (mode 3)

I don't know what changed that causes this. If you need more info, please ask.

CONFIG.JS

                        module: 'MMM-Pir',
                        position: 'bottom_right',
                        config: {
                                debug: false,
                                Display: {
                                        timeout: 1 * 60 * 1000,
                                        animate: true,
                                        style: 2,
                                        colorFrom: "#FF0000",
                                        colorTo: "#00FF00",
                                        mode: 3,
                                        counter: true,
                                        lastPresence: false,
                                        lastPresenceTimeFormat: "LL H:mm",
                                        availability: false,
                                        autoDimmer: false,
                                        xrandrForceRotation: "normal",
                                        wrandrForceRotation: "270",
                                        wrandrForceMode: "1920x1080",
                                        wrandrDisplayName: "wayland-1"
                                },
                        Pir: {
                                mode: 0,
                                gpio: 17
                        },
                        Cron: {
                                ON: [],
                                OFF: []
                        },
                        Touch: {
                                mode: 3
                        },
                        Governor: {
                                sleeping: 4,
                                working: 2
                        },
                        Sounds: {
                                on: "open.mp3",
                                off: "close.mp3"
                        }
                }
        },
htilburgs commented 2 weeks ago

In the startup Log I see

[2024-11-13 16:23:03.919] [LOG]   [MMM-Pir] Version: 2.2.0 rev: 241112 
[2024-11-13 16:23:03.924] [LOG]   [MMM-Pir] [LIB] [PIR] Mode 0 Selected (gpiod library) 
[2024-11-13 16:23:04.033] [LOG]   [MMM-Pir] [LIB] [PIR] [GPIOD] Found chip 0: pinctrl-bcm2711 
[2024-11-13 16:23:04.059] [LOG]   [MMM-Pir] [LIB] [PIR] Started! 
[2024-11-13 16:23:04.067] [LOG]   [MMM-Pir] [LIB] [GOVERNOR] Governor library initialized... 
[2024-11-13 16:23:04.147] [LOG]   [MMM-Pir] [LIB] [SCREEN] Mode 3: wlr-randr (primary display) -- Rotation: 270 
[2024-11-13 16:23:04.161] [LOG]   [MMM-Pir] [LIB] [SCREEN] Mode 3: wlr-randr -- ForceMode: 1920x1080 
[2024-11-13 16:23:04.170] [LOG]   [MMM-Pir] [LIB] [SCREEN] Mode 3: wlr-randr -- DisplayName : wayland-0 
[2024-11-13 16:23:04.293] [LOG]   [MMM-Pir] [LIB] [CRON] [MODE] Disabled. 
[2024-11-13 16:23:04.297] [LOG]   [MMM-Pir] Started! 

In the MagicMirror error log I see following

[ERROR] [MMM-Pir] [LIB] [SCREEN] wlr-randr: Error: Command failed: WAYLAND_DISPLAY=wayland-0 wlr-randr | grep 'Enabled'
failed to connect to display

Strange thing is that in my config.js file I have put wrandrDisplayName: "wayland-1"

htilburgs commented 2 weeks ago

I've been testing and when I manualy change MMM-Pir.js "waylandDisplayName: "wayland-0" into "waylandDisplayName: "wayland-1" the error disappears and everything works fine. Maybe you can check this out.....

Module.register("MMM-Pir", {
  requiresVersion: "2.28.0",
  defaults: {
    debug: false,
    Display: {
      animate: true,
      colorFrom: "#FF0000",
      colorTo: "#00FF00",
      timeout: 2 * 60 * 1000,
      mode: 1,
      counter: true,
      style: 1,
      lastPresence: true,
      lastPresenceTimeFormat: "LL H:mm",
      availability: true,
      autoDimmer: false,
      xrandrForceRotation: "normal",
      wrandrForceRotation: "normal",
      wrandrForceMode: null,
      waylandDisplayName: "wayland-0"
    },
bugsounet commented 2 weeks ago

since v2.2.0 there is a change in config see there

You can disvover that wrandrDisplayName feature is renamed to waylandDisplayName

htilburgs commented 2 weeks ago

So, that was hard to see! Thank you, all works again.