Read the statement by Michael Teeuw here.
MMM-Universal-Pir and cec-client
-
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
-
@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 ofpm2 logs --lines=xxx
xxx is the number of most recent log lines, default 15sleep
[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 sleepingwake 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' -
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 fileindex.jswith 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.jsand look into presented output and into the filetest.log. You can play with the content ofonCommand, maybe you find what’s going wrong. -
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
-
@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?
