PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 43 forks source link

characteristic2 on fan type #88

Closed morilm closed 7 years ago

morilm commented 7 years ago

Hi

Over the last weeks I have started to suffer a hombridge crash from time to time. . Seems to be related to line 676 when try to read characteristic2.

Do we know why this is implemented this way?

Happy to support additional logs if needed

/usr/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:676 var characteristic2 = this.getService(Service.Switch).getCharacteristic(Characteristic.On); ^ TypeError: Cannot read property 'getCharacteristic' of undefined at eDomoticzAccessory.handleMQTTMessage (/usr/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:676:60)

if (this.name.indexOf("Fan") > -1) { var characteristic = this.getService(Service.Fan).getCharacteristic(Characteristic.On); callback(characteristic, message.nvalue); } else { var characteristic2 = this.getService(Service.Switch).getCharacteristic(Characteristic.On); callback(characteristic2, message.nvalue); } break;

rswilem commented 7 years ago

Thank you for noticing! I'll have a look! Seems like a problem in the code.

rswilem commented 7 years ago

This issue should be resolved now. ec09644

I have just released a new version to npm. (v.1.0.13)

morilm commented 7 years ago

Thanks!!! Working 100% fine now... no more crashes!!!! 👍 :)