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"

mmm-ifttt's People

Contributors

jc21 avatar snille avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmm-ifttt's Issues

Problem with IFTTT

Hi, I just installed your module and it works fine with the curl example that you put in the doc file. But, I did some tests with IFTTT and none are working.

An easy test was to make a Button as a trigger and the Web Request with a public URL of a Linux server with Magic Mirror running in a Docker container. POST is selected and application/json also. The body is : {"message": "Your pizza is ready!"}
I got 2 errors in the IFTTT activity log, Action skipped or Webhook error.

Like I said before, the curl test is working, why the same URL used with IFTTT do not work?

Thanks for your help.

Multiple instances possible?

Hi, I'm currently using your module in "middle_center" region. Now I would like to display messages on the "top_center" region at the same time. Is this possible somehow?

Thank you!

IFTTT sends at 400 Error

I have set the Module up and all works using the Curl command from anywhere. However I get a 400 error on the IFTTT link when I try to send anything through WebHooks.

I have reduced the message body to

{
“message”: “Message Received!”
}

I will add the ingredients once it works.

thanks for any help.

Module not listening on port 8080

So I have installed the module, am using duckdns and port forwarded thru my pfsense router. No I try the endpoint test you have in the docs and it gives me a connection refused error. Thought I did something wrong so I went back and double-checked things. everything looked good so I restarted and tried again. nothing, so I triple and quadruple check and everything looks good. Decided to try to do a local check and ran your -curl command but substituted the local IP for the duckdns. same error. checked the port 8080 on the magic mirror and connection failed as well. seems that the mirror itself is not accepting connections on port 8080 despite the module being installed correctly how could I fix this?

Connection Blocked

MagicMirror blocks the connection of ip address of IFTTT, and since IFTTT sends command using different ip addresses so I can't whitelist one or two ip addresses. How to solve this ?

size does not change if sent via JSON

Hi, I'm using your plugin to send messages.
All works except the "size" property. It does not matter if I send it with the "message", it still displays as size is defined in the "config".
This is the JSON I send:
{"message": "Hi there", ","displaySeconds": "10", "size": "small"}
It shows the message in "large" anyway.
What am I doing wrong?

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.