renssies / homebridge-am43-blinds

A homebridge plugin to control the AM43 based blind motors in HomeKit
MIT License
18 stars 6 forks source link

Homebridge shuts down #4

Closed torroa closed 4 years ago

torroa commented 4 years ago

I am able to control the AM43 motor but the plugin generate an error and restart the Homebridge server.

This happens every 2-15 minutes. Could it be because the Pi looses connection with the AM43 motor and tries to reconnect? I have included "hap_interaction_timeout": "0", in the config file.

[8/3/2020, 13:27:59] ReferenceError: direction is not defined at PlatformAccessory. (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Platform.js:408:58) at PositionState.emit (events.js:315:20) at PositionState.EventEmitter.emit (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22) at PositionState.Characteristic._this.getValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:488:12) at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1215:22 at Array.forEach () at Bridge.Accessory._this._handleGetCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1143:10) at HAPServer.emit (events.js:315:20) at HAPServer.EventEmitter.emit (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22) at HAPServer._this._handleCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/HAPServer.ts:756:12) [8/3/2020, 13:27:59] Got SIGTERM, shutting down Homebridge... Error: read ECONNRESET

neil-morrison44 commented 4 years ago

https://github.com/renssies/homebridge-am43-blinds/blob/main/lib/AM43Platform.js#L408

Looks like this line should probably change from

this.log.debug("Reporting direction: " + direction)

to

this.log.debug("Reporting direction: " + this.am43device.direction)

You can go into /usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Platform.js & apply that change locally to double check

torroa commented 4 years ago

https://github.com/renssies/homebridge-am43-blinds/blob/main/lib/AM43Platform.js#L408

Looks like this line should probably change from

this.log.debug("Reporting direction: " + direction)

to

this.log.debug("Reporting direction: " + this.am43device.direction)

You can go into /usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Platform.js & apply that change locally to double check

Perfect, the fix dit the trick. Everything seems to be working, including reporting the status.

Except for the npm server that seems to be offline: [homebridge-am43-blinds] Failed to check registry.npmjs.org for updates: Request failed with status code 404

renssies commented 4 years ago

Hmm, I personally didn't run into this issue, but I will apply it to the code. Thanks for the find @neil-morrison44

neil-morrison44 commented 4 years ago

Yeah, I haven't run into it personally either - might be a newer version of node being more strict or something

renssies commented 4 years ago

I've added this suggestion to the code, hopefully it is fixed for everyone now!