Git Product home page Git Product logo

dash-btn's Introduction

Function

  • Initiates a home automation task following the press of an unmodified Amazon Dash button.
    • Done by executing a separate script that issues a command-line trigger (IFTTT Webhook via cURL) to toggle the power status of a device while keeping a local log of its present state.

Purpose

The goal is to bypass heavy dependencies like python, node, and libpcap present in popular projects to provide an alternative that relies solely on shell scripts and basic command-line tools present in a common distribution like OpenWrt. This enables hardware limited embedded devices, such as home routers, to achieve the same functional end as more capable server hardware. Rather than utilizing packet capturing, detecting a button press is accomplished by watching for when the button makes a DHCP request which is already normally logged by the system. The drawback to its simplicity is a lack of focus on security, with compromises made such as the use of HTTP instead of HTTPS in the web request of the trigger script for faster response time and embedded configuration variables for the sake of script brevity.

Requirements

  • OpenWrt base system deployed as primary DHCP server including logread and dnsmasq
  • BusyBox compiled with inotifyd selected (inotifywait equivalent)
  • GNU find utility (BusyBox find applet not acceptable)

Setup

  • Complete setup of dash buttons to configure wireless credentials and obtain network connectivity.
  • Observe the MAC address of each button for later use.
    • Recommended to be recorded along with each button's unique DSN number printed on the back of the case.
  • Restrict WAN traffic for each button and optionally later remove from Amazon account.
  • Establish a Wi-Fi enabled device and create an associated pair of IFTTT Webhook triggers for on and off functions.
    • The name of each Webhook must be spaced with underscores and suffixed by _on and _off (e.g. desk_lamp_on).
  • Configure /usr/bin/dash-btn with each button's name and MAC address as demonstrated by the default log# and mac# variable examples.
    • The name of each button must match a corresponding Webhook pair while being suffixed by _btn.
    • If multiple buttons are used to control a single device, append a number in increments (e.g. desk_lamp_btn1).
    • State the total number of buttons configured in the btntotal variable.
  • Set the value of the secret URL key from the IFTTT account being used in /usr/bin/toggle-smart in the key variable.
  • Restart the system or manually run the init script with /etc/init.d/dash-btn start.

dash-btn's People

Contributors

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