HowTo: Magic Mirror – Install 3rd party modules

As already mentioned in the article MagicMirror – Installation of the required software, the basic functionality of the MagicMirror software can be extended by various plugins. Where to find these plugins and how to install them is described in the following article.

Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section. 
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂


Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/

Affiliate links / advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, Nerdiy.de receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂


Requirements

Helpful Articles:
Before you start with the installation, you should have prepared the RaspberryPi so far that it can be reached via the network and controlled by SSH. In addition, the MagicMirror software should be set up.

The following articles describe what to do to prepare the RaspberryPi:
RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The First Configuration!
RaspberryPi – Control the RaspberryPi via SSH
MagicMirror – Installation of the required software

Required material:
-none-

Required material:

In the following list you will find all the parts you need to implement this article.


Find the desired module

In the very informative github https://github.com/Michith/MagicMirror/ there is a list of all available 3rd party modules: https://github.com/MichMich/MagicMirror/wiki/3rd-party-modules

There all modules listed including a short description.

For this article the example “MMM-NetworkConnection” is installed.
You can find it in the list above or under the link: https://github.com/slametps/MMM-NetworkConnection
The installation of the modules is almost always identical.

The “MMM-NetworkConnection” module displays current values for the quality of your Internet connection on your MagicMirror.


Log in via SSH on the RaspberryPi

To get started, you first need to log in to RasPi with SSH on Putty. How to do it is described in the article

After entering your username and password you can start to enter the first commands.

Installation of the module

In most cases, a small step-by-step guide is already provided on the GitHub page for each module.
The procedure is almost always very similar.

1. Copy the module files from the GitHub to your RaspberryPi

First change to the module directory of your MagicMirror installation.
By default, you can switch there with the following command:

cd ~/MagicMirror/modules

Now you have to copy the GitHub files of the desired module into your module folder.
This is done with the following command:

git clone https://github.com/slametps/MMM-NetworkConnection.git

The link “https://github.com/slametps/MMM-NetworkConnection.git” corresponds to the link to the desired module. Note, that the link needs to have a “.git” attached.

After entering the command, the plugin files will be copied to your RaspberryPi.

2. Install any required software components

In many cases, the MagicMirror modules require other software components to work properly. These must therefore be installed beforehand.
The practical thing is that almost every module comes with an installation script.
To install, you just have to switch to the module directory and then start the installation.
Switch to the module directory and start the installation with the following commands.

cd ~/MagicMirror/modules/MMM-NetworkConnection
npm install

3. Edit the MagicMirror configuration file

So far, you have installed the necessary files and software components. Now you just have to “tell” the MagicMirror software that there is a module slumbering that should be loaded the next time you start the MagicMirror. In addition, you can then specify a few settings for the module.

To tell the MagicMirror software all these settings you need to open the configuration file first. This is done with the following command

sudo nano ~/MagicMirror/config/config.js
{
    module: 'MMM-NetworkConnection',
    position: 'top_right',
    config: {
    }
}

At this point you can adjust your module even more “fine”. There are often many additional configuration options. For example, there are the following configuration options for this module

(Quote from the GitHub)

Config Options

Option Default Description
updateInterval 600000 ms (10 minutes) how often should the devices states refreshed
maxTime 5000 milliseconds how long to do speedtest
initialLoadDelay 2500 milliseconds how long to delay to load the module
decimal 1 how many decimals for the round
displayTextStatus true display connection text status or not
animationSpeed 2500 milliseconds speed of the update animation

For example, if you wanted to change the updateInterval – ie the time interval after which the display of the module is updated – the complete configuration part of the module would read as follows:

{
    module: 'MMM-NetworkConnection',
    position: 'top_right',
    config: {
            updateInterval: "300000"
    }
}

The “300000” stands for the time after which the module is updated.
The other settings are added in the same way.
If you do not explicitly specify the settings in the configuration file, the module uses the default settings.

To insert the configuration, use the arrow keys to navigate to the end of the configuration file.
There it is important that you insert the configuration of the module between closing curly and closing square brackets. The configuration “blocks” are always grouped in curly brackets. If your MagicMirror does not start after a change, it is most likely due to forgotten or incorrectly positioned brackets.
After a paragraph …
… so you can insert the configuration part of the newly installed module there.
It will be very helpful if you also adjust it to the height of the other module configurations. This simplifies readability and, if necessary, troubleshooting. 🙂
Then you can save the configuration file with “CTRL-X” …
… and close with a press on “Enter”.

4. Acceptance of the settings

You do not need to do anything else to save the settings except save and close the configuration file. The changes are then automatically detected and insofar no errors in the configuration file are accepted.
If the new module does not load automatically you can restart the MagicMirror manually. This is described at the end of the following article:
MagicMirror – Setting up the autostart


Additional Information

https://github.com/MichMich/MagicMirror
https://github.com/MichMich/MagicMirror/wiki/3rd-party-modules
https://github.com/slametps/MMM-NetworkConnection
https://forum.magicmirror.builders/topic/4231/how-to-add-modules-for-absolute-beginners


I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

Fab

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at ko-fi.com

Leave a Reply

Your email address will not be published. Required fields are marked *