Giter VIP home page Giter VIP logo

node-greenwave-gop's Introduction

node-greenwave-gop

A node.js module to interface with the GOP service from Greenwave Reality.

Install

npm install greenwave-gop

Read Carefully

This is an unofficial implementation, based on the GreenWave Reality Connected Lighting Solution as implemented in the Connected by TCPi product line.

No representation is made as to the fidelity of this implementation: in other words, the people making the lighting gateway are free to change the protocol at any time. If that happens, please contact the maintainer of the repository to take a look.

In fact, a change recently occurred:

  • 'https' is now required instead of 'http'
  • the gateway no longer advertises itself via the mDNS, but instead uses SSDP

Requests are sent via POST, with the body containing a URL-encoded XML document. Responses are also XML documents (minus the URL encoding, of course).

The protocol itself appears rich, and this module implements only the smallest subset necessary to discovery, rename, and on/off/dim bulbs.

API

Load

var Gop = require('greenwave-gop');

Discover and Update

var gop = new Gop().on('discover', function(controller) {
  controller.on('update', function() {
    var d, device;

    for (d in this.devices) if (this.devices.hasOwnProperty(d)) {
      device = this.devices[d];

      console.log('    device '  + device.did + ': ' + device.name);          

      controller.setBulbLevel(device.did, false); // off
      controller.setBulbLevel(device.did, true);  // on

      if (device.type === 'multilevel') controller.setBulbLevel(device.did, true, 50);
    }
  }).on('error', function(err) {
    console.log(this.tag + ': ' + err.message);
  });
}).on('error', function(err) {
  console.log('oops: ' + err.message);
});

License

MIT license. Freely have you received, freely give.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

node-greenwave-gop's People

Contributors

mrose17 avatar

Stargazers

Krystian Charubin avatar Robert Vineyard avatar Androbot avatar Josh Dick avatar

Watchers

 avatar Brian Dunlay avatar James Cloos avatar  avatar

node-greenwave-gop's Issues

mdns discovery error EADDRINFO

First of all, thanks for writing this node module, this is really awesome especially given that these Connect by TCP lights don't have an open and published API (btw, is there any documentation about their API somewhere - I tried google but came up empty).

Unfortunately, I am not able to connect to them, running test.js shows this error in the logs: _gop._tcp {event=mdns, diagnostic=getaddrinfo EADDRINFO}

As a side note, the steward does error in the same way: error: [discovery] _gop._tcp event=mdns, diagnostic=getaddrinfo EADDRINFO.

I am not sure if there is something I need to do beyond setting the gateway up (which is working fine with 2 bulbs).

Thanks for all your awesome work and help!

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.