GithubHelp home page GithubHelp logo

yo1l / homecam Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 4.58 MB

Docker REST api for my DLink camera in nodejs

License: MIT License

JavaScript 96.02% Shell 3.98%
nodejs docker dlink-cameras express axios slack

homecam's Introduction

HomeCam

Start/Stop your DLINK DCS-5222L camera from IFTT or a basic curl request.
I did not want to open my camera to IFTT through any DLink cloud service.
I wanted full controll so I implemented it on my own (reverse engineered).

Here are the current endpoints:

Endpoint Description
/camera/status get human readable status of the camera ("ON" or "OFF") and send the result to slack
/camera/state/on switch on the camera
/camera/state/off switch off the camera
/camera/toggle toggle status of the camera

Retrieving your status with curl:

curl http://localhost:3000/camera/status

How it works (Docker)

My image support multiple architectures such as x86-64 and arm32v7. I use the docker manifest for multi-platform awareness.

Simply pull yo1l/homecam should retrieve the correct image for your architecture.

docker pull yo1l/homecam

The architectures supported by this image are:

Architecture Tag
x86-64 amd64
arm32v7 arm32v7

Usage

docker

docker create \
  --name=homecam \
  -p 3000:3000
  -e "CAMERA_IP=192.168.0.1" \
  -e "CAMERA_USERNAME=root" \
  -e "CAMERA_PASSWORD=secret" \
  -e "HTTP_PORT=3000" \
  -e "SLACK_WEBHOOK_URL=https://hooks.slack.com/services/truc/muche/token" \
  -e "SLACK_ROOM=general" \
  -e "SLACK_ICON=':camera_with_flash:'" \
  yo1l/homecam

docker-compose

environment variables

version: "3"
services:
  homecam:
    image: yo1l/homecam
    environment:
      - CAMERA_IP=192.168.0.1
      - CAMERA_USERNAME=root
      - CAMERA_PASSWORD=secret
      - HTTP_PORT=3000
      - SLACK_WEBHOOK_URL=https://hooks.slack.com/services/truc/muche/token
      - SLACK_ROOM=general
      - SLACK_ICON=':camera_with_flash:'
    ports:
      - 3000:3000
    restart: unless-stopped

environment file

version: "3"
services:
  homecam:
    image: yo1l/homecam
    volumes:
      - /root/.env:/usr/src/app/.env
    ports:
      - 3000:3000
    restart: unless-stopped

Parameters

Variable Description
CAMERA_IP IP Adresse of your camera with or without port. Ex: 192.168.0.5:5000
CAMERA_USERNAME Admin username of the camera
CAMERA_PASSWORD Admin password of the camera
HTTP_PORT WEB Port for this server
SLACK_WEBHOOK_URL Slack webhook url
SLACK_ROOM slack room to send the status notification message
SLACK_ICON Icon

Unit tests

Unit tests are available to check the Camera proxy which is responsible for sending commands to the camera.

npm run test

TODO

  • Authentification
  • Automate docker manifest creation

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.