Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit f239148

Browse files
committed
fixed crash in event handling (single event)
1 parent 39f27e2 commit f239148

4 files changed

Lines changed: 21 additions & 12 deletions

File tree

ChannelServices/HomeKitGenericService.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,10 @@ HomeKitGenericService.prototype = {
222222

223223
var that = this;
224224

225+
if ((channel!=undefined) && (dp!=undefined)) {
226+
225227
var tp = this.transformDatapoint(dp);
228+
226229
if (tp[1] == 'LEVEL') {
227230
newValue = newValue * 100;
228231
}
@@ -273,6 +276,7 @@ HomeKitGenericService.prototype = {
273276
this.cache(dp,newValue);
274277
}
275278
this.eventupdate = false;
279+
}
276280
},
277281

278282
mappedValue:function(dp,value) {
@@ -378,15 +382,19 @@ HomeKitGenericService.prototype = {
378382

379383

380384
transformDatapoint : function(dp) {
381-
var pos = dp.indexOf(":");
382-
if (pos==-1) {
383-
return [this.adress,dp];
385+
if (dp) {
386+
var pos = dp.indexOf(":");
387+
if (pos==-1) {
388+
return [this.adress,dp];
389+
}
390+
var ndp = dp.substr(pos+1,dp.length);
391+
var nadr = this.adress.substr(0,this.adress.indexOf(":"));
392+
var chnl = dp.substr(0,pos);
393+
nadr = nadr + ":" + chnl;
394+
return [nadr,ndp];
395+
} else {
396+
return -1;
384397
}
385-
var ndp = dp.substr(pos+1,dp.length);
386-
var nadr = this.adress.substr(0,this.adress.indexOf(":"));
387-
var chnl = dp.substr(0,pos);
388-
nadr = nadr + ":" + chnl;
389-
return [nadr,ndp];
390398
},
391399

392400
getServices: function() {

HomeMaticRPC.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ HomeMaticRPC.prototype.init = function() {
102102

103103
that.platform.foundAccessories.map(function(accessory) {
104104
if ((accessory.adress == channel) || ((accessory.cadress != undefined) && (accessory.cadress == channel))) {
105-
accessory.event(datapoint, value);
105+
accessory.event(channel, datapoint, value);
106106
}
107107
});
108108
callback(null,[]);
@@ -129,9 +129,7 @@ HomeMaticRPC.prototype.init = function() {
129129
if ((accessory.adress == channel) || 
130130
((accessory.cadress != undefined) && (accessory.cadress == channel)) || 
131131
((accessory.deviceAdress != undefined) && (accessory.deviceAdress == deviceAdress))) {
132-
133132
accessory.event(channel,datapoint, value);
134-
135133
}
136134

137135
});

changelog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Changelog
33

44
**** BEGINNING OF VERSION 0.0.41 the selection of channels to use with HomeKit via a CCU Subsection is mandatory
55

6+
Version 0.0.62
7+
fixed Crash in Device Event Handling
8+
69
Version 0.0.61
710
fixed Crash in RPC
811

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "homebridge-homematic",
3-
"version": "0.0.61",
3+
"version": "0.0.62",
44
"description": "Homematic plugin for homebridge: https://github.com/nfarina/homebridge",
55
"license": "ISC",
66
"keywords": [

0 commit comments

Comments
 (0)