Coder Social home page Coder Social logo

twilifi's Introduction

Overview

Small program to experiment with the Twilio api. I have never used the notifications of my camera system at home. In order to play with the Twilio api I decided to see if I could get events when the cameras detect motion and then send a notification. The motion event on the cameras is also terrible(many false positives) so it may be an opportunity to apply image classification beyond what the platform provides.

Current State

The dotnet core application runs in a 1 minute loop and looks for new motion events that the cameras detected. If there are any new ones it will send a text message that only contains the count.

Possible Enhancements

  • Use camera api to get thumbnails and send them along in an mms
  • Provide the ability to restrict which cameras are included
  • Fancy ML to ignore things like delivery drivers

Configuration

All configuration is done via environment variables

Name Description
UNIFI_USER username that is used to log into the unifi protect controller
UNIFI_PASS password for the unifi protect controller
UNIFI_ENDPOINT Url for the unifi controller
TWILIO_SID Twilio sid
TWILIO_TOKEN Twilio token
TWILIO_NUMBER Twilio phone number with leading +
SEND_NUMBER Phone number to send sms to with leading +

Unifi Api

This doesn't really exist, but there are some links on the internet that will help figure out how to extract data.

curl -k https://192.168.1.30/api/ump/info

# Get a bearer token with username/pwd
curl -k -X POST -H "Content-Type: application/json" -d '{"username": "...", "password": "..."}' https://192.168.1.30:7443/api/auth

token="..."

# Get an access key with bearer token - not sure what this is used for
curl -k -X POST -H "Authorization: Bearer $token" https://192.168.1.30:7443/api/auth/access-key

# Get recent events - would like to filter for cameras
curl -k -H "Authorization: Bearer $token" https://192.168.1.30:7443/api/events?end=1573510042317&start=1573423642317&type=motion

https://192.168.1.30:7443/api/thumbnails/5dc98e3902353b03e70010aa?accessKey=...&h=79&w=140

twilifi's People

Contributors

lbowman avatar

Watchers

 avatar

twilifi's Issues

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.