mirror of
https://github.com/mtan93/homebridge.git
synced 2026-05-23 06:08:54 +01:00
Won’t be able to do much unless accessories can use SSL/basic auth too.
This commit is contained in:
+9
-10
@@ -79,7 +79,7 @@ DomoticzPlatform.prototype = {
|
|||||||
if (json['result'] != undefined) {
|
if (json['result'] != undefined) {
|
||||||
var sArray=sortByKey(json['result'],"Name");
|
var sArray=sortByKey(json['result'],"Name");
|
||||||
sArray.map(function(s) {
|
sArray.map(function(s) {
|
||||||
accessory = new DomoticzAccessory(that.log, that.server, that.port, false, s.idx, s.Name, s.HaveDimmer, s.MaxDimLevel, (s.SubType=="RGB")||(s.SubType=="RGBW"));
|
accessory = new DomoticzAccessory(that.log, that, false, s.idx, s.Name, s.HaveDimmer, s.MaxDimLevel, (s.SubType=="RGB")||(s.SubType=="RGBW"));
|
||||||
foundAccessories.push(accessory);
|
foundAccessories.push(accessory);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ DomoticzPlatform.prototype = {
|
|||||||
sArray.map(function(s) {
|
sArray.map(function(s) {
|
||||||
//only accept switches for now
|
//only accept switches for now
|
||||||
if (typeof s.SwitchType != 'undefined') {
|
if (typeof s.SwitchType != 'undefined') {
|
||||||
accessory = new DomoticzAccessory(that.log, that.server, that.port, false, s.idx, s.Name, s.HaveDimmer, s.MaxDimLevel, (s.SubType=="RGB")||(s.SubType=="RGBW"));
|
accessory = new DomoticzAccessory(that.log, that, false, s.idx, s.Name, s.HaveDimmer, s.MaxDimLevel, (s.SubType=="RGB")||(s.SubType=="RGBW"));
|
||||||
foundAccessories.push(accessory);
|
foundAccessories.push(accessory);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -122,7 +122,7 @@ DomoticzPlatform.prototype = {
|
|||||||
if (json['result'] != undefined) {
|
if (json['result'] != undefined) {
|
||||||
var sArray=sortByKey(json['result'],"Name");
|
var sArray=sortByKey(json['result'],"Name");
|
||||||
sArray.map(function(s) {
|
sArray.map(function(s) {
|
||||||
accessory = new DomoticzAccessory(that.log, that.server, that.port, true, s.idx, s.Name, false, 0, false);
|
accessory = new DomoticzAccessory(that.log, that, true, s.idx, s.Name, false, 0, false);
|
||||||
foundAccessories.push(accessory);
|
foundAccessories.push(accessory);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ DomoticzPlatform.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function DomoticzAccessory(log, server, port, IsScene, idx, name, HaveDimmer, MaxDimLevel, HaveRGB) {
|
function DomoticzAccessory(log, platform, IsScene, idx, name, HaveDimmer, MaxDimLevel, HaveRGB) {
|
||||||
// device info
|
// device info
|
||||||
this.IsScene = IsScene;
|
this.IsScene = IsScene;
|
||||||
this.idx = idx;
|
this.idx = idx;
|
||||||
@@ -143,8 +143,7 @@ function DomoticzAccessory(log, server, port, IsScene, idx, name, HaveDimmer, Ma
|
|||||||
this.MaxDimLevel = MaxDimLevel;
|
this.MaxDimLevel = MaxDimLevel;
|
||||||
this.HaveRGB = HaveRGB;
|
this.HaveRGB = HaveRGB;
|
||||||
this.log = log;
|
this.log = log;
|
||||||
this.server = server;
|
this.platform = platform;
|
||||||
this.port = port;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DomoticzAccessory.prototype = {
|
DomoticzAccessory.prototype = {
|
||||||
@@ -153,13 +152,13 @@ DomoticzAccessory.prototype = {
|
|||||||
if (this.IsScene == false) {
|
if (this.IsScene == false) {
|
||||||
//Lights
|
//Lights
|
||||||
if (c == "On" || c == "Off") {
|
if (c == "On" || c == "Off") {
|
||||||
url = "http://" + this.server + ":" + this.port + "/json.htm?type=command¶m=switchlight&idx=" + this.idx + "&switchcmd=" + c + "&level=0";
|
url = this.platform.urlForQuery("type=command¶m=switchlight&idx=" + this.idx + "&switchcmd=" + c + "&level=0");
|
||||||
}
|
}
|
||||||
else if (c == "setHue") {
|
else if (c == "setHue") {
|
||||||
url = "http://" + this.server + ":" + this.port + "/json.htm?type=command¶m=setcolbrightnessvalue&idx=" + this.idx + "&hue=" + value + "&brightness=100" + "&iswhite=false";
|
url = this.platform.urlForQuery("type=command¶m=setcolbrightnessvalue&idx=" + this.idx + "&hue=" + value + "&brightness=100" + "&iswhite=false");
|
||||||
}
|
}
|
||||||
else if (c == "setLevel") {
|
else if (c == "setLevel") {
|
||||||
url = "http://" + this.server + ":" + this.port + "/json.htm?type=command¶m=switchlight&idx=" + this.idx + "&switchcmd=Set%20Level&level=" + value;
|
url = this.platform.urlForQuery("type=command¶m=switchlight&idx=" + this.idx + "&switchcmd=Set%20Level&level=" + value);
|
||||||
}
|
}
|
||||||
else if (value != undefined) {
|
else if (value != undefined) {
|
||||||
this.log(this.name + " Unhandled Light command! cmd=" + c + ", value=" + value);
|
this.log(this.name + " Unhandled Light command! cmd=" + c + ", value=" + value);
|
||||||
@@ -168,7 +167,7 @@ DomoticzAccessory.prototype = {
|
|||||||
else {
|
else {
|
||||||
//Scenes
|
//Scenes
|
||||||
if (c == "On" || c == "Off") {
|
if (c == "On" || c == "Off") {
|
||||||
url = "http://" + this.server + ":" + this.port + "/json.htm?type=command¶m=switchscene&idx=" + this.idx + "&switchcmd=" + c;
|
url = this.platform.urlForQuery("type=command¶m=switchscene&idx=" + this.idx + "&switchcmd=" + c);
|
||||||
}
|
}
|
||||||
else if (value != undefined) {
|
else if (value != undefined) {
|
||||||
this.log(this.name + " Unhandled Scene command! cmd=" + c + ", value=" + value);
|
this.log(this.name + " Unhandled Scene command! cmd=" + c + ", value=" + value);
|
||||||
|
|||||||
Reference in New Issue
Block a user