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

mcmalone

@mcmalone

0
Reputation
1
Profile views
3
Posts
0
Followers
0
Following
Joined Mar 2, 2021, 3:33 PM
Last Online Oct 31, 2023, 10:59 PM

mcmalone Unfollow Follow

Latest posts made by mcmalone

  • RE: Turning TV on/off via PIR sensor - current problem: TV displays "No Signal" screen

    @lavolp3 said in Turning TV on/off via PIR sensor - current problem: TV displays "No Signal" screen:

    With this procedure you are turning on the screensaver (which is set to black) instead of turning the screen off.
    It may serve as a solution wiht regard to the picture, but keep in mind that 1) a black screen is brighter than a screen turned off (except you have an oled screen) 2) you are wasting power.
    My screen consumes ~ 20W running, my pi consumes ~ 2W.
    I’d rather have the screen turned off in absence of any person.

    Hmm, the TV does not appear to emit any light with my current settings. I turned off all the lights and I do not see anything being emitted from the TV screen, no backlight. Of course, I’m not really sure if it could still be using more power and I’m just not aware. Is there a way I could check? Or perhaps the TV still consumes power because it is still “on”?

    Still, I had the same problem for some time.
    Last time I tried the MMM-NewPIR module it worked for me. That one has a configuration option for the different modes (display_power vs tvservice).
    You may have a look into that module.

    Thank you, I will look into this! I was not aware of this module. I had only heard of the other one I had mentioned above.

    posted in Troubleshooting
    M
    mcmalone
    Mar 5, 2021, 1:58 AM
  • RE: Turning TV on/off via PIR sensor - current problem: TV displays "No Signal" screen

    @mcmalone I don’t know exactly why but the following solution worked for me.

    Posting my solution for others in the future and also so that maybe someone in the future can explain to me why this works (and maybe a more efficient solution).

    I changed the monitor_on.sh and monitor_off.sh files to read, respectively:

    DISPLAY=:0 xscreensaver-command -deactivate
    

    and

    DISPLAY=:0 xscreensaver-command -activate
    

    Before I made these changes, I also configured xscreensaver by running xscreensaver-demo in the terminal, then on my monitor connected to the Pi, a preferences box pops up. I selected “black screen” from the options so that when the screensaver activates through the above files, it will be a black screen (no backlight).

    posted in Troubleshooting
    M
    mcmalone
    Mar 3, 2021, 12:28 AM
  • Turning TV on/off via PIR sensor - current problem: TV displays "No Signal" screen

    Problem: I want to turn the screen off/on depending on when the PIR sensor detects motion. It seems that the sensor is working, but when the TV is “off” instead of a black screen, it displays “No signal.” The TV is CEC-enabled, so I am under the impression that my goal should be possible.

    I am using a RBP 4. Given that the screen does activate when movement is detected, I am assuming that the PIR sensor is properly connected.

    Currently, I have the following Python script, pir.py, run on start:

    #!/usr/bin/env python
    
    import sys
    import time
    import RPi.GPIO as io
    import subprocess
    
    io.setmode(io.BCM)
    SHUTOFF_DELAY = 10 # in seconds, how long the monitor will be on until next button press or PIR detection
    PIR_PIN = 4       # 7 on the board (this needn't to be a PIR. Can be a button also)
    #LED_PIN = 16      # optional, don't use as Relay-PIN. It just shows detection time of the PIR without delay time
    
    def main():
        io.setup(PIR_PIN, io.IN)
      #  io.setup(LED_PIN, io.OUT)
        turned_off = False
        last_motion_time = time.time()
    
        while True:
            if io.input(PIR_PIN):
                last_motion_time = time.time()
              #  io.output(LED_PIN, io.LOW)
                print ".",
                sys.stdout.flush()
                if turned_off:
                    turned_off = False
                    turn_on()
            else:
                if not turned_off and time.time() > (last_motion_time + 
                                                     SHUTOFF_DELAY):
                    turned_off = True
                    turn_off()
               # if not turned_off and time.time() > (last_motion_time + 1):
                #    io.output(LED_PIN, io.HIGH)
            time.sleep(.1)
    
    def turn_on():
    	subprocess.call("sh /home/pi/monitor_on.sh", shell=True)
    
    def turn_off():
    	subprocess.call("sh /home/pi/monitor_off.sh", shell=True)
    
    if __name__ == '__main__':
        try:
            main()
        except KeyboardInterrupt:
            io.cleanup()
    

    monitor_on.sh reads: sudo vcgencmd display_power 1 7

    monitor_off.sh reads: sudo vcgencmd display_power 0 7

    I have tried:

    1. Using tvservice -o and tvservice -p instead of vcgencmd display_power. While the TV would turn off, it would not turn back on. (I only tried -p option, never -e. I don’t know if that makes a difference.)
    2. Using the MMM-PIR-Module which is a module for MagicMirror. These were the module settings I used:
    {
    		module: 'MMM-PIR-Sensor', 
    		position: "top_center", // Remove this line to avoid having an visible indicator
    		config: {
    			sensorPin: 4,
    			powerSavingDelay: 60, // Turn HDMI OFF after 60 seconds of no motion, until motion is detected again
    			preventHDMITimeout: 4, // Turn HDMI ON and OFF again every 4 minutes when power saving, to avoid LCD/TV timeout
    			supportCEC: true, 
    			presenceIndicator: "fa-eye", // Customizing the indicator
    			presenceOffIndicator: "fa-eye", // Customizing the indicator
    			presenceIndicatorColor: "#f51d16", // Customizing the indicator
    			presenceOffIndicatorColor: "#2b271c" // Customizing the indicator
    		}
    	}
    

    Sometimes I felt the module was not working, not turning the TV back on when there was motion. Other times, if working, it still produced the No Signal screen, instead of a blank screen.

    Thank you in advance for any help!

    posted in Troubleshooting
    M
    mcmalone
    Mar 2, 2021, 5:03 PM
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