Read the statement by Michael Teeuw here.
MMM-PIR-Sensor-Lite modification
-
@Freddy_boy on the cec side
from the raspberry pi forums
https://forums.raspberrypi.com/viewtopic.php?t=348779to add to the module, edit the node_helper.js and change the command for one of the modes to use the cec commands (Once u get them to work)
I can’t get cec to work on my pi3… works ok on my pi 4…
(haven’t tried the latest kernel version of pi os)if u want to add another mode to pir-sensor-lite
in the modulename.js change
if(!['vcgencmd', 'xrandr', 'xset'].includes(this.config.commandType)) {
that to include whatever string you use for the cec command type
and then in the node_helper.js
switch(this.config.commandType) { case 'vcgencmd': exec("/usr/bin/vcgencmd display_power 1", null); break;
change the case tot the new string you picked and then change the exec command to the cec command
note:
there are two places to change… 1 to turn on the monitor, one to turn off, same commandType, different exec commands
OR post an issue to the module author asking them to provide the support…
OR make the change on your own fork of the module and submit back to the author as an enhancement.
-
Ok. I think I understand the strategy here. I will just need to figure out the proper HDMI CEC code that I need. Thanks. I’ll let you know how things progress…
-
@Freddy_boy you could copy it out of the ext screen module which worked… (if u still have the older repo installed somewhere)
thats what I did when I was testing PIR and other sensors a year or so ago
-
I attempted to run the CEC commands manually, but that doesn’t work. I just keep getting active source unknown error message. Unfortunately, I don’t have the original EXT-Screen module because I attempted to perform an update on the module, so I only have the updated module. Perhaps the updated module has updated code? But I don’t know where to look for the required commands. I’ve looked at the EXT-Screen.js file and the node_helper.js file and I don’t see anything that looks like a CEC command. Also, the files are difficult to view, as the entire code is written on a single line, so you need to search for text strings to find anything.
-
@Freddy_boy said in MMM-PIR-Sensor-Lite modification:
Also, the files are difficult to view, as the entire code is written on a single line, so you need to search for text strings to find anything.
yes, he has minified the code to prevent others using it… or learning form it…
does this work to list the cec devices?
echo 'scan' | cec-client -s -d 1
-
From SSH connection:
pi@raspberrypi:~ $ echo ‘scan’ | cec-client -s -d 1
opening a connection to the CEC adapter…
requesting CEC bus information …
CEC bus information===================
device #1: Recorder 1
address: 1.0.0.0
active source: no
vendor: Pulse Eight
osd string: CECTester
CEC version: 1.4
power status: on
language: engcurrently active source: unknown (-1)
pi@raspberrypi:~ $ -
Update: I’m not sure how it happened, but I believe that my monitor had the controls disabled. It is an LG monitor using Simplink, and when I enable it, I can now see the device:
pi@raspberrypi:~ $ echo ‘scan’ | cec-client -s -d 1
opening a connection to the CEC adapter…
requesting CEC bus information …
CEC bus information===================
device #0: TV
address: 0.0.0.0
active source: yes
vendor: LG
osd string: TV
CEC version: 1.3a
power status: on
language: engdevice #1: Recorder 1
address: 1.0.0.0
active source: no
vendor: LG
osd string: CECTester
CEC version: 1.3a
power status: on
language: engcurrently active source: TV (0)
However, when I attempt to turn OFF the monitor using the CEC control commands, it doesn’t seem to work. The commands appear to be working (ie. no error messages returned), but the monitor remains ON when I issue the standby command. I also use the ‘power’ command to check the status of the monitor, and it confirms that it is ON.
pi@raspberrypi:~ $ echo ‘pow 0.0.0.0’ | cec-client -s -d 1
opening a connection to the CEC adapter…
power status: on
pi@raspberrypi:~ $ echo ‘standby 0.0.0.0’ | cec-client -s -d 1
opening a connection to the CEC adapter…
pi@raspberrypi:~ $ echo ‘pow 0.0.0.0’ | cec-client -s -d 1
opening a connection to the CEC adapter…
power status: on
pi@raspberrypi:~ $ -
I have also tried:
sudo echo ‘standby 0.0.0.0’ | sudo cec-client -s -d 1but got the same result…
-
@Freddy_boy ok, I have a CEC tv which I can turn OFF, but not back on…
-
Yes, but this used to work previously. I suspect that none of the commands are working (even if no error message is returned). I attempted other commands, and they also do not seem to work. For example, I tried to change HDMI inputs, and the monitor remains at the same input. I think I need to determine if I can get ANY HDMI CEC command to work at all. It seems to be a missing step somewhere…