• 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. andr1
  3. Posts
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
A
Offline
  • Profile
  • Following 0
  • Followers 0
  • Topics 1
  • Posts 5
  • Groups 0

Posts

Recent Best Controversial
  • RE: PIR sensor / wakes screen up when audio is detected

    remember to do chmod +x shellscriptname.sh

    posted in System
    A
    andr1
    May 20, 2017, 2:22 PM
  • RE: Where are you from?

    Westman Islands, Iceland (Living in Reykjavik, Iceland)

    posted in General Discussion
    A
    andr1
    May 10, 2017, 7:22 PM
  • PIR sensor / wakes screen up when audio is detected

    I needed a “module” that wakes my mirror up when i started playing audio from it… here’s the python code and shell scripts needed…

    import RPi.GPIO as GPIO
    import time
    import subprocess
    isMonitorOn = False
    isPlaying = False
    sleepyTimer = 180                       #seconds until mirror goes to sleep
    i = 0
    counter = 0
    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(4, GPIO.IN)
    print "Starting up!"
    print isPlaying
    while True:
           i=GPIO.input(4)
           print counter
           proc = subprocess.Popen('./isMonitorOn.sh', stdout=subprocess.PIPE)
           isMonitorOn = bool(proc.stdout.read())
           proc1 = subprocess.Popen('./isAudioOn.sh', stdout=subprocess.PIPE)
           isPlaying = bool(proc1.stdout.read())
           if i==0:
              counter += 1
              if not isMonitorOn:
                if isPlaying:
                  subprocess.call("./wakeUp.sh")
                  isMonitorOn = True
              if isMonitorOn:
                if isPlaying:
                  counter = 0
                if counter >= sleepyTimer:
                  subprocess.call("./sleep.sh")
                  isMonitorOn = False
                  counter = 0
              time.sleep(1)
           elif i==1:
              counter = 0
              if isMonitorOn:
                time.sleep(1)
              else:
                subprocess.call("./wakeUp.sh")
                time.sleep(1)
    
    

    wakeUp.sh includes:

    #!/bin/bash
    /opt/vc/bin/tvservice --preferred && sudo chvt 6 && sudo chvt 7
    
    

    sleep.sh includes:

    #!/bin/bash
    /opt/vc/bin/tvservice -o
    

    isMonitorOn.sh includes

    #!/bin/bash
    isMonitorOn=$(/opt/vc/bin/tvservice --status | grep off | wc -l)
    if [ "$isMonitorOn" = "0" ]; then
      echo True
    fi
    

    isAudioOn.sh includes

    #!/bin/bash
    if grep -q RUNNING /proc/asound/card*/pcm*/sub*/status; then echo "True"; fi
    

    Python and Bash scripts need to be in the same folder!

    for now i’m running this via screen

    screen -dmS smartMotion python smartMotion.py
    

    connect to screen session

    screen -r smartMotion
    

    detatch from session

    CTRL + A + D
    
    posted in System
    A
    andr1
    May 10, 2017, 5:49 PM
  • RE: MMM-SpotifyConnectUI

    yeah i’m using it on a real mirror… looks great :)

    posted in Entertainment
    A
    andr1
    Aug 8, 2016, 11:37 AM
  • RE: MMM-SpotifyConnectUI

    awesome module! exactly what I needed…
    running this with “screen -dmS spotify sudo ./spotify-connect-web -n Mirror -o plughw:CARD=ALSA,DEV=0” (just using the mini jack on the raspberry pi at the moment)

    posted in Entertainment
    A
    andr1
    Aug 7, 2016, 8:45 PM
  • 1 / 1
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