MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. rkorell
    3. Best
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    R
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 25
    • Posts 419
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Problems with WLAN connectivity - solved

      Dear @schlomm , team,

      as I learned today sometimes system limitations are hard and leads to unwanted results.
      I even got more serioous trouble with my pi and his WIFI so I had to dig in deeper.
      The aproach until now - because of “growing” up - is a “recovery” and a “diagnose” part.
      This leads to - surprise, surprise :-) - inconsistent data and so dignosis is merely impossible.
      For this reason I converged both approches into one script and implemented a 4-stages error-handling and consecutive escalation (until reboot).

      At this stage i had to recognize: almost EVERY test results immediatly in an error at stage 1 (ping) and was resolved at stage 2 (L2/L3 - ICMP problem – checking status of wlan interface).
      To identify root cause for this I - again - dig down deeply (ChatGPT was NOT that helpful!) and found: At systemd level (on my system!?) ping is not in PATH !!!
      So a fully qualified call solved this problem - and most of my “problems” are solved !

      If you are using “ping”, too and stuck in problems in scripts - keep this in mind: “usr/bin/ping” might be really helpful for you.

      If you are interested in, here my current recovery-script - including some useful logging information:

      /usr/local/bin/wlan-recovery.sh
      #!/bin/bash
      # ============================================================================
      # WLAN Recovery Script (Monolithische Version)
      # Autor: Dr.  Ralf Korell, MD 
      # Datum: 2025-10-07
      #
      # Dieses Script wird per systemd-Timer regelmäßig aufgerufen.
      # Es prüft die WLAN-Verbindung in mehreren Stufen und führt nur dann
      # Recovery-Aktionen aus, wenn wirklich eine Unterbrechung vorliegt.
      #
      # Features:
      #   - Mehrstufige Diagnose (Ping, iw, IP, Route)
      #   - Schutz vor Fehlalarmen und Selbstabschüssen
      #   - SSH/VNC-Safe-Mode (keine Unterbrechung aktiver Sessions)
      #   - Logrotation + Statistikdatei
      # ============================================================================
      
      # === Konfiguration ==========================================================
      LOGFILE="/var/log/wlan-recovery.log"
      STATSFILE="/var/log/wlan-recovery.stats"
      MAX_LOG_SIZE=50000              # ~50 KB, dann Logrotation
      PING_TARGET="172.23.56.1"
      MAX_CONSECUTIVE_FAILS=2         # bevor Recovery startet
      COOLDOWN_FILE="/tmp/wlan-recovery.cooldown"
      COOLDOWN_MINUTES=5
      
      # interne Speicherorte (nicht verändern)
      STATEFILE="/tmp/wlan-recovery.state"
      DATE_NOW=$(date "+%Y-%m-%d %H:%M:%S")
      
      # === Hilfsfunktionen ========================================================
      
      log() {
          echo "$DATE_NOW: $1" | tee -a "$LOGFILE"
      }
      
      rotate_log() {
          if [ -f "$LOGFILE" ] && [ $(wc -c <"$LOGFILE") -gt $MAX_LOG_SIZE ]; then
              mv "$LOGFILE" "$LOGFILE.old"
              echo "$DATE_NOW: Log rotated." > "$LOGFILE"
          fi
      }
      
      increment_stat() {
          local key="$1"
          local value
          value=$(grep "^$key=" "$STATSFILE" 2>/dev/null | cut -d= -f2)
          value=$((value + 1))
          grep -v "^$key=" "$STATSFILE" 2>/dev/null > "${STATSFILE}.tmp"
          echo "$key=$value" >> "${STATSFILE}.tmp"
          mv "${STATSFILE}.tmp" "$STATSFILE"
      }
      
      cooldown_active() {
          if [ -f "$COOLDOWN_FILE" ]; then
              local last=$(date -r "$COOLDOWN_FILE" +%s)
              local now=$(date +%s)
              local diff=$(( (now - last) / 60 ))
              [ $diff -lt $COOLDOWN_MINUTES ]
          else
              return 1
          fi
      }
      
      start_cooldown() {
          touch "$COOLDOWN_FILE"
      }
      
      ssh_or_vnc_active() {
          ss -tn state established | grep -Eq '(:22|:5900)'
      }
      
      # === Diagnosefunktionen =====================================================
      
      is_connected_l2() {
          iw dev wlan0 link 2>/dev/null | grep -q "Connected to"
      }
      
      has_ip_l3() {
          ip -4 addr show wlan0 2>/dev/null | grep -q "inet "
      }
      
      has_route() {
          ip route get "$PING_TARGET" 2>/dev/null | grep -q "dev wlan0"
      }
      
      ping_ok() {
          /usr/bin/ping -I wlan0 -c 3 -W 2 "$PING_TARGET" >/dev/null 2>&1
      }
      
      # === Hauptlogik =============================================================
      
      rotate_log
      
      # Init Statsfile falls nicht vorhanden
      [ -f "$STATSFILE" ] || echo -e "success=0\nrecoveries=0\nfailures=0" > "$STATSFILE"
      
      # Lese bisherigen Fehlerzähler
      fails=0
      [ -f "$STATEFILE" ] && fails=$(cat "$STATEFILE")
      
      # Diagnose
      if ping_ok; then
          log "Ping erfolgreich. WLAN funktioniert."
          echo 0 > "$STATEFILE"
          increment_stat "success"
          exit 0
      fi
      
      # Wenn Ping fehlschlägt → weitere Prüfungen
      log "Ping fehlgeschlagen → erweiterte Diagnose..."
      
      if is_connected_l2 && has_ip_l3 && has_route; then
          log "L2/L3 ok → ICMP-Problem (kein Recovery)."
          increment_stat "failures"
          echo 0 > "$STATEFILE"
          exit 0
      fi
      
      # Hier gilt: echte Verbindung gestört
      fails=$((fails + 1))
      echo "$fails" > "$STATEFILE"
      
      if [ $fails -lt $MAX_CONSECUTIVE_FAILS ]; then
          log "Erster Fehler ($fails/$MAX_CONSECUTIVE_FAILS) → Beobachten..."
          increment_stat "failures"
          exit 0
      fi
      
      # Wenn Cooldown läuft → überspringen
      if cooldown_active; then
          log "Cooldown aktiv → Recovery übersprungen."
          exit 0
      fi
      
      # === Recovery-Stufen ========================================================
      
      if ssh_or_vnc_active; then
          log "SSH/VNC aktiv → keine Recovery ausgeführt, nur geloggt."
          increment_stat "failures"
          exit 0
      fi
      
      log "Verbindung tatsächlich gestört → Recovery-Prozess gestartet."
      increment_stat "recoveries"
      
      # Stufe 1: sanfte Reassoziation
      log "→ Stufe 1: wpa_supplicant Reassoziation..."
      wpa_cli -i wlan0 reassociate >/dev/null 2>&1
      sleep 5
      if ping_ok; then
          log "Reassoziation erfolgreich."
          echo 0 > "$STATEFILE"
          start_cooldown
          exit 0
      fi
      
      # Stufe 2: Interface Toggle
      log "→ Stufe 2: Interface Toggle..."
      ip link set wlan0 down
      sleep 2
      ip link set wlan0 up
      sleep 8
      if ping_ok; then
          log "Interface Toggle erfolgreich."
          echo 0 > "$STATEFILE"
          start_cooldown
          exit 0
      fi
      
      # Stufe 3: Treiber-Reload
      log "→ Stufe 3: Treiber-Reload..."
      modprobe -r brcmfmac && modprobe brcmfmac
      sleep 10
      if ping_ok; then
          log "Treiber-Reload erfolgreich."
          echo 0 > "$STATEFILE"
          start_cooldown
          exit 0
      fi
      
      # Wenn alles fehlschlägt
      log "Alle Recovery-Stufen fehlgeschlagen → Fehler bleibt bestehen."
      increment_stat "failures"
      start_cooldown
      exit 1
      

      [EDIT: in script above: changed ping count from -c 1 to -c 3 in:
      /usr/bin/ping -I wlan0 -c 1 -W 2 “$PING_TARGET” >/dev/null 2>&1
      ]
      Warmest regards,
      Ralf

      posted in General Discussion
      R
      rkorell
    • RE: MMM-Pir disappeard on github

      @plainbroke said

      Don’t the authors usually leave their github live…

      AFAIK yes, for this reason this seems like an unfriendly farewell to me .

      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: show a page from openhab to a module

      @costascontis , If I got you right, this seems to be a web page. So i can imagine, this could be a candidate for MMM-SmartWebDisplay.

      Check it out.
      Good luck!
      Ralf

      posted in Requests
      R
      rkorell
    • RE: Wayland problems in the April 2026 release

      Dear @howest,

      Glad you got it working again! The Wayland transition is indeed a bit of a bumpy ride if it hits you unexpectedly.

      Just to share a different experience: I’m running MagicMirror on a Raspberry Pi 5 with Raspberry Pi OS Trixie, and Wayland works fine for me – including keyboard input.

      The wireless combo keyboard/mouse issue you described is a known pain point; Wayland handles HID devices differently than X11, and some receivers just don’t play nice out of the box.

      If you ever feel adventurous and want to try Wayland again: check if your keyboard receiver shows up cleanly under

      libinput list-devices.
      

      Sometimes a powered USB hub or simply a different receiver firmware makes all the difference.
      But honestly – if X11 runs stable and you’re happy, there’s zero pressure to switch. Wayland on the Pi is still maturing. Your setup, your rules! 😊

      Warm regards,
      Ralf

      posted in General Discussion
      R
      rkorell
    • RE: Can´t rotate my display

      @robertybob yes, screen rotation is still possible via CLI/terminal…

      edit “/usr/share/dispsetup.sh”
      eg:

      sudo nano /usr/share/dispsetup.sh
      

      there you will find an if clause at the beginning:

      if ! raspi-config nonint is_pi || raspi-config nonint is_kms ; then
      if xrandr --output HDMI-1 --primary --mode 2560x1440 --rate 59.951 --pos 0x0 --rotate left --dryrun>
      xrandr --output HDMI-1 --primary --mode 2560x1440 --rate 59.951 --pos 0x0 --rotate left
      

      the word after “rotate” defines the rotation :-)

      NO rotation = “normal”, rest is obvious.
      You must change this in both occurances.

      In same statement you define the resolution for the screen, as well - after “mode”(given example 2560x1440)

      HTH

      Regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: Can´t rotate my display

      @robertybob said in Can´t rotate my display:

      Mine looks a little different :(

      OK, that’s bad…
      (It’s a Pi5, right?).

      The complete content of my dispsetup.sh is as follows:

      #!/bin/sh
      if ! raspi-config nonint is_pi || raspi-config nonint is_kms ; then
      if xrandr --output HDMI-1 --primary --mode 2560x1440 --rate 59.951 --pos 0x0 --rotate left --dryrun>
      xrandr --output HDMI-1 --primary --mode 2560x1440 --rate 59.951 --pos 0x0 --rotate left
      fi
      fi
      if [ -e /usr/share/tssetup.sh ] ; then
      . /usr/share/tssetup.sh
      fi
      if [ -e /usr/share/ovscsetup.sh ] ; then
      . /usr/share/ovscsetup.sh
      fi
      exit 0
      

      If I interpret your line correctly, you are using the Wayland-Window-Manager?
      (wlandr => wayland … ???).
      My box is a Pi4B, no wayland.
      I’ve seen elsewhere that the Pi5 can be forced to use X11 again - than the above should work directly.
      Otherwise you may give it a try to put your code into the dispsetup.sh?

      Here I found the description of your commandlines above. Unfortunately there is no description how to get this pesistent…

      In Addition I just found a hint in Raspberry-Forum
      There a guy stated:

      sudo nano .config/wayfire.ini
      
      -> scrolled down and changed the output section as below:
      
      [output:HDMI-A-1]
      mode = 1920X1080@60000
      position = 0,0
      transform = 90
      

      May this is the right way with wayland…

      Regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: Can´t rotate my display

      @robertybob said in Can´t rotate my display:

      Raspberry Pi 3 :)

      May this in combination with bookworm?
      Sam acknowledged my assumption a posting above…

      • back to X11 …

      Regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: Fresh install on bookworm only works with X11 - which disables VNC...

      @sdetweil :-)
      OK good move…
      But the startup-command is generated by your install-script, so this is the result of the “auto-start”…
      In the meantime I’ve figured out that may X11 is - in priciple - may the better choice for me because I might remember that MMM-Pir ( :-) ) had issues with wayland in context of screen-off …

      posted in Troubleshooting
      R
      rkorell
    • RE: MMM-Universal-Pir - Desparately seeking right command

      @rkorell said in MMM-Universal-Pir - Desparately seeking right command:

      “DISPLAY=:0.0 xrandr --output HDMI-1 --off” / “DISPLAY=:0.0 xrandr --output HDMI-1 --primary --mode 2560x1440 --rate 59.951 --pos 0x0 --rotate left”

      these are the right commands and are working now!

      (If one was not too blonde to switch the commands …)
      My fault - I’ve entered the on comand to the off parameter …
      Sorry!

      Regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: My new MagicMirror will not start with Wayland?

      @sdetweil As I wrote initially “npm run start:wayland” doesn’t work …
      (despite wayland configured).
      And the “stored” auto-start option npm run start:x11 DOES work - for whatever reason.

      VNC was really sluggish on this, performance a nightmare so - see above marked as “solution” I switched back to x11 and all is working fine.

      In the meantime I’ve also managed to get MMM-Pir to work by idenitfying and correcting two errors in Bugsounet’s code …

      Warm regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: Lost Swipe functionality

      @mischag
      This definitely sounds like a system not a MagicMirror problem.
      You didn’t provide system information, so it’s hard to say anything.
      What Pi? What OS? What screen?

      I recently upgraded a (really old) Pi 2B and the (until upgrade) smoothly running touch didn’t work anymore - clearly caused by OS-upgrade.
      The newer version introduced a completely different (touch) screen handling (without any warning, hint or message regarding this fact).
      The axes and x-y positionings were mirrored. Your description sounds like that…

      Regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: How to Swipe between pages

      @sdetweil said in How to Swipe between pages:

      sadly MagicMirror forum search stinks

      :-)
      what I’m using regularly and works pretty well is external search via Google with limitation to site forum.mgicmirror.builders …
      Astonishing…

      Regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: MMM-Universal-Pir issues

      @eyesallin ,
      MMM-Universal-Pir needs correct configuration for the screen-on / screen-off commands.
      These commands are dependant of your Pi-Model and OS.
      The default is for bookworm/wayland config.
      If your Pi differs you need the correct command.
      For older OS versions this are commands with xrandr …

      Good luck.
      Regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: Need "correct" version of node-libgpiod ....

      @sdetweil OK; thanks.
      I will stop to handle these mismatches.
      Will try to get the MM-Module runnable .
      Console/terminal runs with node may not be necessary …
      Thanks anyway for your kind support!
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: Need "correct" version of node-libgpiod ....

      @sdetweil thx!

      posted in Troubleshooting
      R
      rkorell
    • RE: Need "correct" version of node-libgpiod ....

      @sdetweil Dear Sam,
      thanks for this information.
      Can you please enlighten me?
      I can read what you wrote and I got a light idea - but didn’t understand …

      I definitely have used your install script.
      what is @electron and
      what correlation is between node-libgpiod and @electron ? and what will this

      ../../node_modules/.bin/electron-rebuild
      

      do?

      Sorry for these questions - I would like to understand, what happens.

      If this is “neccessary” I will try to automate this for others with a postinstall script.
      Thanks for your effort!
      warmest regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: Cal EXT3 - understanding transforming

      @_V_ as you might have overseen you can not only check several conditions (as Sam (@sdetweil ) suggested) - separated by else or not but you can make several changes to the same event at one check.

      e.g.:

      eventTransformer: (ev) => {
        if (ev.title.search("Restmüll & Papier & Gelber Sack") !== -1) {ev.isFullday = [true], ev.title = "Alle Tonnen", ev.symbol = [ "fa-regular fa-trash-can" ], ev.color = "fuchsia"}
        if (ev.title.search("Therapie") !== -1) { ev.title = "Sitzung", ev.symbol = [ "fa-solid fa-mug-hot" ], ev.color = "Forestgreen"}
      return ev
         			  }, // end Eventtransformer 
      

      In the above example you can see

      • the modification of the color (as you already had identified,
      • the change of the kind of event (from “scheduled” to “Fullday-Event”)
      • the assignment of a different symbol (with font-awesome-symbols: double check their web-page, keep in mind that only the “STANDARD” (non-payed) versions will be shown in Magic Mirror) and
      • the change of the title of the event.

      Hope this helps.
      Good luck!
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • RE: HDMI turns on without movement

      @karsten13 said

      trixie: gpiomon -e rising -c 0 23

      You could try Karsten‘s suggestion…
      Replace your configs gpioCommand with the suggested one and check what happens…
      As I had assumed in my earlier post it‘s may related more to gpio than to HDMI …

      Regards,
      Ralf

      posted in Troubleshooting
      R
      rkorell
    • 1 / 1