HowTo: Magic Mirror – Install 3rd party modules

As in the article MagicMirror - Installing the required software As already mentioned, the basic functionality of the MagicMirror software can be expanded using various plugins. Where you can find these plugins and how to install them is described in the following article.


Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/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 make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂 


Requirements

Helpful articles:
Before you start the installation, you should have prepared the RaspberryPi so that it is accessible via the network and controllable via SSH. The MagicMirror software should also be set up.

The following articles describe what has to be done to prepare the RaspberryPi so far:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH

MagicMirror - Installing the required software

Required material:
-no-

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/MichMich/MagicMirror/ there is, among other things, a list of all available 3rd party modules: https://github.com/MichMich/MagicMirror/wiki/3rd-party-modules

All modules are listed there, including a brief description.

The "MMM-NetworkConnection" module is installed as an example for this article.
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 very identical.

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


Log in to the RaspberryPi via SSH

To start, you must first log in to the Rasp Pi with Putty via SSH. How to do this is in the article RaspberryPi - Control the RaspberryPi via SSH described.

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

Installing the module

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

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

To do this, 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 can be 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. Please note, however, that a ".git" must be appended to the link.

After entering the command, the plug-in files are copied to your RaspberryPi.

2. install any required software components

In many cases, the MagicMirror modules require other software components in order to function correctly. These must therefore be installed beforehand.
The practical thing is that almost every module comes with an installation script.
To install, simply change to the module directory and then start the installation.
Switches with

cd ~/MagicMirror/modules/MMM-NetworkConnection

into the module directory and starts the installation with the command

npm install

3. editing the MagicMirror configuration file

So far you have installed the required files and software components. Now you just have to "tell" the MagicMirror software that there is a module dormant that should be loaded the next time you start MagicMirror. You can also specify a few settings for the module.

To inform the MagicMirror software of all these settings, you must first open the configuration file. This can be done with the following command

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

You can also "fine-tune" your module at this point. There are often many additional configuration options. For example, the following configuration options are available for this module

(Quote from the GitHub)

ConfigOptions

option default Description
updateInterval 600000ms (10 minutes) how often should the devices states refreshed
maxTime 5000 milliseconds how long to do speed test
initialLoadDelay 2500 milliseconds how long to delay to load the module
decimals 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 - i.e. the time interval after which the module display 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, navigate to the end of the configuration file using the arrow keys.
It is important that you insert the configuration of the module between the closing curly and closing square brackets. The configuration "blocks" are always summarized in curly brackets. If your MagicMirror does not start after a change, this is most likely due to forgotten or incorrectly positioned brackets.
After one paragraph...
...you can insert the configuration part of the newly installed module there.
It is then very helpful if you also indent it to the height of the other module configurations. This makes it easier to read and may also make troubleshooting easier 🙂
Then you can save the configuration file with "CTRL-X"...
...and close by pressing "Enter".

4. transfer of the settings

You do not need to do anything else to apply the settings, except save and close the configuration file. The changes will then be recognized automatically and applied if there are no errors in the configuration file.
If the new module is not loaded automatically, you can also restart MagicMirror manually. This is described at the end of the following article:
MagicMirror - Set up autostart


More 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


Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS 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 think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at ko-fi.com       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.