mirror of
https://github.com/mtan93/homebridge.git
synced 2026-05-20 14:18:51 +01:00
cleanup formatting
This commit is contained in:
+17
-13
@@ -70,8 +70,7 @@ RegaRequest.prototype = {
|
||||
if (data != undefined) {
|
||||
callback(parseFloat(data));
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
setValue: function(channel, datapoint, value) {
|
||||
@@ -79,8 +78,7 @@ RegaRequest.prototype = {
|
||||
|
||||
var script = "var d = dom.GetObject(\"" + channel + "." + datapoint + "\");if (d){d.State(\"" + value + "\");}";
|
||||
//that.log("Rega Request " + script);
|
||||
var regarequest = this.script(script, function(data) {
|
||||
});
|
||||
var regarequest = this.script(script, function(data) {});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -110,7 +108,10 @@ HomematicRPC.prototype= {
|
||||
this.localIP = ip;
|
||||
this.log("Local IP: " + this.localIP)
|
||||
|
||||
this.server = xmlrpc.createServer({ host: this.localIP , port: 9090 })
|
||||
this.server = xmlrpc.createServer({
|
||||
host: this.localIP,
|
||||
port: 9090
|
||||
})
|
||||
|
||||
this.server.on('NotFound', function(method, params) {
|
||||
that.log('Method ' + method + ' does not exist');
|
||||
@@ -213,7 +214,11 @@ HomematicRPC.prototype= {
|
||||
connect: function() {
|
||||
var that = this;
|
||||
this.log('Creating Local HTTP Client for CCU RPC Events');
|
||||
this.client = xmlrpc.createClient({ host: this.ccuip, port: 2001, path: '/'});
|
||||
this.client = xmlrpc.createClient({
|
||||
host: this.ccuip,
|
||||
port: 2001,
|
||||
path: '/'
|
||||
});
|
||||
this.log('CCU RPC Init Call on port 2001');
|
||||
this.client.methodCall('init', ['http://' + this.localIP + ':9090', 'homebridge'], function(error, value) {
|
||||
that.log('CCU Response ....')
|
||||
@@ -286,10 +291,7 @@ HomeMaticPlatform.prototype = {
|
||||
// that.log('name', ch.name, ' -> address:', ch.address);
|
||||
if ((ch.address != undefined) && (!isChannelFiltered)) {
|
||||
|
||||
if ((ch.type=="SWITCH") || (ch.type=="BLIND") || (ch.type=="SHUTTER_CONTACT")
|
||||
|| (ch.type=="DIMMER") || (ch.type=="CLIMATECONTROL_RT_TRANSCEIVER")
|
||||
|| (ch.type=="MOTION_DETECTOR") || (ch.type=="KEYMATIC")
|
||||
) {
|
||||
if ((ch.type == "SWITCH") || (ch.type == "BLIND") || (ch.type == "SHUTTER_CONTACT") || (ch.type == "DIMMER") || (ch.type == "CLIMATECONTROL_RT_TRANSCEIVER") || (ch.type == "MOTION_DETECTOR") || (ch.type == "KEYMATIC")) {
|
||||
// Switch found
|
||||
// Check if marked as Outlet
|
||||
var special = (that.outlets.indexOf(ch.address) > -1) ? 'OUTLET' : undefined;
|
||||
@@ -369,8 +371,7 @@ HomeMaticPlatform.prototype = {
|
||||
});
|
||||
this.sendQueue = [];
|
||||
//this.log("RegaSend: " + script);
|
||||
var regarequest = new RegaRequest(this.log,this.ccuIP).script(script, function(data) {
|
||||
});
|
||||
var regarequest = new RegaRequest(this.log, this.ccuIP).script(script, function(data) {});
|
||||
},
|
||||
|
||||
sendRequest: function(accessory, script, callback) {
|
||||
@@ -396,7 +397,10 @@ HomeMaticPlatform.prototype = {
|
||||
}
|
||||
|
||||
var that = this;
|
||||
this.delayed[delay] = setTimeout( function(){clearTimeout(that.delayed[delay]);that.sendPreparedRequests()}, delay?delay:100);
|
||||
this.delayed[delay] = setTimeout(function() {
|
||||
clearTimeout(that.delayed[delay]);
|
||||
that.sendPreparedRequests()
|
||||
}, delay ? delay : 100);
|
||||
this.log("New Timer was set");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ function HomeMaticGenericChannel(log,platform, id ,name, type ,adress,special) {
|
||||
|
||||
|
||||
|
||||
|
||||
HomeMaticGenericChannel.prototype = {
|
||||
|
||||
|
||||
@@ -101,7 +100,10 @@ HomeMaticGenericChannel.prototype = {
|
||||
|
||||
this.log(this.name + " delaying command " + mode + " " + dp + " with value " + value);
|
||||
var that = this;
|
||||
this.delayed[delay] = setTimeout( function(){clearTimeout(that.delayed[delay]);that.command(mode,dp,value)}, delay?delay:100 );
|
||||
this.delayed[delay] = setTimeout(function() {
|
||||
clearTimeout(that.delayed[delay]);
|
||||
that.command(mode, dp, value)
|
||||
}, delay ? delay : 100);
|
||||
},
|
||||
|
||||
command: function(mode, dp, value, callback) {
|
||||
@@ -118,8 +120,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
},
|
||||
|
||||
informationCharacteristics: function() {
|
||||
return [
|
||||
{
|
||||
return [{
|
||||
cType: types.NAME_CTYPE,
|
||||
onUpdate: null,
|
||||
perms: ["pr"],
|
||||
@@ -169,8 +170,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
supportBonjour: false,
|
||||
manfDescription: "Identify Accessory",
|
||||
designedMaxLength: 1
|
||||
}
|
||||
]
|
||||
}]
|
||||
},
|
||||
|
||||
controlCharacteristics: function(that) {
|
||||
@@ -234,8 +234,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
|
||||
|
||||
if (this.type == "KEYMATIC") {
|
||||
cTypes.push(
|
||||
{
|
||||
cTypes.push({
|
||||
cType: types.CURRENT_LOCK_MECHANISM_STATE_CTYPE,
|
||||
|
||||
onRead: function(callback) {
|
||||
@@ -255,8 +254,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
supportBonjour: false,
|
||||
manfDescription: "Current State of your Lock",
|
||||
designedMaxLength: 1
|
||||
},
|
||||
{
|
||||
}, {
|
||||
cType: types.TARGET_LOCK_MECHANISM_STATE_CTYPE,
|
||||
|
||||
onUpdate: function(value) {
|
||||
@@ -284,8 +282,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
designedMaxLength: 1
|
||||
}
|
||||
|
||||
,
|
||||
{
|
||||
, {
|
||||
cType: types.TARGET_DOORSTATE_CTYPE,
|
||||
|
||||
onUpdate: function(value) {
|
||||
@@ -340,8 +337,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
supportBonjour: false,
|
||||
manfDescription: "Change the power state",
|
||||
designedMaxLength: 1
|
||||
},
|
||||
{
|
||||
}, {
|
||||
cType: types.BRIGHTNESS_CTYPE,
|
||||
onUpdate: function(value) {
|
||||
that.delayed("set", "LEVEL", String(value / 100), 100);
|
||||
@@ -372,8 +368,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
}
|
||||
|
||||
if (this.type == "BLIND") {
|
||||
cTypes.push(
|
||||
{
|
||||
cTypes.push({
|
||||
cType: types.WINDOW_COVERING_CURRENT_POSITION_CTYPE,
|
||||
|
||||
onRead: function(callback) {
|
||||
@@ -426,8 +421,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
designedMaxValue: 100,
|
||||
designedMinStep: 1,
|
||||
unit: "%"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
cType: types.WINDOW_COVERING_OPERATION_STATE_CTYPE,
|
||||
|
||||
onRead: function(callback) {
|
||||
@@ -455,8 +449,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
}
|
||||
|
||||
if (this.type == "SHUTTER_CONTACT") {
|
||||
cTypes.push(
|
||||
{
|
||||
cTypes.push({
|
||||
cType: types.CONTACT_SENSOR_STATE_CTYPE,
|
||||
|
||||
onRead: function(callback) {
|
||||
@@ -479,8 +472,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
}
|
||||
|
||||
if (this.type == "MOTION_DETECTOR") {
|
||||
cTypes.push(
|
||||
{
|
||||
cTypes.push({
|
||||
cType: types.MOTION_DETECTED_CTYPE,
|
||||
|
||||
onRead: function(callback) {
|
||||
@@ -505,20 +497,44 @@ HomeMaticGenericChannel.prototype = {
|
||||
if (this.type == "CLIMATECONTROL_RT_TRANSCEIVER") {
|
||||
|
||||
cTypes.push({
|
||||
cType: types.NAME_CTYPE,onUpdate: null,perms: ["pr"],format: "string",
|
||||
initialValue: this.name,supportEvents: true,supportBonjour: false,manfDescription: "Name of service",designedMaxLength: 255
|
||||
cType: types.NAME_CTYPE,
|
||||
onUpdate: null,
|
||||
perms: ["pr"],
|
||||
format: "string",
|
||||
initialValue: this.name,
|
||||
supportEvents: true,
|
||||
supportBonjour: false,
|
||||
manfDescription: "Name of service",
|
||||
designedMaxLength: 255
|
||||
},
|
||||
|
||||
{
|
||||
cType: types.CURRENTHEATINGCOOLING_CTYPE,onUpdate: null,
|
||||
perms: ["pr"],format: "int",initialValue: 1,supportEvents: false,
|
||||
supportBonjour: false,manfDescription: "Current Mode",designedMaxLength: 1,designedMinValue: 1,designedMaxValue: 1,designedMinStep: 1
|
||||
cType: types.CURRENTHEATINGCOOLING_CTYPE,
|
||||
onUpdate: null,
|
||||
perms: ["pr"],
|
||||
format: "int",
|
||||
initialValue: 1,
|
||||
supportEvents: false,
|
||||
supportBonjour: false,
|
||||
manfDescription: "Current Mode",
|
||||
designedMaxLength: 1,
|
||||
designedMinValue: 1,
|
||||
designedMaxValue: 1,
|
||||
designedMinStep: 1
|
||||
},
|
||||
|
||||
{
|
||||
cType: types.TARGETHEATINGCOOLING_CTYPE,onUpdate: null,perms: ["pw","pr"],
|
||||
format: "int",initialValue: 1,supportEvents: false,supportBonjour: false,manfDescription: "Target Mode",
|
||||
designedMinValue: 1,designedMaxValue: 1,designedMinStep: 1
|
||||
cType: types.TARGETHEATINGCOOLING_CTYPE,
|
||||
onUpdate: null,
|
||||
perms: ["pw", "pr"],
|
||||
format: "int",
|
||||
initialValue: 1,
|
||||
supportEvents: false,
|
||||
supportBonjour: false,
|
||||
manfDescription: "Target Mode",
|
||||
designedMinValue: 1,
|
||||
designedMaxValue: 1,
|
||||
designedMinStep: 1
|
||||
},
|
||||
|
||||
{
|
||||
@@ -534,9 +550,14 @@ HomeMaticGenericChannel.prototype = {
|
||||
characteristic.eventEnabled = true;
|
||||
that.remoteGetValue("ACTUAL_TEMPERATURE");
|
||||
},
|
||||
perms: ["pw","pr","ev"], perms: ["pr"],format: "double",
|
||||
perms: ["pw", "pr", "ev"],
|
||||
perms: ["pr"],
|
||||
format: "double",
|
||||
initialValue: that.dpvalue("ACTUAL_TEMPERATURE", 20),
|
||||
supportEvents: false,supportBonjour: false,manfDescription: "Current Temperature",unit: "celsius"
|
||||
supportEvents: false,
|
||||
supportBonjour: false,
|
||||
manfDescription: "Current Temperature",
|
||||
unit: "celsius"
|
||||
},
|
||||
|
||||
{
|
||||
@@ -553,16 +574,28 @@ HomeMaticGenericChannel.prototype = {
|
||||
characteristic.eventEnabled = true;
|
||||
that.remoteGetValue("SET_TEMPERATURE");
|
||||
},
|
||||
perms: ["pw","pr","ev"],format: "double",
|
||||
perms: ["pw", "pr", "ev"],
|
||||
format: "double",
|
||||
initialValue: that.dpvalue("SET_TEMPERATURE", 16),
|
||||
supportEvents: false,supportBonjour: false, manfDescription: "Target Temperature",
|
||||
designedMinValue: 16,designedMaxValue: 38,designedMinStep: 1,unit: "celsius"
|
||||
supportEvents: false,
|
||||
supportBonjour: false,
|
||||
manfDescription: "Target Temperature",
|
||||
designedMinValue: 16,
|
||||
designedMaxValue: 38,
|
||||
designedMinStep: 1,
|
||||
unit: "celsius"
|
||||
},
|
||||
|
||||
{
|
||||
cType: types.TEMPERATURE_UNITS_CTYPE,onRead: null,
|
||||
perms: ["pr"],format: "int",initialValue: 0,supportEvents: false,
|
||||
supportBonjour: false,manfDescription: "Current Temperature Unit",unit: "celsius"
|
||||
cType: types.TEMPERATURE_UNITS_CTYPE,
|
||||
onRead: null,
|
||||
perms: ["pr"],
|
||||
format: "int",
|
||||
initialValue: 0,
|
||||
supportEvents: false,
|
||||
supportBonjour: false,
|
||||
manfDescription: "Current Temperature Unit",
|
||||
unit: "celsius"
|
||||
}
|
||||
|
||||
);
|
||||
@@ -617,8 +650,7 @@ HomeMaticGenericChannel.prototype = {
|
||||
var services = [{
|
||||
sType: types.ACCESSORY_INFORMATION_STYPE,
|
||||
characteristics: this.informationCharacteristics(),
|
||||
},
|
||||
{
|
||||
}, {
|
||||
sType: this.sType(),
|
||||
characteristics: this.controlCharacteristics(that)
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user