Giter Site home page Giter Site logo

crazyrex / node-smarthomeserver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mbarany/node-smarthomeserver

0.0 2.0 0.0 137 KB

A small Node Server to interact with the Vera Smart Home system (http://getvera.com/)

Home Page: https://hub.docker.com/r/michaelbarany/node-smarthomeserver/

License: Apache License 2.0

Dockerfile 0.89% JavaScript 97.38% HTML 1.73%

node-smarthomeserver's Introduction

Node-SmartHomeServer

A small Node Server to interact with the Vera Smart Home system (http://getvera.com/).

Features:

  • Set device states via command line
  • Weekly schedules
  • Set schedules at exact times or relative to local sunrise/sunset times
  • All times are relative to the Timezone setting in the config file
  • Vera UI7 remote url support. Given your vera username/password the system will fetch a remote url session
  • API Server. When in server mode you can send RESTful API calls to control your vera system

Some scheduling examples:

  • Turn on the living room light every Tuesday and Thursday at 5pm
  • Set the main thermostat to 70 degrees every weekday at 8am

Global Dependencies

Setup

  • cp config/config.sample.js config/config.js and modify accordingly. See comments in Sample config for more details.
  • cp config/schedule.sample.js config/schedule.js and modify accordingly. See comments in Sample schedule for more details.
  • docker-compose up -d

CLI

  • List all available devices: smarthome-cli --list
  • Preview the current schedule: smarthome-cli --preview
  • Change the state of a device: smarthome-cli [deviceId] [state]
  • Execute a scene: smarthome-cli [sceneId]

API

Set the port in api.port section of the config. The default is 8080 which is also exposed in the docker container. Basic Authentication is used to authenticate API calls. Simply pass a valid pre-shared key that you have placed in the api.accessTokens section of the config as the username portion and leave the password blank.

Example API Call:

curl -u "{accessToken}:" http(s)://{host}:{port}/api/devices

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 220
Date: Fri, 21 Nov 2014 10:05:47 GMT
Connection: keep-alive

{
  "switches": [
    {
      "id": "1",
      "name": "Den Light"
    },
    {
      "id": "2",
      "name": "Outside Light"
    },
    {
      "id": "3",
      "name": "Master Bedroom"
    }
  ],
  "dimmableSwitches": [
    {
      "id": "4",
      "name": "Dining Room Light"
    }
  ],
  "thermostats": [
    {
      "id": "5",
      "name": "Thermostat"
    }
  ]
}

GET /api/devices

Returns an array of all the devices on your vera system

POST /api/devices/{deviceId}/{state}

Sets a new state given a device id

POST /api/scenes/{sceneId}

Runs a scene given a scene id

GET /api/schedule

Returns an the schedule for the current week

License

Copyright 2014-2017 Michael Barany

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

node-smarthomeserver's People

Contributors

mbarany avatar

Watchers

James Cloos avatar Radoaslav Nedyalkov 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.