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: {HowTo} turn on/off your monitor (Time based, PIR/Button, App)

      When the pir.py isn’t running, then it isn’t this script which turns on your monitor.
      Do you have the MM-PIR module active?

      Please try to edit your rc.local and delete the autostart of the pir.py to see, if the monitor still turns on/off when there is movement.

      if not, then the pkill command isn’t working, which would confuse me, because i just tried it by myself on my mirror.
      via ssh i just entered the sudo pkill $(ps aux | grep python pir.py | awk '{ print $2 }')" command and my pir wasn’t working.


      and to your first problem, which u solved by yourself…

      u could also try to edit the killpir.py to this:

      #!/bin/bash
      sudo pkill $(ps aux | grep python pir.py | awk '{ print $2 }')
      

      then u should be able to just let your cronjob look like:
      0 21 * * * root /home/pi/killpir.sh

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

      cron will start the pir.py in background. The scenario will be like:

      Boot up magic mirror = starts pir.py via rc.local
      at 21pm = stops pir.py via cron
      at 7am = starts pir.py via cron

      from this on the circle is closed and cron will repeat this every day (in background)
      well… i think so… maybe i am wrong :/

      When u reboot the mirror between 21pm and 7am the pir.py will be active for sure until the next 21pm will be reached … ;)

      edit:
      it would also be possible to implement a while-loop in the pir.py script to check if it is between 21pm and 7am.
      But i never worked with that yet -.-

      maybe u can get what u want here or here or here

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

      @Maros

      Glad u got it working. :)

      So u use the script from point 2.2 ?

      Then u could kill the pir.py at 9pm and start at 7am via cronjob. With that u were able to define each day for itself :)

      The command to kill the pir.py script is

      sudo pkill $(ps aux | grep python pir.py | awk '{ print $2 }')
      

      So the easiest way is to just edit your crontab. Try it like this:

      1. nano killpir.sh

      2. Write this into file and save with CTRL+X and Yes

      sudo pkill $(ps aux | grep python pir.py | awk '{ print $2 }')
      
      1. chmod +x killpir.sh

      2. sudo nano /etc/crontab

      3. Write this into file and save with CTRL+X and Yes:

      0 21 * * * /usr/bin/sh /home/pi/killpir.sh
      0 7 * * * /usr/bin/python /home/pi/pir.py
      

      So for example your crontab looks like this:

      # /etc/crontab: system-wide crontab
      # Unlike any other crontab you don't have to run the `crontab'
      # command to install the new version when you edit this file
      # and files in /etc/cron.d. These files also have username fields,
      # that none of the other crontabs do.
      
      SHELL=/bin/sh
      PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
      
      # m h dom mon dow user  command
      17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
      25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
      47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
      52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
      0 21    * * *   root    /usr/bin/sh /home/pi/killpir.sh
      0 7     * * *   root    /usr/bin/python /home/pi/pir.py
      #
      

      Didn’t try this solution at all, but hope/think this works :)

      I would be glad about a feedback ;)

      posted in Tutorials
      cruunnerrC
      cruunnerr
    • RE: Issue booting up MM

      If i google “deserializer.cc” i get a link to the git of chromium.

      so maybe your chromium installation is broken.

      Did u use the automatic installer or not?

      Maybe you should delete the MagicMirror folder in your home dictionary and try this if u use a raspberry pi:

      bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
      

      And u should read this carefully:
      https://github.com/MichMich/MagicMirror

      Aaaaaand u should edit your post as MadScientist said ;)

      posted in Troubleshooting
      cruunnerrC
      cruunnerr
    • RE: MMM-NOAA V2 doesn't start (Unexpected token < in JSON at position 0)

      @sean said in MMM-NOAA V2 doesn't start (Unexpected token < in JSON at position 0):

      request({
      url: “http://ip-api.com/json”,
      method: ‘GET’
      }, (error, response, body) => {
      console.log(body) // Try logging suspicious point.
      info = JSON.parse(body);
      lat = info.lat;
      lon = info.lon;
      });

      OMG thank you so much…

      I am a dumbass XD
      My PiHole blocked the ip-api.com domain, so i put this to the whitelist and its running.

      Sorry guys

      posted in Troubleshooting
      cruunnerrC
      cruunnerr
    • MMM-NOAA V2 doesn't start (Unexpected token < in JSON at position 0)

      Hey guys,

      last time I did not let myself be seen often ^^
      But i never left u at all ;)

      Now i have a Problem and need your help guys :(

      I installed a little linux server a few months ago for managing several things. And now its time to install MM in server mode i thought.

      Lubuntu (Ubuntu 18.04.1 LTS) on x86 Hardware
      node v8.10.0
      npm v6.3.0
      MM v2.4.1

      What i did:

      • I downloaded all modules i used on my raspberry and installed them like the readme says
      • I copied my RPi config.js and used it on the linux server

      Most modules are working, but:

      MMM-NOAA and MMM-RemoteControl are giving errors -.-

      So I have several issues but lets start with NOAA ^^

      While doing npm install in the NOAA folder i get this error:

      chris@ioBroker:~/MagicMirror/modules/MMM-NOAA$ npm install
      npm WARN grunt-stylelint@0.10.0 requires a peer of stylelint@^9.0.0 but none is installed. You must install peer dependencies yourself.
      npm WARN stylelint-config-recommended@2.1.0 requires a peer of stylelint@^8.3.0 || ^9.0.0 but none is installed. You must install peer dependencies yourself.
      npm WARN stylelint-config-standard@18.2.0 requires a peer of stylelint@^8.3.0 || ^9.0.0 but none is installed. You must install peer dependencies yourself.
      
      audited 1218 packages in 12.16s
      found 1 critical severity vulnerability
        run `npm audit fix` to fix them, or `npm audit` for details
      
      
      chris@ioBroker:~/MagicMirror/modules/MMM-NOAA$ npm audit
                                                                                      
                             === npm audit security report ===                        
                                                                                      
      # Run  npm update fill-range --depth 5  to resolve 1 vulnerability
      ┌───────────────┬──────────────────────────────────────────────────────────────┐
      │ Low           │ Cryptographically Weak PRNG                                  │
      ├───────────────┼──────────────────────────────────────────────────────────────┤
      │ Package       │ randomatic                                                   │
      ├───────────────┼──────────────────────────────────────────────────────────────┤
      │ Dependency of │ stylelint [dev]                                              │
      ├───────────────┼──────────────────────────────────────────────────────────────┤
      │ Path          │ stylelint > micromatch > braces > expand-range > fill-range  │
      │               │ > randomatic                                                 │
      ├───────────────┼──────────────────────────────────────────────────────────────┤
      │ More info     │ https://nodesecurity.io/advisories/157                       │
      └───────────────┴──────────────────────────────────────────────────────────────┘
      
      
      ┌──────────────────────────────────────────────────────────────────────────────┐
      │                                Manual Review                                 │
      │            Some vulnerabilities require your attention to resolve            │
      │                                                                              │
      │         Visit https://go.npm.me/audit-guide for additional guidance          │
      └──────────────────────────────────────────────────────────────────────────────┘
      ┌───────────────┬──────────────────────────────────────────────────────────────┐
      │ Critical      │ Sandbox Breakout                                             │
      ├───────────────┼───���──────────────────────────────────────────────────────────┤
      │ Package       │ safe-eval                                                    │
      ├───────────────┼──────────────────────────────────────────────────────────────┤
      │ Patched in    │ No patch available                                           │
      ├───────────────┼──────────────────────────────────────────────────────────────┤
      │ Dependency of │ google-translate-api                                         │
      ├───────────────┼──────────────────────────────────────────────────────────────┤
      │ Path          │ google-translate-api > safe-eval                             │
      ├───────────────┼──────────────────────────────────────────────────────────────┤
      │ More info     │ https://nodesecurity.io/advisories/337                       │
      └───────────────┴──────────────────────────────────────────────────────────────┘
      found 2 vulnerabilities (1 low, 1 critical) in 1220 scanned packages
        run `npm audit fix` to fix 1 of them.
        1 vulnerability requires manual review. See the full report for details.
      
      chris@ioBroker:~/MagicMirror/modules/MMM-NOAA$ npm audit fix
      npm WARN grunt-stylelint@0.10.0 requires a peer of stylelint@^9.0.0 but none is installed. You must install peer dependencies yourself.
      npm WARN stylelint-config-recommended@2.1.0 requires a peer of stylelint@^8.3.0 || ^9.0.0 but none is installed. You must install peer dependencies yourself.
      npm WARN stylelint-config-standard@18.2.0 requires a peer of stylelint@^8.3.0 || ^9.0.0 but none is installed. You must install peer dependencies yourself.
      
      up to date in 5.181s
      fixed 0 of 1 vulnerability in 1218 scanned packages
        1 vulnerability required manual review and could not be updated
      

      Anyhow…
      When i start MM with “node server only dev” i get this:

      chris@ioBroker:~/MagicMirror$ node serveronly dev
      Starting MagicMirror: v2.4.1
      Loading config ...
      Loading module helpers ...
      No helper found for module: alert.
      Initializing new module helper ...
      Module helper loaded: MMM-TelegramBot
      Initializing new module helper ...
      Module helper loaded: MMM-WatchDog
      Initializing new module helper ...
      Module helper loaded: MMM-Remote-Control-Repository
      Initializing new module helper ...
      Module helper loaded: updatenotification
      No helper found for module: clock.
      Initializing new module helper ...
      Module helper loaded: MMM-Oiltank
      No helper found for module: MMM-EasyPix.
      Initializing new module helper ...
      Module helper loaded: MMM-NOAA
      Initializing new module helper ...
      Module helper loaded: MMM-MovieListings
      Initializing new module helper ...
      Module helper loaded: MMM-Tools
      No helper found for module: MMM-NowPlayingOnSpotify.
      Initializing new module helper ...
      Module helper loaded: MMM-CalendarExt
      Initializing new module helper ...
      Module helper loaded: MMM-MyCommute
      All module helpers loaded.
      Starting server on port 8080 ... 
      You're using a full whitelist configuration to allow for all IPs
      Server started ...
      Connecting socket for: MMM-TelegramBot
      Connecting socket for: MMM-WatchDog
      Starting module helper: MMM-WatchDog
      Connecting socket for: MMM-Remote-Control-Repository
      Connecting socket for: updatenotification
      Connecting socket for: MMM-Oiltank
      Connecting socket for: MMM-NOAA
      Starting module: MMM-NOAA
      Connecting socket for: MMM-MovieListings
      MMM-MovieListing helper started...
      Connecting socket for: MMM-Tools
      Connecting socket for: MMM-CalendarExt
      Connecting socket for: MMM-MyCommute
      ====================== Starting node_helper for module [MMM-MyCommute]
      Sockets connected & modules started ...
      
      Ready to go! Please point your browser to: http://0.0.0.0:8080
      Whoops! There was an uncaught exception...
      SyntaxError: Unexpected token < in JSON at position 0
          at JSON.parse (<anonymous>)
          at Request.request [as _callback] (/home/chris/MagicMirror/modules/MMM-NOAA/node_helper.js:77:30)
          at Request.self.callback (/home/chris/MagicMirror/node_modules/request/request.js:185:22)
          at emitTwo (events.js:126:13)
          at Request.emit (events.js:214:7)
          at Request.<anonymous> (/home/chris/MagicMirror/node_modules/request/request.js:1157:10)
          at emitOne (events.js:116:13)
          at Request.emit (events.js:211:7)
          at IncomingMessage.<anonymous> (/home/chris/MagicMirror/node_modules/request/request.js:1079:12)
          at Object.onceWrapper (events.js:313:30)
          at emitNone (events.js:111:20)
          at IncomingMessage.emit (events.js:208:7)
          at endReadableNT (_stream_readable.js:1064:12)
          at _combinedTickCallback (internal/process/next_tick.js:138:11)
          at process._tickCallback (internal/process/next_tick.js:180:9)
      MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      

      From now on i can’t figure out whats the problem…
      Line 77 in the NOAA node_helper checks the current position and when i type “http://www.ip-api.com/json” in my browser i get a result beginning with:

      {"as":"AS3320 Deutsche Telekom AG", etc.....
      

      So why is he saying Position 0 in JSON is a SyntaxError

      Anyone have an idea?

      Thank u guys

      Edit:

      Oh ehm… here the config snippet:

      {
      			disabled: false,
      			module: 'MMM-NOAA',
      			position: 'top_left',
      			config: {
      
      				apiKey: "XXX",
      				airKey: "XXX",    // IF you want Air Quality Index
      				pws: "XXX"       
      				}
      			},
      

      And yes, i used the new API from weatherbit

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

      Not much time, so here comes just a short think…

      1. You have two cogs on the pir. Move the time delay completely left or right (so it will just give a very short impulse).

      2. Set the Shutoff-delay in the script to 5 seconds (just to try)

      3. Try another GPIO…

      4. try a pull-up or pull-down resistor like used at thy button-method

      Bild Text

      posted in Tutorials
      cruunnerrC
      cruunnerr
    • RE: PIR Sensor - Sleep LCD monitor

      https://forum.magicmirror.builders/topic/6291/howto-turn-on-off-your-monitor-time-based-pir-button-app?page=1

      take a look at point 5.2 ;)

      u can define a delay time

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

      Hey mate,

      the way that will work in every case is to use a relay to interrupt the voltage for the pir.
      Then write two little bash files and execute them via cronjob.


      turn on relay with GPIO 7 and give the PIR voltage:

      gpio mode 7 out
      gpio write 7 1
      

      turn off the relay with GPIO 7 and interrupt the PIR voltage:

      gpio mode 7 out
      gpio write 7 0
      

      otherwise u could use if statement with a datetime check within the python script. something like this: https://stackoverflow.com/questions/10048249/how-do-i-determine-if-current-time-is-within-a-specified-range-using-pythons-da/10048290

      If i find some time, i will try to adjust the python script from this tutorial…

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

      @blebbens said in {HowTo} turn on/off your monitor (Time based, PIR/Button, App):

      Thanks for this tutorial…

      I am using a PIR. The monitor switches on immediately after detection of motion. I am looking for an option to switch on the monitor if a person stands in front of it for 10 seconds. Mine is a floor mirror, so some people are crossing the floor many times a day without looking at the mirror.

      If u use the external PIR script (point 2.2) u could try to change line 25 in the script and define a TURNON-DELAY.

      if turned_off and time.time() >= TURNON_DELAY:
      

      The whole script would look like this:

      #!/usr/bin/env python
      
      import sys
      import time
      import RPi.GPIO as io
      import subprocess
      
      io.setmode(io.BCM)
      SHUTOFF_DELAY = 120 # in seconds, how long the monitor will be on until next button press or PIR detection
      TURNON_DELAY = 10
      PIR_PIN = 22       # 15 on the board (this needn't to be a PIR. Can be a button also)
      LED_PIN = 16      # optional, don't use as Relay-PIN. It just shows detection time of the PIR without delay time
      
      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 and time.time() >= TURNON_DELAY:
                      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()
      
      

      Don’t know if it will work. Just brainstorming cause i haven’t much time

      posted in Tutorials
      cruunnerrC
      cruunnerr
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 27
    • 28
    • 4 / 28