GithubHelp home page GithubHelp logo

basovchemeduardosanchez / dch-s220-web-control Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mig8447/dch-s220-web-control

0.0 0.0 0.0 33 KB

Module to control D-Link's DCH-S220 WiFi Siren via a custom REST API

JavaScript 99.30% Shell 0.70%

dch-s220-web-control's Introduction

D-Link DCH-S220 REST API

This project aims to control via a custom REST API the D-Link's DCH-S220 Siren to allow total customized control over this product for home automation enthusiasts or hobbyists.

This project is only possible due to the great work of @bikerp and his dsp-w215-hnap repo.

The project must run on a device in the same network as your siren (on a raspberry pi for example), you must open the configured ports on your router to access it from the outside.

Install

  1. Clone this repo
  2. Change into the project's root directory
  3. Install the dependencies by executing
    npm i
  4. Copy the .env.example into .env by executing
    cp .env.example .env
  5. Edit the .env file to configure the authentication and siren parameters
  6. Start the server by executing
    npm start

Additionally, you can add a watcher to the process with pm2

Consuming endpoints and controlling the siren

All endpoints must be consumed with HTTP GET under the root "/".

Start sounding the siren

Parameters:

  • type: 'start'
  • volume: A value from 1 to 100
  • sound: A value from 1 to 6
    • 1: emergency
    • 2: fire
    • 3: ambulance
    • 4: police
    • 5: door_chime
    • 6: beep
  • duration: A value from 1 to 88888 (infinite)

cURL Example:

curl 'http://localhost:3000/?type=start&volume=20&sound=1&duration=30'

Stop sounding the siren

Parameters:

  • type: 'stop'

cURL Example:

curl 'http://localhost:3000/?type=stop'

Sound n beeps

Parameters:

  • type: 'beep'
  • times: A number from 1 to n the siren must beep

cURL Example:

curl 'http://localhost:3000/?type=beep&times=1'

Get the current status of the siren

Figure out if the siren is sounding or not.

Parameters:

  • type: 'status'

cURL Example:

curl 'http://localhost:3000/?type=status'

Sample response

HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 06 Aug 2017 19:57:48 GMT
Connection: close
Transfer-Encoding: chunked

{"status":"OK","message":"Successfully processed","isPlaying":false}

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.