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-Remote-Control show error on start

      Hmm,

      i am running several 3rd Party modules. All modules in config.js:

      GoogleMapsTraffic
      alert
      Watchdog
      Remote Control
      Remote Control Repository
      Buttons
      Podcast
      Clock
      EasyPix
      NOAA
      MovieListings
      SystemStats
      Scrobbler
      CalendarEXT
      MyCommute
      OilTank (just installed this morning, but the error was before)

      Maybe @Jopyth has an idea.

      The odd thing is, that i already installed a Mirror with the exactly same modules and got no error. But this was with Raspbian Stretch lite, now i am using Jessie Desktop. But i cannot imagine that this causes the error

      posted in Troubleshooting
      cruunnerrC
      cruunnerr
    • MMM-Remote-Control show error on start

      Hey guys,

      i freshly installed MM manually on a RPi 3 with Raspbian Jessie.

      MM starts and i am able to use the Remote Control, but i also get this error from the Remote-Control module. The error is shown 4 times directly behind each other.

      0|mm       | Whoops! There was an uncaught exception...
      0|mm       | TypeError: Cannot read property 'replace' of undefined
      0|mm       |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_helper.js:240:24
      0|mm       |     at /home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:768:18
      0|mm       |     at Git. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:808:18)
      0|mm       |     at done (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1354:21)
      0|mm       |     at ChildProcess. (/home/pi/MagicMirror/modules/MMM-Remote-Control/node_modules/simple-git/src/git.js:1379:16)
      0|mm       |     at emitTwo (events.js:106:13)
      0|mm       |     at ChildProcess.emit (events.js:191:7)
      0|mm       |     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
      0|mm       | MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      0|mm       | If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      

      How i already said… i can access the Mirror by http://my.RPi.IP.address:8080/remote.html

      So everything is working fine, but i don’t know why this occurs

      posted in Troubleshooting
      cruunnerrC
      cruunnerr
    • RE: MMM-PIR-Sensor: Everything works fine, just one thing not...

      @Medo

      Glad to hear that :)

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

      @doubleT
      i edited my post while u wrote this ^^

      for the first i didn’t want to create a own module, but maybe later, when i understand the stuff good.

      as u can read in my edit, i can create a JSON with the script i posted. but i don’t know where to put the script to execute it automatically every 24 hours or something like that.

      because i think using cronjob would be the wrong way, right? :D

      edit:

      i just tried the MMM-Charts module, but i even cannot get this to work with a sample JSON.
      i created a test.json and loaded it up to my NAS.

      [["2018-02-04",2490],["2018-02-05",2488]]
      

      in the MM config.js i used this config:

      {
                              module: 'MMM-Chart',
                              position: 'middle_center',
                              header: 'Tankvolumen',
                              config: {
                                      name: "test",
                                      url: "http://192.168.178.220/test.json",
                                      xaxisLabelTicks: true,
                                      maintainAspectRatio: false,
                                      graphLabel0: "Volumen",
                                      graphLineColor0: "rgba(200, 200, 200, 1)",
                                      graphTickColor0: "rgba(200, 200, 200, 0.8)",
                                      graphFillColor0: "rgba(200, 200, 200, 0.4)",
                                      xaxisTimeUnit: "hour",
                                      xaxisTimeFormatLabels: "HH:mm",
                              }
                      },
      

      and modified the custom.css as said in the readme like this:

      .test {
      	width: 1060px;
      	height: 180px;
      }
      

      But it just shows the header and a long line below.
      i am sure i don’t use the module the correct way. ^^

      posted in Requests
      cruunnerrC
      cruunnerr
    • RE: MMM-Podcast don't show/load the latest video

      did you guys install the omxplayer correctly?

      check it like this:

      cd MagicMirror/modules/MMM-Podcast

      omxplayer -o hdmi video.mp4

      this should play the video.

      I am not using a header, so my module isn’t shown on the MM, too. I think that is correct.

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

      wow, thank u guys for your effort :)

      personally for me this project is not that easy, because i need to learn and understand several languages at the same time. So pls be patient ^^

      While u posted here i was able to create a JSON file from the mysql database. But the results were looking like this:

      [{"Datum":"2018-02-03T23:00:00.000Z","Volumen":2488},{"Datum":"2018-02-03T23:00:00.000Z","Volumen":2488},]
      

      thats probably because the columns in the database are defined as “date” (not datetime) and “decimal”
      I think i would get this right and could load this into the MMM-Chart.

      But now u guys posted several solutions. The easiest would be to create a CSV and log this directly with the MMM-Chart @ninjabreadman said.
      To create the CSV is no problem for me, but how changing the MMM-Chart… i need to pass a.t.m. ^^

      Actually i’m not sure how node.js and npm works so i need to read and try a little bit more to understand it better :)

      @doubleT
      How exactly would highcharts work together with the MM? Is it just like a web page or what? :D
      How to start it, where to put the files, and how to implement to MM?
      For me it looks nearly like an own module for the MM.

      Sorry for the much questions, but i am trying not just to use a finished solution. I want to nearly understand that whole stuff XD

      Thank you guys, u are great

      edit:
      So i changed the columns definition from “date” to “text”.
      Now my with the javascript using node i can get a JSON file looks correct:

      [{"Datum":"2018-02-04","Volumen":2490},{"Datum":"2018-02-04","Volumen":2488},]
      

      but i am using a very very simple script i think and i am just able to execute it manually by typing in terminal “node script.js”
      also i don’t know in what direction this has to be saved.

      var mysql      = require('mysql');
      var fs = require('fs');
      var connection = mysql.createConnection({
        host: 'xxx.xxx.xxx.xxx',
        port: '3307',
        user: '...',
        password: '...',
        database: 'Tank'
      });
      
      connection.connect();
      
      connection.query('SELECT * from Volumen', function(err, results, fields) {
          if(err) throw err;
      
          fs.writeFile('results.json', JSON.stringify(results), function (err) {
            if (err) throw err;
            console.log('Saved!');
          });
      });
      
      connection.end();
      
      posted in Requests
      cruunnerrC
      cruunnerr
    • RE: show integer logs from python script as diagram in MM ?

      @ninjabreadman said in show integer logs from python script as diagram in MM ?:

      create a route to output a JSON file

      alright, that sound makable for me i think. ^^Will take a look. Thank you

      edit: ehm…first question :D

      i installed this now (seems to be newer). But where to start? Where i need to create the file, and what type of file, and how will it be loaded?
      Is it a javascript file, which must be saved somewhere in the node directory?

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

      so i actually edited my python script, so that the results will be automatically loaded up to my MySQL Database on the Synology NAS.

      With PHP i can show the Data as a diagram :)
      So now i could use an iFrame module.
      So far so good ^^ (never thought i get this working)

      next days i will take a look at the MMM-Chart Module and the OpenHAB solution. (or a other that maybe works with MySQL)

      For those, who are interested so far:

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      
      # import required modules
      import time
      import datetime
      import RPi.GPIO as GPIO
      import os
      import ftplib
      import mysql
      import mysql.connector
      
      GPIO.setwarnings(False)
      
      # define server data
      # ftpserver = "..."  //optional, when needed uncomment the FTP-Upload further down
      # ftpuser = "..."
      # ftppassword = "..."
      # ftppath = "/web"
      
      sqlhost = "..."
      sqlport = "..."
      sqluser = "..."
      sqlpassword = "..."
      sqldb = "Tank"
      
      # 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
      
      print("Messe Volumen...")
      
      # 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_%H:%M:%S')
            Tag = datetime.datetime.fromtimestamp(Zeit).strftime('%Y-%m-%d')
            Uhr = datetime.datetime.fromtimestamp(Zeit).strftime('%H:%M:%S')
      
      	# schreibe Langzeitmessung in *.csv Datei
            file = open("longtimelog.csv", "a")
            file.write(str(Tag))
            file.write(", ")
            file.write(str(Liter))
            file.write("\n")
            file.close()
      
              # schreibe aktuelle Messung in *.csv Datei
            file = open("log.csv", "w")
            file.write(str(Tag))
            file.write(", ")
            file.write(str(Liter))
            file.write("\n")
            file.close()
      
            print("Logs aktualisiert")
            time.sleep(.1)
            print("Upload Logs auf FTP...")
      
              # Lädt die longtimelog.csv Datei auf das NAS
      #      filename = "longtimelog.csv"
      #      ftp = ftplib.FTP(ftpserver)
      #      ftp.login(ftpuser, ftppassword)
      #      ftp.cwd(ftppath)
      #      os.chdir(r"/home/pi")
      #      myfile = open("longtimelog.csv", 'r')
      #      ftp.storlines('STOR ' + "longtimelog.csv", myfile)
      #      myfile.close()
      
              # Lädt die log.csv Datei auf das NAS
      #      filename = "log.csv"
      #      ftp = ftplib.FTP(ftpserver)
      #      ftp.login(ftpuser, ftppassword)
      #      ftp.cwd(ftppath)
      #      os.chdir(r"/home/pi")
      #      myfile = open("log.csv", 'r')
      #      ftp.storlines('STOR ' + "log.csv", myfile)
      #      myfile.close()
      
            time.sleep(.1)
      
            print("Verbinde mit MySQL-Datenbank...")
      
            time.sleep(.1)
      
            try:
                connection = mysql.connector.connect(host = sqlhost, port = sqlport, user = sqluser, passwd = sqlpassword, db = sqldb)
            except:
                print "Keine Verbindung zum MySQL-Server"
                exit(0)
      
            cursor = connection.cursor()
            cursor.execute("INSERT INTO Volumen VALUES (%s,%s)", (Tag,Liter,))
            cursor.close()
            connection.commit()
      
            time.sleep(.1)
      
            print("Upload erfolgreich")
      
        # 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()
      
      
      posted in Requests
      cruunnerrC
      cruunnerr
    • RE: Trying to use MMM-MyCommute, config.js doesn't look right

      @deerbelac said in Trying to use MMM-MyCommute, config.js doesn’t look right:

      You’re my new best internet friend.

      LOL

      you are welcome mate ;)

      posted in Troubleshooting
      cruunnerrC
      cruunnerr
    • RE: Temperature regulated fan on RPI

      @Peter

      why not just using a python script?

      found this one here:

      #!/usr/bin/env python3
      # coding: utf-8
      
      import os
      import time
      import signal
      import sys
      import RPi.GPIO as GPIO
      pin = 36 # The pin ID, edit here to change it
      maxTMP = 50 # The maximum temperature in Celsius after which we trigger the fan
      GPIO.setmode (GPIO.BOARD)
      
      def setup():
          GPIO.setmode(GPIO.BOARD)
          GPIO.setup(pin,GPIO.OUT)
          GPIO.setwarnings(False)
          return()
      def getCPUtemperature():
          res = os.popen('vcgencmd measure_temp').readline()
          temp =(res.replace("temp=","").replace("'C\n",""))
          print("temp is {0}".format(temp)) #Uncomment here for testing
          return temp
      def fanON():
          setPin(True)
          return()
      def fanOFF():
          setPin(False)
          return()
      def getTEMP():
          CPU_temp = float(getCPUtemperature())
      
          if CPU_temp>maxTMP:
              fanON()
      
          else:
              fanOFF()
      
          return()
      def setPin(mode): # A little redundant function but useful if you want to add logging
          GPIO.output(pin, mode)
          return()
      try:
          setup()
          while True:
              getTEMP()
              time. sleep(8) # Read the temperature every 5 sec, increase or decrease this limit if you want
      except KeyboardInterrupt: # trap a CTRL+C keyboard interrupt
      	GPIO.cleanup()
      
      posted in Troubleshooting
      cruunnerrC
      cruunnerr
    • 1 / 1