MagicMirror² v2.8.0 is available! For more information about this release, check out this topic.

sleep and wake tv with motion



  • Re: [Motion Detection with RaspiCam](Non-Module version)
    i have setup motion running and mm as well.My mirror is a LGtv .I edit motion.conf like:

    # Command to be executed when an event starts. (default: none)
    # An event starts at first motion detected after a period of no motion defined by event_gap
    on_event_start vcgencmd display_power 1
    
    # Command to be executed when an event ends after a period of no motion
    # (default: none). The period of no motion is defined by option event_gap.
    on_event_end vcgencmd display_power 0
    
    

    that works pretty well sleeping and waking my mirror.My problem is that “vcgencmd display_power 0” doesnt blank my screen and so my tv goes into that horrible screensaver mode with the cube…
    But then playing around i noticed that giving

    /opt/vc/bin/tvservice -p
    

    at the Lxterminal instead of waking up my hdmi screen goes to a blank state and its like turned off!!!I thought thats nice plus typing:

    /opt/vc/bin/tvservice -p && sudo chvt 6 && sudo chvt 7
    

    it wakes up allright.So my linux noob thinking said lets put those commands at motion.

    # Command to be executed when an event starts. (default: none)
    # An event starts at first motion detected after a period of no motion defined by event_gap
    on_event_start /opt/vc/bin/tvservice -p && sudo chvt 6 && sudo chvt 7
    
    # Command to be executed when an event ends after a period of no motion
    # (default: none). The period of no motion is defined by option event_gap.
    on_event_end /opt/vc/bin/tvservice -p
    

    It sleeps ok like i want to but it doesnt wake up.Seems like motion “on_event_start” is giving " /opt/vc/bin/tvservice -p" and not all the command like “/opt/vc/bin/tvservice -p && sudo chvt 6 && sudo chvt 7”.
    What can i do my linux experts?



  • @costascontis u should ask the motion guys. My module does all that under the covers. I posted an update cause the command execution was throwing an error.

    Well, actually, I know how…

    The & is a shell operation, so u would have to invoke sh or bash, and pass it the tvservice string u listed

    My module has the same problem, now that you mention it… I can’t fix til late today



  • actually i got it to work,starting the motion with sudo motion -n it executes the comands just fine.My screen is turning on and off just fine.I just want to find out how to start motion with pm2 now .