Raspberry Pi Magic Mirror 2.

Creating a Magic Mirror, well the PI setup side of it anyway. I only got as far as using this as a Kiosk like app rather than building the mirror.

I did this in 2020 so there are probably more updated guides.

Assumptions

  • You are familiar with SSH
  • You are familiar with Terminal
  • You can find your Pi

 

 

 

 

MAGICMIRROR2

 

Document Info

Created 20200510

Author SADEY

Purpose To use the https://magicmirror.builders/ to create an information board. Probably will not bother with the mirror element to start with…..at least get the News and Local Weather on it

 

Using: A headless Raspberry Pi 3+ v1.2 in a protodock. - although you can run this on any linux system and probably others.

 

Requirements: They sate you will need Electron and Node version 10



All the information here was obtained from here and links from it.

https://docs.magicmirror.builders/getting-started/configuration.html#raspberry-specific



Installation:

$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

$ sudo apt install -y nodejs

 

Clone the repository and check out the master branch: 

$ git clone https://github.com/MichMich/MagicMirror

Enter the repository: cd MagicMirror/

Install the application: npm install

Make a copy of the config sample file: cp config/config.js.sample config/config.js

Start the application: npm run start

For Server Only use: npm run server .

 

Problems when r

## Run `sudo apt-get install -y nodejs` to install Node.js 10.x and npm

## You may also need development tools to build native addons:

     sudo apt-get install gcc g++ make

## To install the Yarn package manager, run:

     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

     echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

     sudo apt-get update && sudo apt-get install yarn

 

So ran the following

$ sudo apt-get autoremove nodejs

$ sudo apt-get autoremove npm

$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash

$ sudo apt-get update

$ sudo apt-get install nodejs

$ sudo apt-get install gcc g++ make

$ cd MagicMirror/

$ npm install     - npm WARN deprecated time-grunt@2.0.0:    This also takes a while.

$ cp config/config.js.sample config/config.js

$ npm audit fix    >> fixes some vulnerabilities.

$ npm audit fix  --force  >> fixes some that couldn’t be fixed and warns sure u know what you are doing.

$ npm run start    >> you don’t get to the next command. Presume for auto starting.

$ npm run server





Usage

Note the following:

CNTL+Q  > quit the interface.

npm start does not work via SSH. But you can use DISPLAY=:0 nohup npm start & instead.

This starts the mirror on the remote display.

If you want to debug on Raspberry Pi you can use npm start dev which will start MM with Dev Tools enabled.

To access toolbar menu when in mirror mode, hit ALT key.

To toggle the (web) Developer Tools from mirror mode, use CTRL-SHIFT-I or ALT and select view

 

Modules

=======

Clock

Calendar

Current Weather

Weather Forecast

News Feed

Compliments

Hello World

Alert

 

Modules are maintained in the config file.

$ nano

 

This call will return RSS weather data from the bbc for stourport  - Module to get the weather from the bbc.

https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/2636767

 

This is my current config File - I have used the newsfeed module to return the weather from the BBC and changed the Calendar to UK holidays (not working) - changed the original newsfeed to BBC headlines.

 

Need to learn about moving the positions of the modules and there is some other cool stuff like facial recognition if you add a camera.

 

All in all you can get this going pretty quickly - but finding the RSS feeds etc is another thing. Getting the weather without registering is a bonus.

 

/* Magic Mirror Config Sample

 *

 * By Michael Teeuw http://michaelteeuw.nl

 * MIT Licensed.

 *

 * For more information on how you can configure this file

 * See https://github.com/MichMich/MagicMirror#configuration

 *

 */

 

var config = {

address: "localhost", // Address to listen on, can be:

                      // - "localhost", "127.0.0.1", "::1" to listen on loopback interface

                      // - another specific IPv4/6 to listen on a specific interface

                      // - "0.0.0.0", "::" to listen on any interface

                      // Default, when address config is left out or empty, is "localhost"

port: 8080,

ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses

                                                      // or add a specific IPv4 of 192.168.1.5 :

                                                      // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],

                                                      // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :

                                                      // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

 

useHttps: false, // Support HTTPS or not, default "false" will use HTTP

httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true

httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true

 

language: "en",

timeFormat: 24,

units: "metric",

// serverOnly:  true/false/"local" ,

    // local for armv6l processors, default

    //   starts serveronly and then starts chrome browser

    // false, default for all  NON-armv6l devices

    // true, force serveronly mode, because you want to.. no UI on this device

 

modules: [

{

module: "alert",

},

{

module: "updatenotification",

position: "top_bar"

},

{

module: "clock",

position: "top_left"

},

{

module: "calendar",

header: "UK Holidays",

position: "top_left",

config: {

calendars: [

{

symbol: "calendar-check",

url: "wwebcal://www.gov.co.uk/bankholidays/england-and-wales.ics" }

]

}

},

{

module: "compliments",

position: "lower_third"

},

/* {

module: "currentweather",

position: "top_right",

config: {

location: "New York",

locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city

appid: "YOUR_OPENWEATHER_API_KEY"

}

},

{

module: "weatherforecast",

position: "top_right",

header: "Weather Forecast",

config: {

location: "New York",

locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city

appid: "YOUR_OPENWEATHER_API_KEY"

}

},

*/

{

module: "newsfeed",

position: "bottom_bar",

config: {

feeds: [

{

title: "BBC News",

url: "http://feeds.bbci.co.uk/news/rss.xml"

}

],

showSourceTitle: true,

showPublishDate: true,

broadcastNewsFeeds: true,

broadcastNewsUpdates: true

}

},

{

module: "newsfeed",

position: "top_bar",

config: {

feeds: [

{

title: "BBC Weather Stourport",

url: "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/2636767"

}

],

showSourceTitle: true,

showPublishDate: true,

broadcastNewsFeeds: true,

broadcastNewsUpdates: true

}

},

]

 

};

 

/*************** DO NOT EDIT THE LINE BELOW ***************/

if (typeof module !== "undefined") {module.exports = config;}



Example of the current layout from the above config file.

Magic Mirror

Conclusion

I probably haven’t spent enough time on this and there are other mirror / kiosk programs out there to mess about with - 

It’s pretty cool to get going quickly - not sure I will build one, as the information I need is already on my phone and I don’t really need to share it. Building the modules doesn’t look overly complicated but not sure I have the inclination to act on this. Although they do look cool hanging on peoples walls.

 

The interesting thing is this is a Kiosk Browser and fetching information to build an information point to your own specifications. So basically a live information point. I might come back to it at some point….

 

Would be interesting to extend and add voice, AI, camera, mike. Let you know someone is at the door / cctv - detect locations of family. IOT’s coming at pace. Privacy is gone.

Another Pi Project complete.