MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-Universal-Pir and cec-client

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    5 Posts 3 Posters 370 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      MM_Noob
      last edited by

      Hi all…

      Is anyone using MMM-Universal-Pir with cec-client to control the screen power status ?

      I’m using a Samsung LED TV that doesnt cleanly handle wlr-randr calls, but CEC works flawlessly…

      I can use cec-client on the cmdline to standby and powerup the screen with no issues…

      When I put those cmds into MMM-Universal-Pir it doesn’t call them… So my config looks something like::

        onCommand: "echo 'on 0' | cec-client -s -d 1",
        offCommand: "echo 'standby 0' | cec-client -s -d 1",
      

      I see the countdown timer reach 0 but the screen doesnt power off…

      Anyone got this working ??

      Thanks

      S karsten13K 2 Replies Last reply Reply Quote 0
      • S Offline
        sdetweil @MM_Noob
        last edited by

        @MM_Noob I don’t know for his module, but my MMM-SleepWake can do cec, using debug

        are there any messages in the log where npm start is done?
        if using pm2 to launch, see the output of

        pm2 logs --lines=xxx
        xxx is the number of most recent log lines, default 15

        sleep

        [2025-07-05 10:14:22.267] [LOG]   motion detected from external source 
        [2025-07-05 10:14:22.268] [LOG]   !e: motionend 
        [2025-07-05 10:14:22.268] [LOG]   idle timer started for 1 minutes 
        [2025-07-05 10:15:16.088] [LOG]   sleep-wake helper in socket notification=start_sleep 
        [2025-07-05 10:15:16.089] [LOG]   processing start sleep 
        [2025-07-05 10:15:16.089] [LOG]   using CEC approach ()='echo standby 0 | cec-client -s' 
        [2025-07-05 10:15:22.270] [LOG]   sleep-wake helper in socket notification=start_sleep 
        [2025-07-05 10:15:22.271] [LOG]   processing start sleep 
        [2025-07-05 10:15:22.271] [LOG]   start sleep, already sleeping 
        

        wake up

        [2025-07-05 10:15:42.503] [LOG]   motion detected from external source 
        [2025-07-05 10:15:42.504] [LOG]   !s: motionstart 
        [2025-07-05 10:15:42.505] [LOG]   sleep-wake helper in socket notification=end_sleep 
        [2025-07-05 10:15:42.506] [LOG]   waking up 
        [2025-07-05 10:15:42.506] [LOG]   waking up using CEC approach='echo on 0 | cec-client -s' 
        

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • karsten13K Online
          karsten13 @MM_Noob
          last edited by

          @MM_Noob

          I have no hardware to reproduce but maybe this helps for debugging:

          Go to an empty dir and execute npm init -y, then write a file index.js with content:

          const { exec } = require('node:child_process');
          
          const onCommand = "echo 'on 0' | cec-client -s -d 1 > test.log";
          
          console.dir(onCommand);
          
          exec(onCommand, (error, stdout, stderr) => {
            if (error) {
              console.error(`exec error: ${error}`);
              return;
            }
            console.log(`stdout: ${stdout}`);
            console.error(`stderr: ${stderr}`);
          });
          

          Now run node index.js and look into presented output and into the file test.log. You can play with the content of onCommand, maybe you find what’s going wrong.

          1 Reply Last reply Reply Quote 0
          • M Offline
            MM_Noob
            last edited by

            OK - post the update to include the cec-utils in the build I can confirm it now works…

            I escaped the special chars initially in the cec-client call- but it works without them being escaped also

            I guess this update will be rolled into the latest release at some point ?

            Many thanks

            karsten13K 1 Reply Last reply Reply Quote 0
            • karsten13K Online
              karsten13 @MM_Noob
              last edited by

              @MM_Noob

              @MM_Noob said in MMM-Universal-Pir and cec-client:

              OK - post the update to include the cec-utils in the build I can confirm it now works…

              don’t understand, are you talking about this?

              @MM_Noob said in MMM-Universal-Pir and cec-client:

              I guess this update will be rolled into the latest release at some point ?

              which update, which release?

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy