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

    Topics

    • Y

      Anyone else experiencing issues after updating Raspbian (black screen and wifi dropping)

      Watching Ignoring Scheduled Pinned Locked Moved Solved Troubleshooting
      9
      0 Votes
      9 Posts
      3k Views
      R
      i have the latest Stretch and no folder lxsession in /.config what now? Sorry, I found it Note: setting it in /etc/xdg/lxsession/LXDE-pi/autostart or /etc/xdg/lxsession/LXDE/autostart
    • Y

      HTTP Server for streaming podcasts / news / volume

      Watching Ignoring Scheduled Pinned Locked Moved General Discussion
      1
      1
      0 Votes
      1 Posts
      631 Views
      Y
      Dear fellow Mirror Designers, I wasn’t sure where to put this so I will post it here. From various sources I created a small python httpserver that changes the mirrors volume, starts a podcast (100 Seconds german news, when brushing your teeth:grimacing_face: ) or opens a live stream. This is the code, nothing special but may be helpful for some of you. I use FHEM and Philips Hue Dimmer Switches to control it: [image: 1540136724308-img_20181021_174249.jpg] Uses: python3, livestreamer, omxplayer #!/usr/bin/python3 -u host_name = '10.0.1.49' # Change this to your Raspberry Pi IP address host_port = 8000 proc = '' import RPi.GPIO as GPIO from pathlib import Path import os import subprocess import signal from subprocess import call from time import sleep from http.server import BaseHTTPRequestHandler, HTTPServer class MyServer(BaseHTTPRequestHandler): def do_HEAD(self): self.send_response(200) self.send_header('Content-type', 'text/html') self.end_headers() def do_GET(self): global proc html = ''' <html> <body style="width:960px; margin: 20px auto;"> <h1>Magic Mirror Control</h1> <p>Current GPU temperature is {}</p> <p>Podcast: <a href="/play">Play</a> <a href="/stop">Stop</a></p> <p>ARD Livestream: <a href="/ard">Play</a> <a href="/stop">Stop</a></p> <p>Volume: <a href="/down">down</a> <a href="/up">up</a></p> <p>System: <a href="/shutdown">Shutdown</a> <a href="/restart">Restart</a></p> <div id="podcast-status"></div> <script> document.getElementById("podcast-status").innerHTML="{}"; </script> </body> </html> ''' temp = os.popen("/opt/vc/bin/vcgencmd measure_temp").read() self.do_HEAD() status = '' if self.path=='/': #GPIO.setmode(GPIO.BCM) #GPIO.setwarnings(False) #GPIO.setup(17, GPIO.IN) status='nothing' elif self.path=='/play': if proc=='': my_file = Path("/home/pi/MagicMirror/video.mp4") if my_file.is_file(): statinfo = os.stat('/home/pi/MagicMirror/video.mp4') if statinfo.st_size > 0: proc = subprocess.Popen(["omxplayer", "-o", "alsa:hw:ALSA", "--no-osd", "/home/pi/MagicMirror/video.mp4"], preexec_fn=os.setsid) status='Playing Podcast' else: proc = subprocess.Popen(["omxplayer", "-o", "alsa:hw:ALSA", "--no-osd", "/home/pi/MagicMirror/Loading.mp4"], preexec_fn=os.setsid) status='Not yet available' else: proc = subprocess.Popen(["omxplayer", "-o", "alsa:hw:ALSA", "--no-osd", "/home/pi/MagicMirror/Loading.mp4"], preexec_fn=os.setsid) status='Not yet available' else: status='Stopping Podcast' os.killpg(os.getpgid(proc.pid), signal.SIGTERM) proc='' elif self.path=='/ard': if proc=='': proc = subprocess.Popen(["livestreamer", "hlsvariant://daserste_live-lh.akamaihd.net/i/daserste_de@91204/master.m3u8", "best", "-vnp", "omxplayer -o alsa:hw:ALSA --no-osd --timeout 20"], preexec_fn=os.setsid) status='Playing ARD Livestream' else: status='Stopping Stream' os.killpg(os.getpgid(proc.pid), signal.SIGTERM) proc='' elif self.path=='/stop': if proc!='': status='Stopping Podcast' os.killpg(os.getpgid(proc.pid), signal.SIGTERM) proc='' else: status='Nothing to stop' elif self.path=='/shutdown': status='Shutdown' subprocess.Popen(["sudo", "shutdown", "-h", "now"], preexec_fn=os.setsid) elif self.path=='/restart': status='Restart' subprocess.Popen(["sudo", "reboot"], preexec_fn=os.setsid) elif self.path=='/down': status='Volume down' subprocess.Popen(["amixer", "set", "Master", "12%-"], preexec_fn=os.setsid) elif self.path=='/up': status='Volume up' subprocess.Popen(["amixer", "set", "Master", "12%+"], preexec_fn=os.setsid) self.wfile.write(html.format(temp[5:], status).encode("utf-8")) if __name__ == '__main__': http_server = HTTPServer((host_name, host_port), MyServer) print("Server Starts - %s:%s" % (host_name, host_port)) try: http_server.serve_forever() except KeyboardInterrupt: http_server.server_close()
    • Y

      Execute script (GPIO Relay) based on if sound is being played

      Watching Ignoring Scheduled Pinned Locked Moved Solved Troubleshooting
      2
      0 Votes
      2 Posts
      770 Views
      Y
      while sleep 1; do if grep -q 'RUNNING' '/proc/asound/card0/pcm0p/sub0/status'; then echo "Running!" else echo "Not Running!" fi done this seems to work but the amplifier produces a too loud cracking sound when switching on, I have two spare relais und my MagicMirror, I will hook up the speakers to those and try again.
    • Y

      Strip Down Guide for BenQ 28" VA Monitor GC2870H

      Watching Ignoring Scheduled Pinned Locked Moved Hardware
      61
      11
      6 Votes
      61 Posts
      60k Views
      M
      Hi, Some times gone, but would you still recommend the BenQ monitor? Thank you Christian
    • 1 / 1