MagicMirror module

Students: Jordy Ubink & João Rocha

MagicMirror Module for displaying Discourse notifications

Introduction

We made a module (plug-in) for the MagicMirror (see it here). That is a smart mirror, driven by a Raspberry Pi, that shows you news, information and notifications. Our plugin makes it possible to show notifications of every website that uses Discourse, a discussion/mailing/forum platform used by over 10.000 organisations.

What is a MagicMirror?

MagicMirror is a see-through mirror in front of a display, that is hooked up to a Raspberry Pi. While it works as a mirror, you can see the screen through the glass. Right now, there are 671 3rd-party modules publicly released for everybody to use, and ours is the 672th!

Modules can: Show the time and date, show the weather forecast, show when your train leaves, show news and much more.

 

What is Discourse?

Discourse is an open source Internet forum and mailing list management software application that is used by many sites. One of them, is RobotExchange.io, the site where our minor communication takes place.

Project description

Problem

When someone sends you a message, you don’t want to let them wait. Especially when it’s very urgent. When the message is showed to you in the mirror, you don’t have to check the site or your mail every time.

Solution

Having the notifications displayed on a mirror is a nice solution. That way, you see the message casually when you walk by your mirror in the living room. The message can be dismissed by reading or acknowledging the message on the user’s Discourse-platform.

Discourse is getting more popular every day. That means that every day, the module we will create gets more popular.

How did we make it?

As can be seen in the Product Breakdown Structure below, it takes a lot of work to make a module.

Git(hub) automation

To make a software project professional, it is important to review code of your team mates. This can take a lot of time. That is why we started automating our repository.

 

  1. We implemented (ES)Lint checks. Everytime somebody uploads software to our project, it gets automatially checked on coding style mistakes. This way
  2. Unit testing means that you test the behavior of your code. It’s best practice to do this before writing the actual code. When something breaks later, you get automatically notified when the tests are unsuccessful. We used the Jasmine testing framework with Karma as client.
  3. With continuous integration an application, like our module, can be easily published when it is passes all tests. Automating this, makes the proces of shipping your module less tedious.

Using the Discourse API

A big part of this project was dedicated to using the Discourse API. An API is an interface programs can talk to, to get notifications from Discourse.  We researched which API calls are necessary for our project, how to request an API key and how to handle the communication with different Discourse sites.

Writing the Module

The software was, as expected, the most work of all. We had to make a module that was, robust, flexible (easy to extend or reuse), easy to read and efficient.

To not overload the Discourse webserver, we limit our requests to 1 request per 3 seconds (max 20 per minute). The notifications are downloaded in the order they are needed. Where possible, multiple notifications can be downloaded at one. That is not always the case, because of limitations of the platform.

As can be seen in the class diagram below, the module is built out of multiple classes. Every class has it’s own purpose, which gives a clear overview of what every part of the software does. Making adjustments is very easy. For example: Changing to another HTTP-request handler, is as easy as editing only the DiscourseRequestHandler. All other classes stay intact. This flexibility makes our open source project easy to reuse for other purposes.

Building the mirror

We both made a mirror in a different way.

Mirror 1:

The frame of the first mirror is made out of wood. Instead of using a see-through mirror, a normal glass plate is used. This glass plate is covered with a semi-transparant foil layer.

 

 

 

 

 

 

 

 

Mirror 2:

The 2nd build uses a see-through mirror. This is glass, with a semi-transparant reflective surface.

 

 

 

 

 

 

 

 

 

 

Before building, I made a drawing in SolidWorks. I used alluminum profiles for the frame. The screen, the Raspberry Pi and its power supply can be stored inside.

 

 

 

The end

The module is finished and can be downloaded at our GitHub repository.