Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.
/ MMM-IFTTT Public archive

MagicMirror Module for IFTTT Maker Web Based Notifications

License

Notifications You must be signed in to change notification settings

jc21/MMM-IFTTT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

MagicMirror Module for IFTTT Maker Web Based Notifications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published