Giter Club home page Giter Club logo

motifini's Introduction

Motifini

This application allows you to send messages via iMessage using Messages.app with an API call. It also integrates with ffmpeg to capture videos from SecuritySpy.

This code is still very crude, under construction and lacking full documentation.

Usage

  1. Make sure Messages has an iMessage account configured.
  2. Send a message. Like this:
curl "http://127.0.0.1:8765/api/v1.0/send/imessage/msg/[email protected],[email protected]&msg=Office%20Window%20Closed"

Example Config File

The only requirement in the config file is an allowed_to list. Be sure to add your iMessage handle here or you cannot send yourself messages. Only addresses added to the config can have messages sent to them.

Setting clear_messages to true will delete every conversation in Messages.app.

Endpoints

  • /api/v1.0/send/imessage/video/{to}/{camera} Uses FFMPEG to capture a video from an IP camera (or other URL).

    • to (csv), list of message recipients
    • cam (string), camera name
    • width (int), frame size, default: 1280
    • height (int), frame size, default: 720
    • quality (int), h264 quality setting, default: 20
    • time (int), max video duration in seconds, default 15
    • rate (int), output frame rate, default 5
    • size (int), max file size, default: 2500000 (~2.5MB)
  • /api/v1.0/send/imessage/picture/{to}/{camera} This method requires SecuritySpy be running.

    • to (csv), list of message recipients
    • cam (string), camera name
  • /api/v1.0/send/imessage/msg/{to}?msg={msg} Just sends a plain-ol' message with iMessage.

    • to (csv), list of message recipients
    • msg (string), text to send

Indigo

Create two variables in Indigo. Name one variable Subscribers and the other SendMessage Create a trigger when SendMessage changes to run an Action.

Run this Action; replace the variable IDs with your own:

import urllib
import urllib2
import socket
timeout = 1
socket.setdefaulttimeout(timeout)

subs = urllib.quote(indigo.variables[1891888064].value, "")
msg = urllib.quote(indigo.variables[1023892794].value, "")
url = "http://127.0.0.1:8765/api/v1.0/send/imessage/msg/"+subs+"?msg="+msg

try:
    urllib2.urlopen(url)
    indigo.server.log(u"Dropped off message with Motifini!")
except Exception as err:
    indigo.server.log(u"Error with Motifini: {}".format(err))

SecuritySpy

This library taps into the SecuritySpy API and Event Stream. You do not need to do much besides provide a URL. You can then subscribe to any camera.

TODO

  • Better Usage/Install Documentation
  • Some reasonable way to add and control events, and how they fire.
    • For instance if you want a motion detector to fire a camera, or two, or a text message, how do you define and action that?
    • Or any combination of "event -> take some cool action (ie. send a specific type of notification)"
    • notifications currently supported: text, video, picture. (imessage only)
  • Add support for notifications via other providers. pushover, skype, others? what supports video?! srsly, nothing out there yet.
  • Add more info to expvar data: events, cameras, subscribers.

motifini's People

Contributors

davidnewhall avatar

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.