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