Git Product home page Git Product logo

dashr's Introduction

Dashr

Dashr was originally intended to be used to trigger events from button presses of Amazon's Dash buttons (as shown here). Rather than hard coding specific actions that should be taken when the Dash button is pressed, Dashr follows the Unix philosophy, and simply writes the MAC address of the device to stdout. As shown in the usage examples below, this allows for tremendous flexibility.

A couple of potential smart-home ideas for Dashr include turning off lights when a Dash button is pressed, or turning down the air conditioner when you get home (by listening for the DHCP request from your cell phone reconnecting to wifi).

Install & Use

Run ifconfig to determine the name of the network adapter you want to use to listen for traffic. The example below assumes 'en0'.

cargo install
sudo dashr en0

On OS X, the following command will say (through the speakers) the MAC address of any device requesting an IP address via DHCP.

sudo dashr en0 | while read line ; do echo $line | say ; done

The following command will run script.sh anytime the device with MAC 88:71:E5:24:C4:76 requests an IP address via DHCP.

sudo dashr en0 | grep --line-buffered 88:71:E5:24:C4:76 | while read line ; do echo $line | ./script.sh ; done

With hue-cli it is possible to toggle the status (on/off) of you Hue lights by pressing the Dash button.

sudo dashr en0 | grep --line-buffered 88:71:E5:24:C4:76 | while read line ; do echo $line | hue-cli cmd toggle ; done

If you'd rather not install dashr, you can replace sudo dashr above with sudo cargo run. In OS X, sudo is required to listen for network traffic.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Attributions

This code is based heavily on the packet dump example of the libpnet library.

dashr's People

Contributors

joshmcguigan avatar

Stargazers

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

Watchers

 avatar  avatar  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.