Giter Club home page Giter Club logo

mmm-ifttt's Introduction

MMM-IFTTT

MagicMirror Module for IFTTT Maker Web Based Notifications

Screenshot

This module is intended to display immediate notifications of events from If-This-Then-That channels. Notifications will show for a default of 60 seconds before disappearing. There is no on-screen history of events.

Module installation

Clone the module and npm install:

cd ~/MagicMirror/modules
git clone https://github.com/jc21/MMM-IFTTT.git
cd MMM-IFTTT
npm install

Add the module config to ~/MagicMirror/config/config.js

modules: [
    {
        module: 'MMM-IFTTT',
        position: 'lower_third',
        config: {

        }
    }
]

Module Configuration Options

Option Type Default Description
displaySeconds Integer 60 Number of seconds to show a notification for
fadeSpeed Integer 3000 Milliseconds fade transition speed
size String large Text size, options are: small, medium, large, xlarge

Setting up a IFTTT Maker Notification

Making your mirror internet accessible

For this module to work, you will need to get dirty with your router, specifically with Port Forwarding.

I'm not going to go into detail here, there are plenty of Google results on the topic.

You will need to forward any port you nominate, to the local IP of your Magic Mirror on port 8080.

You will also need to set up a dynamic DNS hostname for your home network, I'm a Duckdns fan personally. Atlernatively you could look into a http forward solution like ngrok.

IFTTT Maker Recipes

Log in to IFTTT and create a new recipe. You can essentially choose any channel you want for the Trigger but for the Action channel you must select Maker.

There is only one Action, "Make a web request".

Action fields explained:

Field Description Example
URL Notification endpoint http://yourhouse.duckdns.org:8080/IFTTT
Method HTTP Method, MUST be POST POST
Content Type How the data is sent application/json
Body The notification content, explained below
{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large"
}

The notification body JSON MUST contain the message item. If it doesn't, the endpoint will return a 400 error. All of the configuration options can also be passed with the JSON, which will override the config for that recipe only.

The <<<{{From}}>>> in the example above is a IFTTT wildcard field that you select in the Body section of the action. You can create any message you like that incorporates any wildcard. Stay away from fields that may contain HTML or links, they won't display well. These fields should be surrounded in <<< and >>> strings in order for the field to be escaped properly.

Using additional modules

This module will send out notifications to other supported modules, if those options are included in the notification JSON. The supported modules are:

IFTTT Module will automatically tell the Pir Sensor module to wakeup the monitor when a notification is received. No addition setup is required.

This additional module can display light sequences using a LED strip. An example of a notification that includes PiLights sequence:

{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large",
    "pilights": "blue-pulse"
}

Or with iterations:

{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large",
    "pilights": {
        "sequence": "blue-pulse",
        "iterations": 2
    }
}

This additional module can play audio sounds if your mirror supports it. An example of a notification that would play a Sound:

{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large",
    "sound": "wobble.wav"
}

Or with a delay:

{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large",
    "sound": {
        "sound": "wobble.wav",
        "delay": 1000
    }
}

You may want to use the delay approach to manually align the sound you're using with the light sequence, or to time the wakeup of the screen as well.

Testing the Mirror Endpoint

curl -X POST -H "Content-Type: application/json" \
    -d '{"message": "Your pizza is ready!"}' \
    "http://yourhouse.duckdns.org:8080/IFTTT"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.