MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    My First Mirror... until now ^^

    Scheduled Pinned Locked Moved Show your Mirror
    37 Posts 17 Posters 49.1k Views 18 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cruunnerrC Offline
      cruunnerr
      last edited by cruunnerr

      Hey @metalldetector

      I already did somewhere in the forum ^^

      You need to install PIGPIOD.

      sudo apt-get install build-essential python-dev unzip wget

      wget http://abyz.me.uk/rpi/pigpio/pigpio.zip && unzip pigpio.zip && cd PIGPIO && sudo make install

      Connect the PIR like shown at Part 2.2 and follow the guide:
      https://forum.magicmirror.builders/topic/6291/howto-turn-on-off-your-monitor-time-based-pir-button-app?page=1

      When creating the pir.py and fill ist with this code:

      #!/usr/bin/env python
      
      import sys
      import time
      import RPi.GPIO as io
      import subprocess
      import pigpio
      
      io.setmode(io.BCM)
      SHUTOFF_DELAY = 119 # seconds
      PIR_PIN = 25       # 22 on the board
      LED_PIN = 16
      
      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()
      
      

      For the monitor_on.sh use this:

      vcgencmd display_power 1
      
      pigs p 17 1
      pigs p 22 1
      pigs p 24 1
      
      sleep 0.06s
      
      pigs p 17 2
      pigs p 22 2
      pigs p 24 2
      
      sleep 0.06s
      
      pigs p 17 3
      pigs p 22 3
      pigs p 24 3
      
      sleep 0.06s
      
      pigs p 17 4
      pigs p 22 4
      pigs p 24 4
      
      sleep 0.06s
      
      pigs p 17 5
      pigs p 22 5
      pigs p 24 5
      
      sleep 0.06s
      
      pigs p 17 6
      pigs p 22 6
      pigs p 24 5
      
      sleep 0.06s
      
      pigs p 17 7
      pigs p 22 7
      pigs p 24 6
      
      sleep 0.06s
      
      pigs p 17 8
      pigs p 22 8
      pigs p 24 7
      
      sleep 0.06s
      
      pigs p 17 9
      pigs p 22 9
      pigs p 24 8
      
      sleep 0.06s
      
      pigs p 17 10
      pigs p 22 10
      pigs p 24 9
      
      sleep 0.06s
      
      pigs p 17 11
      pigs p 22 11
      pigs p 24 10
      
      sleep 0.06s
      
      pigs p 17 12
      pigs p 22 12
      pigs p 24 11
      
      

      For monitor_off.sh use this:

      pigs p 17 12
      pigs p 22 12
      pigs p 24 11
      
      sleep 0.06s
      
      pigs p 17 11
      pigs p 22 11
      pigs p 24 10
      
      sleep 0.06s
      
      pigs p 17 10
      pigs p 22 10
      pigs p 24 9
      
      sleep 0.06s
      
      pigs p 17 9
      pigs p 22 9
      pigs p 24 8
      
      sleep 0.06s
      
      pigs p 17 8
      pigs p 22 8
      pigs p 24 7
      
      sleep 0.06s
      
      pigs p 17 7
      pigs p 22 7
      pigs p 24 6
      
      sleep 0.06s
      
      pigs p 17 6
      pigs p 22 6
      pigs p 24 5
      
      sleep 0.06s
      
      pigs p 17 5
      pigs p 22 5
      pigs p 24 5
      
      sleep 0.06s
      
      pigs p 17 4
      pigs p 22 4
      pigs p 24 4
      
      sleep 0.06s
      
      pigs p 17 4
      pigs p 22 4
      pigs p 24 4
      
      sleep 0.06s
      
      pigs p 17 3
      pigs p 22 3
      pigs p 24 3
      
      sleep 0.06s
      
      pigs p 17 2
      pigs p 22 2
      pigs p 24 2
      
      vcgencmd display_power 0
      
      sleep 0.06s
      
      pigs p 17 1
      pigs p 22 1
      pigs p 24 1
      
      sleep 0.06s
      
      pigs p 17 0
      pigs p 22 0
      pigs p 24 0
      
      

      Hope that helps. Try to find your best way and ask, if u need more help :)

      Edit:
      Oh and u need to start Pigpio on reboot with rc.local. ;)

      metalldetectorM N 2 Replies Last reply Reply Quote 3
      • swvalentiS Offline
        swvalenti Project Sponsor
        last edited by

        If you told me that your background wasn’t a stock photo I would upvote this! Nice work!

        1 Reply Last reply Reply Quote 0
        • cruunnerrC Offline
          cruunnerr
          last edited by

          Well, meanwhile i changed my background, but still love it :P

          Bild Text

          1 Reply Last reply Reply Quote 0
          • metalldetectorM Offline
            metalldetector @cruunnerr
            last edited by

            @c:face_with_steam_from_nose: ruunnerr ok that works…
            -What ist the Funktion of LED_PIN = 16 .
            Only one pin …
            Do I need RGB pins in the script?

            -And then the led stripe start it’s flickering…
            Thx4yourhelp

            1 Reply Last reply Reply Quote 0
            • cruunnerrC Offline
              cruunnerr
              last edited by cruunnerr

              LED-Pin just shows, if the PIR detects motion. You don’t need to use it.

              The pir.py script starts the other shell scripts when motion is detected.

              So all commands for the RGB-Stripe are within the shell scripts (monitor_on / off.sh).
              And as u can see, i used GPIO 17,22 and 24.
              17 = red
              22 = green
              24 = blue

              To control the LEDs i used PIGPIOD and it’s commands, as i wrote.

              So after installing PIGIOD u can start it with:
              sudo pigpiod

              Commands like pigs p 22 128 will set green to 50%.
              pigs p 24 255 will set blue to 100%

              in the shell script i fade all colors from 1 to 12% with sleeps.

              Edit:

              As i wrote before u need to Autostart pigpiod via rc.local.

              sudo nano /etc/rc.local

              Mine looks like this:

              #!/bin/sh -e
              #
              # rc.local
              #
              # This script is executed at the end of each multiuser runlevel.
              # Make sure that the script will "exit 0" on success or any other
              # value on error.
              #
              # In order to enable or disable this script just change the execution
              # bits.
              #
              # By default this script does nothing.
              
              # Print the IP address
              _IP=$(hostname -I) || true
              if [ "$_IP" ]; then
                printf "My IP address is %s\n" "$_IP"
              fi
              
              iwconfig wlan0 power off &
              
              sleep 5 &
              
              /usr/local/bin/pigpiod
              
              sleep 10 &
              
              /usr/bin/python /home/pi/pir.py &
              
              exit 0
              
              metalldetectorM 1 Reply Last reply Reply Quote 0
              • metalldetectorM Offline
                metalldetector @cruunnerr
                last edited by

                @cruunnerr ok I think this is the right way and I understand it with the led pin on Pin16
                … Just the flickering looks not good… I try a other power consumption…

                …can I only fade the LEDs or can I make a light like a animation around my mirror?

                Thanks for your help … And so fast.

                This is a good forum for me…

                Thx to all guys

                1 Reply Last reply Reply Quote 0
                • cruunnerrC Offline
                  cruunnerr
                  last edited by cruunnerr

                  Well, if i had to do that project gain, i would not choose the RGB-5050 stripes again…

                  I would directly get WS2812, because u just need one PWM Pin and with that you were able to do things like animations…

                  In another project (infinity table) i choosed this one and was pretty amused :)

                  https://youtu.be/IcDjzh03W-4

                  1 Reply Last reply Reply Quote 0
                  • metalldetectorM Offline
                    metalldetector
                    last edited by

                    Yes. But what is the difference between WS2812, WS2812, neopixel…
                    What is the best stripe with a good price…
                    I think a meter for 60 euro is to much…

                    Greetings from Saxony, Germany

                    1 Reply Last reply Reply Quote 0
                    • cruunnerrC Offline
                      cruunnerr
                      last edited by

                      https://de.aliexpress.com/item/1m-2m-3m-4m-5m-ws2812b-ws2812-led-strip-individually-addressable-smart-led-strip-black-white/32682015405.html?spm=a2g0x.search0104.3.9.4eef3dc9EKAZdz&ws_ab_test=searchweb0_0,searchweb201602_3_10065_10068_10547_319_317_10548_10696_10084_453_10083_454_10618_10304_10307_10820_10821_537_10302_536_10843_10059_10884_10887_321_322_10103,searchweb201603_6,ppcSwitch_0&algo_expid=b24b32fc-d347-41f0-b20b-702e47e2d79c-1&algo_pvid=b24b32fc-d347-41f0-b20b-702e47e2d79c&transAbTest=ae803_3

                      I have got this one. 5m with 60 LEDs per meter for about 17€

                      metalldetectorM 1 Reply Last reply Reply Quote 0
                      • metalldetectorM Offline
                        metalldetector @cruunnerr
                        last edited by

                        @cruunnerr very good deal.
                        But what is the difference in the product options… blue or black pcm …

                        1 Reply Last reply Reply Quote 0
                        • metalldetectorM Offline
                          metalldetector
                          last edited by

                          Mensch… du sprichst bestimmt deutsch…
                          Wie hast du die Temperatur Module angebunden?

                          Etwa mit wlan esp’s ?

                          1 Reply Last reply Reply Quote 0
                          • cruunnerrC Offline
                            cruunnerr
                            last edited by

                            Blau und schwarz beschreibt nur die Farbe des Streifens selber (nicht der LED). Also für die Funktion egal.

                            Naja, also die Temperaturen kommen von meinem IoBroker Server. Um ehrlich zu sein habe ich schon länger nicht mehr an meinem Spiegel gearbeitet, sondern andere Projekte gestartet und vollendet.
                            Mein ganzes Haus ist mittlerweile steuerbar (Licht, Thermostate, Lautsprecher etc…). Unter anderem habe ich eben auch Temperatursensoren von Xiaomi im Einsatz, die ihre Werte an meinen Server schicken.
                            Auf dem Spiegel zeige ich die Werte dann mit dem MMM-iobroker Modul an.

                            Aber ich habe auch viel mit ESP’s gemacht. Habe derzeit ca. 8 Stück im Einsatz. Einer steuert meine komplette Heizung. Einer steuert meine Klingel. Einer wertet meine Alarmanlage aus. Zwei sind für meinen Infinity Tisch… etc. pp… ^^
                            Macht ziemlich viel Spaß


                            Blue and black only describes the color of the strip itself (not the LED). So no matter for the function.

                            Well, so the temperatures come from my IoBroker server. To be honest, I have not worked on my mirror for some time, but started and completed other projects.
                            My whole house is now controllable (lights, thermostats, speakers etc …). Among other things, I have also used temperature sensors from Xiaomi, which send their values to my server.
                            On the mirror I then display the values with the [MMM-iobroker] (https://github.com/ioBroker/MMM-ioBroker) module.

                            But I also did a lot of ESP’s. Currently have about 8 pieces in use. One controls my entire heater. One controls my bell. One evaluates my alarm system. Two are for my infinity table … etc. pp … ^^
                            It’s a lot of fun

                            1 Reply Last reply Reply Quote 0
                            • metalldetectorM Offline
                              metalldetector
                              last edited by

                              Ja mach schon Spass…
                              Wollte auch einen openhub installieren … auf einem raspi Zero… Mal schauen ob das was wird… Meine ESP usb serial programmer hardware kommt erst noch.
                              Wollte die Temperaturwerte mit mmm-rest auslesen… Mal schauen… Ich danke dir jedenfalls für die tips

                              1 Reply Last reply Reply Quote 0
                              • K Offline
                                kennydio
                                last edited by

                                @cruunnerr hello sir,
                                I have pir sensor & relay. I followed exactly step 5.2 in your tutorial (https://forum.magicmirror.builders/topic/6291/howto-turn-on-off-your-monitor-time-based-pir-button-app/2?page=1). but it doesn’t work for me.
                                The relay is off but when there is movement through the sensor, the relay does not turn back on. please help me.
                                I’m sorry my English is not very good

                                1 Reply Last reply Reply Quote 0
                                • F Offline
                                  Fr8Trayne
                                  last edited by

                                  The mirror looks amazing and I’ve been able to glean some inspiration. Thanks for posting!

                                  1 Reply Last reply Reply Quote 0
                                  • A Offline
                                    andyyy
                                    last edited by

                                    I like the background picture (the girl). Does anyone know where to find that one?

                                    1 Reply Last reply Reply Quote 0
                                    • StoffbeuteluweS Offline
                                      Stoffbeuteluwe Project Sponsor
                                      last edited by Stoffbeuteluwe

                                      @cruunnerr Hi, Can you show me your css of Newsfeed, I am interested in make it smaller (width) like on your mirror…
                                      thanks

                                      1 Reply Last reply Reply Quote 0
                                      • cruunnerrC Offline
                                        cruunnerr
                                        last edited by

                                        Meanwhile i changed my background but cannot find the girl-wallpaper. Sorry bro :(

                                        Here is my whole css

                                        /*****************************************************
                                         * Magic Mirror                                      *
                                         * Custom CSS                                        *
                                         *                                                   *
                                         * By Michael Teeuw http://michaelteeuw.nl           *
                                         * MIT Licensed.                                     *
                                         *                                                   *
                                         * Add any custom CSS below.                         *
                                         * Changes to this files will be ignored by GIT. *
                                         *****************************************************/
                                        
                                         body {
                                        	background-image: url("background2.jpg");
                                        	background-size: cover;
                                        	margin-left: 0px;
                                        	margin-right: 30px;
                                        	margin-top: 15px;
                                        	margin-bottom: 15px;
                                          	position: absolute;
                                          	height: calc(100% - 28px);
                                          	width: calc(100% - 22px);
                                        }
                                        .MMM-SystemStats  {
                                                color: #CEF6CE;
                                                } 
                                        .MMM-MyCalendar {
                                          max-width: 300px;
                                        }
                                        .MMM-MovieListings {
                                          max-width: 400px;
                                        }
                                        .left header {
                                            border-bottom: none; /* instead of 1px solid #666; to remove all lines from all the headers */
                                            width: 70%;          /* add this to change the width of all module headers */
                                        }
                                        .right header {
                                            border-bottom: none; /* instead of 1px solid #666; to remove all lines from all the headers */
                                            width: 70%;          /* add this to change the width of all module headers */
                                        }
                                        .newsfeed .small{
                                          color: #FFFFFF;
                                        }
                                        .newsfeed .medium{
                                          color: #D8D8D8;
                                        }
                                        .newsfeed {
                                         max-width: 280px;
                                        }
                                        .region.top.right {
                                         max-width: 330px;
                                        }
                                        .MMM-ioBroker {
                                         width: 550px;
                                         zoom: 75%;
                                        }
                                        
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • N Offline
                                          Newbie007 @cruunnerr
                                          last edited by Newbie007

                                          @cruunnerr My PIR doesn’t trigger or do anything. When I try to execute python script below is the error message.

                                          Error Message

                                          All of sudden my monitor started going to sleep so I made below changes,

                                          sudo nano /etc/lightdm/lightdm.conf
                                          

                                          Add the following lines to the [SeatDefaults] section:

                                          xserver-command=X -s 0 dpms
                                          
                                          1 Reply Last reply Reply Quote 0
                                          • kusselinK Offline
                                            kusselin
                                            last edited by

                                            Hi, can you post the Wallpapers here please

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 2 / 2
                                            • First post
                                              Last post
                                            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