Skip to content
This repository has been archived by the owner on Mar 14, 2018. It is now read-only.

Commit

Permalink
Service in JSON hinzugefügt
Browse files Browse the repository at this point in the history
  • Loading branch information
Schnittcher committed Feb 7, 2017
1 parent af7d2d8 commit c54c8ae
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ Websocket.prototype.validate = function(accessory) {
return {isValid: isValid, message: message, value: value};
}

Websocket.prototype.get = function(name, c, callback) {
Websocket.prototype.get = function(name, service, c, callback) {

//this.log.debug("get %s %s", name, c);

if (typeof(this.ws) !== "undefined" && this.ws.OPEN) {
this.g_callback[name+c] = callback;
var data = {"topic": "get", "payload": {"name": name, "characteristic": c}};
var data = {"topic": "get", "service": service, "payload": {"name": name, "characteristic": c}};
this.sendData(data);
} else {
this.log.debug("get client disconnected.");
Expand All @@ -207,16 +207,16 @@ Websocket.prototype.get = function(name, c, callback) {
}.bind(this), 1000);
}

Websocket.prototype.set = function(name, c, value, callback) {
if (typeof(this.ws) !== "undefined" && this.ws.OPEN) {
Websocket.prototype.set = function(name, service, c, value, callback) {

if (typeof(this.ws) !== "undefined" && this.ws.OPEN) {

if (c === "On") {
value = (value == 0 || value == false) ? false : true;
}
var data = {"topic": "set", "payload": {"name": name, "characteristic": c, "value": value}};

var data = {"topic": "set", "service": service, "payload": {"name": name, "characteristic": c, "value": value}};

switch (c) {
case "Brightness":
case "TargetPosition":
Expand Down

0 comments on commit c54c8ae

Please sign in to comment.