Code Monkey home page Code Monkey logo

dashmonitor's Introduction

dashmonitor

A simple utility daemon for monitoring dash buttons on a local network and calling webhooks associated with them. Press button, call URL. Easy. This was written originally to create a poo button, which then got written up in Wired.

Installation

Get the code from GitHub and install dependencies. You'll need a recent version of nodejs installed. You'll also need to install libpcap on your system.

brew install libpcap # For OSX, your system may vary
git clone https://github.com/Floppy/dashmonitor.git
cd dashmonitor
npm install

Raspberry Pi

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install nodejs libpcap-dev
git clone https://github.com/Floppy/dashmonitor.git
cd dashmonitor/
npm install

Find your buttons

sudo node_modules/node-dash-button/bin/findbutton

Press the button, and the MAC address will appear in the list.

Configuration

cp config.json.example config.json
nano config.json

Create a line for each dash button, with the MAC address from the previous step and the webhook URL you want to call. You can use requestb.in if you're just testing, otherwise hooking up to a Zapier webhook is a good approach to then configure other services.

Running

npm start

OSX System Daemon

You can run this anywhere, but if you're using OSX, there is a plist file for running it as a system daemon. First, edit dashmonitor.plist and set the paths in the ProgramArguments and WorkingDirectory keys correctly for your system. Then:

cp dashmonitor.plist /Library/LaunchDaemons
sudo launchctl load /Library/LaunchDaemons/dashmonitor.plist

If you have problems with the system daemon, I highly recommend debugging it with LaunchControl.

systemd script

There is a systemd startup script for Raspbian or other Debian-ish systems:

sudo cp boot-scripts/systemd/dashbuton.service /etc/systemd/system/
sudo systemctl enable dashbutton.service
sudo start dashbutton.service

dashmonitor should now kick-off at boot-time

dashmonitor's People

Contributors

dependabot-preview[bot] avatar floppy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

pikesley

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.