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

    Posts

    Recent Best Controversial
    • RE: MMM-PIR-Sensor: Everything works fine, just one thing not...

      one idea is to just put the tvservice -o command in your rc.local.
      before that u should do a little sleep.

      like this:

      sudo nano /etc/rc.local

      #!/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
      
      sleep 60 &
      
      tvservice -o
      
      exit 0
      

      So on every reboot it will wait 60 seconds (just to let everything start like MM) and then turn the monitor off.

      posted in Troubleshooting
      cruunnerrC
      cruunnerr
    • RE: Trying to use MMM-MyCommute, config.js doesn't look right

      There are some ``` in your clock module.

      in your MyCommute u use the wrong " " (try to use another editor in future)

      no comma , behind the apikey

      in the normal calendar module there is no comma , behind the URL

      missing semicolon in last line

      So try this:

      /* Magic Mirror Config Sample
       *
       * By Michael Teeuw http://michaelteeuw.nl
       * MIT Licensed.
       *
       * For more information how you can configurate this file
       * See https://github.com/MichMich/MagicMirror#configuration
       *
       */
      
      var config = {
              address: "localhost", // Address to listen on, can be:
                                    // - "localhost", "127.0.0.1", "::1" to listen on loopback interface
                                    // - another specific IPv4/6 to listen on a specific interface
                                    // - "", "0.0.0.0", "::" to listen on any interface
                                    // Default, when address config is left out, is "localhost"
              port: 8080,
              ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
                                                                     // or add a specific IPv4 of REDACTED :
                                                                     // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
                                                                     // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
                                                                     // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
      
              language: "en",
              timeFormat: 12,
              units: "metric",
      
              modules: [
                      {
                              module: "alert",
                      },
                      {
                              module: "updatenotification",
                              position: "top_bar"
                      },
                      {
                              module: "clock",
      
                              position: "top_left"
                      },
                      {
                              module: "calendar",
                              header: "Today",
                              position: "top_left",
                              config: {
                                      maximumEntries: 5,
                                      calendars: [
                                              {
                                                      symbol: "calendar",
                                                      url: "calendarURL",
                                                      auth:{
                                                              user: "username",
                                                              pass: "secretpassword",
                                                              method: "basic"
                                                      }
                                              },
                                      ],
                              }
                      },
                      {
                              module: "MMM-WunderGround",
                              position: "top_right",
                              config: {
                                      apikey: "secretAPI",
                                      pws: "weatherstationID",
                                      units: "imperial",
                                      hourly: "1",
                                      fctext: "1",
                                      coloricon: "true",
                                      fcdaycount: "1",
                                      hourlyinterval: "3",
                                      hourlycount: "2",
                                      alerttime: "10000",
                                      roundTmpDecs: 0,
                                      layout: "vertical"
                                      }
                      },
                      {
                              module: "MMM-DailyBibleVerse",
                              position: "bottom_bar",
                              config: {
                                      feeds: [
                                              {
                                                      version: "ESV"
                                              }
                                      ],
                              },
                      },
                      {
                              module: "MMM-MyCommute",
                              position: "bottom_left",
                              header: "My Drive",
                              config: {
                                      apikey: "AIzaSyBfJfAgexEpef8VbtTEv6XfyiYTx-4QAge8",
                                      origin: "123 My Street, My City, ST 12345",
                                      startTime: "20:00",
                                      endTime: "22:00",
                                      hideDays: [0,6],
                                      destinations: [
                                              {
                                                      destination: "456 Work Address, City, State ZIP",
                                                      label: "work",
                                                      mode: "driving",
                                              },
                                      ],
                              },
                      },
      //              {
      //                      module: 'MMM-Xmas',
      //                      position: 'fullscreen_above'
      //              }
              ]
      
      };
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") {module.exports = config;}
      

      if u run into this problem again, try www.jshint.com ;)

      or use ssh and do this: https://forum.magicmirror.builders/topic/5399/how-to-check-your-config-for-errors-for-absolute-beginners

      posted in Troubleshooting
      cruunnerrC
      cruunnerr
    • RE: MagicMirror and Domoticz

      change the port of domoticz or MM. I think they are using both 8080

      posted in Troubleshooting
      cruunnerrC
      cruunnerr
    • RE: show integer logs from python script as diagram in MM ?

      @tbbear

      since u wrote the brilliant Openhab module this would really be a good option :)
      I will keep that in mind.

      @doubleT
      i will take a look at it. looks great. But i am sure i will have questions :D

      edit:

      i also found this: https://forum.magicmirror.builders/topic/2470/mmm-chart-view-your-graphs-on-your-mirror

      But what is meant by “JSON data source”? is it just a *.js file with text in it? And is that the only file needed to use this module? i am still looking. ^^

      posted in Requests
      cruunnerrC
      cruunnerr
    • RE: Speaker for the Raspberry Pi3

      Well, i just ordered these two:

      https://www.amazon.de/Trust-Lautsprecher-USB-Stromversorgung-Smartphone-schwarz/dp/B00JRW0M32/ref=sr_1_9?s=computers&ie=UTF8&qid=1517545229&sr=1-9&keywords=pc+lautsprecher

      https://www.amazon.de/gp/product/B012W70XH8/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1

      I removed the speaker from it’s body and screw big holes in my mirror. The speaker also got a physical volume control. Not really good to hear music, but for alexa and the podcast module it will be absolutely enough.

      The Audio adapter works out of the box for microphone. To enable speaker port u need to select it in raspberry as standard port.

      posted in Hardware
      cruunnerrC
      cruunnerr
    • show integer logs from python script as diagram in MM ?

      Hey guys,

      i am trying again to get a new feature to my MM ^^

      Background Story:

      I finally installed a second Raspberry Pi on my heat oil tank for measuring the tank level.
      Therefore i am using a HC-SR04 and a python script i found in the web.
      As the script just showed the actual measurement in the console, i modified it to write the logs in a *.txt and a *.html file.
      The script will be executed once a day via crontab.

      The index.html will be completely overwritten every time the script will be executed. Then the file will be uploaded to my NAS.
      Actually i am using an iFrame module in the MM to show the result. This was just for trying it out :)

      The *.txt file is doing the longtime log of the results. At the moment it writes a time stamp and the result at the end of the file.
      For future measurements i could also just print the result (in the script it is “Liter”).

      Question:

      My aim is to show the longtime logs in a diagram on the MM. Probably this is just possible with html and an iFrame module, right or not?
      It should look like this, just in MM-style:
      https://forum-raspberrypi.de/attachment/5997-monatsansicht-03-jpg/

      or this: https://www.raspberrypi.org/forums/viewtopic.php?t=83808

      If so, could someone help me find a good solution? Because writing html with python isn’t that easy^^
      And I master neither python nor html

      Here comes the tank.py:

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      
      # import required modules
      import time
      import datetime
      import RPi.GPIO as GPIO
      import os
      import ftplib
      
      GPIO.setwarnings(False)
      
      print("Fair volume...")
      
      # define GPIO pins
      GPIOTrigger = 18
      GPIOEcho    = 24
      
      # function to measure the distance
      def MeasureDistance():
        # set trigger to high
        time.sleep(0.2)
        GPIO.output(GPIOTrigger, True)
      
        # set trigger after 10µs to low
        time.sleep(0.0001)
        GPIO.output(GPIOTrigger, False)
      
        # store initial start time
        StartTime = time.time()
      
        # store start time
        while GPIO.input(GPIOEcho) == 0:
          StartTime = time.time()
      
        # store stop time
        while GPIO.input(GPIOEcho) == 1:
          StopTime = time.time()
      
        # calculate distance
        TimeElapsed = StopTime - StartTime
        Distance = (TimeElapsed * 34400) / 2
        
        return Distance
      
      # main function
      def main():
        try:
      #    while True:
            Distance0 = MeasureDistance()
            Distance01 = MeasureDistance()
            Distance02 = MeasureDistance()
            Distance03 = MeasureDistance()
            Distance04 = MeasureDistance()
            Distance05 = MeasureDistance()
            Distance06 = MeasureDistance()
            Distance07 = MeasureDistance()
            Distance08 = MeasureDistance()
            Distance09 = MeasureDistance()
            Distance10 = MeasureDistance()
            Distance11 = MeasureDistance()
            Distance12 = MeasureDistance()
            Distance13 = MeasureDistance()
            Distance14 = MeasureDistance()
            Distance15 = MeasureDistance()
            Distance16 = MeasureDistance()
            Distance17 = MeasureDistance()
            Distance18 = MeasureDistance()
            Distance19 = MeasureDistance()
            Distance20 = MeasureDistance()
            Distance_sum = Distance01 + Distance02 + Distance03 + Distance04 + Distance05 + Distance06 + Distance07 + Distance08 + Distance09 + Distance10 + Distance11 + Distance12 + Distance13 + Distance14 + Distance15 + Distance16 + Distance17 + Distance18 + Distance19 + Distance20
            Distance = round(Distance_sum / 20,1)
      #    Meine Tanks haben Maximal 3.200 Liter bei 150 cm Füllhöhe
      #    Zusätzlich 9 cm Offset vom Einbauort des Sensors; 
            Fuelstand = 150 - Distance
            Liter = 3200 / 141 * Fuelstand
            Zeit = time.time()
            ZeitStempel = datetime.datetime.fromtimestamp(Zeit).strftime('%Y-%m-%d_%H:%M:%S')
            print (ZeitStempel),("Entfernung: %.1f cm" % Distance),(" Fuelhoehe: %.1f cm" % Fuelstand),(" Liter: %.0f l" % Liter)
            time.sleep(1)
      
            Auslesezeitpunkt = datetime.datetime.fromtimestamp(Zeit).strftime('%d.%m.%Y um %H:%M:%S Uhr')
      
      	# write result in *.txt file (add to last line)
            file = open("longtimelog.txt", "a")
            file.write(str(Auslesezeitpunkt))
            file.write(":\n")
            file.write("Ölstand = ")
            file.write(str(Liter))
            file.write("\n\n")
            file.close()
      
      	# write result to *.html file (will be overwritten)
            file = open("index.html", "w")
            file.write("<p></p>")
            file.write(str(Auslesezeitpunkt))
            file.write(":<p>")
            file.write("Oelstand = ")
            file.write(str(Liter))
            file.write("</p>")
            file.write("<p></p><p></p><p></p>")
            file.close()
      
            print("Logs updated")
            time.sleep(1)
            print("Upload actual log...")
      
      	# Lädt die index.html Datei auf das NAS
            filename = "index.html"
            ftp = ftplib.FTP("192.168.178.220")
            ftp.login("USER_NAME", "PASSWORD")
            ftp.cwd("/web")
            os.chdir(r"/home/pi")
            myfile = open("index.html", 'r')
            ftp.storlines('STOR ' + "index.html", myfile)
            myfile.close()
      
            time.sleep(1)
      
            print("Upload done")
      
        # reset GPIO settings if user pressed Ctrl+C
        except KeyboardInterrupt:
          print("Measurement stopped by user")
          GPIO.cleanup()
      
      if __name__ == '__main__':
        # use GPIO pin numbering convention
        GPIO.setmode(GPIO.BCM)
      
        # set up GPIO pins
        GPIO.setup(GPIOTrigger, GPIO.OUT)
        GPIO.setup(GPIOEcho, GPIO.IN)
      
        # set trigger to false
        GPIO.output(GPIOTrigger, False)
      
        # call main function
        main()
      
      

      Even this thought is not makable i would like to thank you guys ahead ;)

      edit:

      oh, and i found this here, but i don’t know if this would help.

      posted in Requests
      cruunnerrC
      cruunnerr
    • RE: {HowTo} turn on/off your monitor (Time based, PIR/Button, App)

      again one step closer :D

      put in the content and save with “ctrl+x” and “y”

      try everything agin and report if u got trouble again :)

      edit:

      oh sorry. Aren’t we using “screen_on/off”?? :D

      so try

      sh screen_off.sh should show a black screen (not turning HDMI off)
      sh screen_on.sh should disable the black screen.

      posted in Tutorials
      cruunnerrC
      cruunnerr
    • RE: {HowTo} turn on/off your monitor (Time based, PIR/Button, App)

      try the shell scripts without the python script.

      sh monitor_off.sh should show a black screen (not turning HDMI off)
      sh monitor_on.sh should disable the black screen.

      if this is working for u, then your pir.py script seems not being correct.

      the chmod +x step is necessary for the python script execute the shell scripts.

      But first try the commands above. If this doesn’t work, then i have to think about and search for a solution.
      But i tried it just a few seconds ago, and it works fine here

      posted in Tutorials
      cruunnerrC
      cruunnerr
    • RE: {HowTo} turn on/off your monitor (Time based, PIR/Button, App)

      :)

      thank you very much ^^

      I am very glad u found out what went wrong. :)
      So now u should be able to use the “screen_on/off” files instead of the monitor_onoff

      Just try out :)

      posted in Tutorials
      cruunnerrC
      cruunnerr
    • RE: {HowTo} turn on/off your monitor (Time based, PIR/Button, App)

      then u probably connected it wrong and the gpio which is used in the script is set to high (1). u can check this…

      type gpio readall to see the GPIO Breakout.

      pi@MagicMirror_Test:~ $ gpio readall
       +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+
       | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
       +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
       |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
       |   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5v      |     |     |
       |   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
       |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
       |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
       |  17 |   0 | GPIO. 0 |  OUT | 1 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
       |  27 |   2 | GPIO. 2 |  OUT | 1 | 13 || 14 |   |      | 0v      |     |     |
       |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
       |     |     |    3.3v |      |   | 17 || 18 | 1 | IN   | GPIO. 5 | 5   | 24  |
       |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
       |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
       |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
       |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
       |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
       |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
       |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
       |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
       |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
       |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
       |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
       +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
       | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
       +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+
      

      In the script the BCM pin 22 is used for the PIR. This is GPIO 3 and physically it is pin 15.

      Please check if your pir is connected correctly.

      Edit:

      Oh, and take a look at your PIR. u can set the delay time from 0.3seconds up to 5 minutes. Maybe its set very high.
      For using the soloutions of this tutorial the PIR adjust time should be set very low, as u can set the time within the script :)
      https://www.mpja.com/download/31227sc.pdf

      posted in Tutorials
      cruunnerrC
      cruunnerr
    • 1
    • 2
    • 8
    • 9
    • 10
    • 11
    • 12
    • 27
    • 28
    • 10 / 28