MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. ninjabreadman
    N
    • Profile
    • Following 0
    • Followers 3
    • Topics 4
    • Posts 201
    • Best 68
    • Controversial 0
    • Groups 0

    ninjabreadman

    @ninjabreadman

    101
    Reputation
    4923
    Profile views
    201
    Posts
    3
    Followers
    0
    Following
    Joined Last Online

    ninjabreadman Unfollow Follow

    Best posts made by ninjabreadman

    • RE: How to update the master branch?

      @PaulB First, make a backup of your install with cp -r ~/MagicMirror ~/MM-Backup. Then run git stash in ~/MagicMirror to temporarily stash your changes so that git can merge all those new commits.

      To merge, run git pull to update your MM install, then use npm install to upgrade or install any new dependencies to the appropriate version.

      Once complete, run git stash apply to reintroduce your changes (while also keeping them in the stash) – you may need to deconflict or otherwise review these changes. You can see your changes with git diff.

      Once you’re happy and MM is running smoothly, you can git stash drop to get rid of the stash. You can run rm -rf ~/MM-Backup once you’re content it’s all working as it should.

      Finally, I recommend you take the opportunity to also run sudo apt-get update && sudo apt-get dist-upgrade npm && sudo dist-upgrade pm2 (I think nodejs should upgrade as a dependency of npm but could be wrong).

      posted in Troubleshooting
      N
      ninjabreadman
    • RE: What is the difference between require() and getScripts()?

      @E3V3A

      require() is for when you mean “I’m going to use this code somewhere else in this script I am writing right now” — i.e. somewhere on the server-side.

      getScripts() is for when you mean “my client-facing/browser code will need this loaded to perform some operation” — i.e. somewhere on the client-side.

      (As always, this is what I understand and hope someone will correct me if I’m wrong.)

      posted in Development
      N
      ninjabreadman
    • Trouble with Smart Quotes, etc

      Someone sent you here because you were probably having trouble with smart directional (aka angled or curly) quotes. Most often this is an issue with Macs because they do “smart punctuation” replacement, including in TextEdit, the default text editor.

      This is mostly a problem for quotes, where it changes quotes (") to their directional alternatives (“ or ”). Here is their support document on the topic. When writing prose, this is generally a good idea. In writing code, it’s not.

      In Windows, such smart replacement done at a program level on certain word processors, like Microsoft Word, but not in things like Notepad, the default text editor for Windows. This is why it’s more of a problem for Mac users.

      Straight double quotes (") are different characters from open and close quotes (“ or ”). They look very similar to us, but the JavaScript/Node.js parser doesn’t think so. Straight quotes have the code points of U+0022 or U+0027, but directional quotes have completely separate code points.

      If you’re having trouble with smart quotes, you’ll need to start using a proper text editor that doesn’t allow the system to automatically insert directional quotes. The default editor on Mac (called TextEdit) is much more of a note taking or word processing program (much more like WordPad) than a text editor for code. It doesn’t understand code, and does things that break it. Use a true text editor like Atom, BBEdit, TextMate, etc. Or more sophisticated tools like Coda. Pick one, download it, install it, and use that to open/edit/save your config and other code files. (NB: I recommend Atom because it is supported and distributed by GitHub, is free, and is well-supported and open-source, with a good plugin architecture and community. YMMV.)

      Once you’ve downloaded and installed Atom (by moving it to your ~/Applications folder on your Mac) you can run it then open the file, or right-click a file and select “Open with…” and choose Atom. Not only will it not break your code, it will colour-code (called “syntax-highlighting”) it, show you where brackets/braces match, and can help to make your code legible (called “Beautify” in Atom).

      In order to edit remotely on (for example) a Raspberry Pi on your local network, you can use an SFTP client like FileZilla or CyberDuck. SFTP will need to be enabled on your RPi. You can then connect to the RPi and edit files remotely (not download, edit, upload; both programs have an “edit” option that will let you edit and save remotely in an editor … change it to Atom for js/css/html files in the preferences). This should allow you to edit files on your MM remotely.

      posted in Troubleshooting
      N
      ninjabreadman
    • RE: GIF update from URL with MMM-EyeCandy

      @Mykle1 @JRWJR

      I think this should work; add the following at the bottom of the start function in MMM-EyeCandy.js:

        start: function () {
        
          ...
            
          // ADDED: Schedule update timer
          setInterval(function() {
          self.updateDom(self.config.fadeSpeed || 0); // use config.fadeSpeed or revert to zero
          }, this.config.updateInterval);
      
        }, // this was line 83
      
      posted in Troubleshooting
      N
      ninjabreadman
    • RE: (2.1.0) Calendar will broadcast events.

      @jer78 Here is the Readme.md for third party modules, which details the notification system: https://github.com/MichMich/MagicMirror/blob/master/modules/README.md

      Your module will receive a CALENDAR_EVENTS notification, with a payload which is an array of calendar events objects with the following attributes: title, startDate, endDate, fullDayEvent, location and geo.

      You can make your own module, or modify an existing one. MMM-Traffic will display Google Maps directions to a given destination. You can override its receiveNotification function to (1) sort the payload to find the soonest event, (2) decide if there’s an event in the next 2 hours, and (3) display directions to the destination using the location or geo coordinates.

      Remember, you’ll need to populate those fields when creating your event entries, and you may also need to provide a hint (e.g. “Colombus, OH”) to Google so it knows which “Olive Garden” or “Municipal Library” you’re looking for.

      posted in Upcoming Features
      N
      ninjabreadman
    • RE: Prepping my first build. Care to check my work?

      @3DPrintedWaffles

      Just here to echo and add to the comments from @bhepler:

      • Liquid nails can work, but you will need to clamp (or otherwise brace) the corners to let it dry. Usually for a wood joint you will use fasteners (nails, screws) and reinforce with glue. If not using fasteners, you can also use a biscuit or tongue to reinforce the joint.
      • If you use screws, pre-drill the holes to avoid splitting your wood. You may also consider whether you want to create butt joints (square) or miter joints (angle).
      • The bezel is also often what hides the electronics behind your mirror. Without the bezel, you may still want a skirt behind the mirror to conceal those elements.
      • With bevel-less, you may want to find the most opaque material possible to prevent light entering the back of your mirror (that would otherwise be mostly blocked by the bezel/skirt).
      • I have no experience with gluing to glass, but would worry about seeing the glue beneath your mirror.
      • Also, given that your glass and display will be different sizes, if you mount the display in a corner of the glass you will need multiple mounting points for your mirror – it won’t hang level from a single point (as it won’t balance).
      posted in Development
      N
      ninjabreadman
    • RE: This Day in History ticker?

      @donutsoup I think @cowboysdude’s module should do what you want: https://forum.magicmirror.builders/topic/1803/mmm-history/9

      It’s a TDIH module that cycles through different years and their significance.

      posted in Requests
      N
      ninjabreadman
    • RE: change default position of module

      You’re right; for what you were trying to do, you need to use position in config.js. From what I understand you’re trying to do – I could be wrong – you can put this in your custom.css:

      div.region.bottom.left div.module.newsfeed {
        text-align: center;
        max-width: 500px; /* change to whatever width you want */
      }
      

      This will make any newsfeed module in the bottom_left position still center its text.

      By default, any module put against the sides align their text accordingly. This will override that behaviour. You will need max-width otherwise the module will simply (at least, in my testing) span the whole screen.

      nbm

      posted in Troubleshooting
      N
      ninjabreadman
    • RE: What is the difference between these function definitions?

      @E3V3A The former is object notation; therefore, you need to be defining an object. For example:

      var Lemon = {
        skinColor: "yellow",
        juice: 10, // in mL
        squeeze: function() {
          return this.juice;
        }
      }
      

      That way, for each Lemon you can call Lemon.squeeze(). It is relative to itself; the Lemon returns its juice, that it only knows about because it’s a complete object.

      Meanwhile, if you have myFunction() it doesn’t belong to an object. It just exists. You can call it from anywhere as myFunction(). You can even assign it to another variable and call it from there (this is also why you can pass a callback function as an argument):

      var myFunction = new function(){
      ...
      }
      var otherFunction = myFunction;
      otherFunction();
      

      You can also have “lambda” functions that have no name.

      But, to answer your question, you can only use the “object” style if you’re in the middle of defining an object. An “object” style function (most often called a “method” of the object) can also reference the object itself, whereas as a function without an object needs it to be passed as a parameter, such as squeeze(someLemon).

      posted in Development
      N
      ninjabreadman
    • RE: Change colors on each news feed

      If anyone is interested, as a consequence of this post (and a +1 I saw somewhere…), I’ve created a PR adding this functionality to the core newsfeed module. I don’t know that it will be accepted, but hope someone finds it useful.

      If anyone on the forums is interested, you can use PR #1137 on MM to check it out.

      Thanks!

      posted in Development
      N
      ninjabreadman

    Latest posts made by ninjabreadman

    • Connection Monitor/Graph

      Is anyone using their MM/RPi to monitor their broadband speed and uptime? I intend to use speedtest-cli with an MM graphing/display module. Just curious about how much bandwidth and memory it consumes, performance on an RPi, any existing/purpose-built modules, or other ideas/thoughts. Thanks!

      posted in Utilities
      N
      ninjabreadman
    • RE: Raspberry Pi 0w Module Errors

      @elaniobro IIRC, your folder and filename should match the Module.register() call exactly. So your folder should be MMM-my-module (and NOT MMM-MY-module). You also have an error in loader.js so that’s my guess. It’s doesnt look like loader.js does any manipulation except to add/compare to loadedFiles.

      posted in Development
      N
      ninjabreadman
    • RE: MMM-Timetable

      @maxbachmann You could write it in a CSV/tabular format and use a converter to transform it into JSON array format. You can also do it locally if you’re so inclined.

      posted in Productivity
      N
      ninjabreadman
    • RE: Raspberry Pi 0w Module Errors

      Does MM on the Zero start successfully without your custom module? Have you checked the naming of your module folder, files, config on the Zero? When you edit the files remotely in nano, do they look right (no encoding issues, etc)?

      posted in Development
      N
      ninjabreadman
    • RE: MMM-MyCalendar

      @twosquirrels It looks like you need to use the using_nunjucks branch. The default branch is still (it seems to me, on my phone) 1.0 – it doesn’t contain an .njk template file.

      posted in Utilities
      N
      ninjabreadman
    • RE: MMM-MyCalendar

      @himanshulotia Yes.

      First, you can set colored: true in the config, then add color: "#d9b4b2” and color: "#a0cfe2" per the docs.

      Second, have a look at the FontAwesome 4 docs. You could likely insert them into your headings. For how to insert images, you could probably use CSS if you can find the right selectors.

      posted in Utilities
      N
      ninjabreadman
    • RE: MMM-MyCalendar

      @twosquirrels Does MMM-MyCalendar support a column layout? I can’t find any reference to a columns property for its config: https://github.com/jclarke0000/MMM-MyCalendar/blob/master/README.md

      posted in Utilities
      N
      ninjabreadman
    • RE: Can i remove the Logo of Magic Mirror In start?

      @postremalone Fastest way to show MM is to have the RPi already running, then simply turn on the the display. Check out this thread here for use with a PIR or other sensor/button. Apparently, because it already draws such little power, there is no desire to implement suspend on RPi.

      As for speeding up boot, as @lavolp3 said, the issue is not the logo, but booting the OS. You can strip down the Raspbian boot for speed, but it will never be instantaneous (sub 1 sec). You can apparently get down to 10 seconds with a stripped down distro and Class 10 SD card.

      posted in Troubleshooting
      N
      ninjabreadman
    • RE: Make Text color inverting the background image

      @rak I suggest you avoid using z-indexing, margins and absolutely positioning unless you added them (and understand their effects).

      Here’s a site doing fundamentally what you want: https://css-tricks.com/methods-contrasting-text-backgrounds/

      .clock div.time.bright.large.light {
        color: white;
        mix-blend-mode: difference;
      }
      
      

      I expect that it should work, but will depend on how the wallpaper is inserted into the DOM.

      posted in Custom CSS
      N
      ninjabreadman
    • RE: Todoist accesstoken

      @zdenek No problem, it happens to all of us. Glad to hear it’s working!

      posted in Troubleshooting
      N
      ninjabreadman