renssies / homebridge-am43-blinds

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

Was working perfect but now I am getting the following error #8

Closed drosenberg-gh closed 3 years ago

drosenberg-gh commented 4 years ago

(node:1779) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'fe51' of undefined at Gatt.write (/usr/lib/node_modules/homebridge-am43-blinds/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:549:60) at NobleBindings.write (/usr/lib/node_modules/homebridge-am43-blinds/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:399:10) at Noble.write (/usr/lib/node_modules/homebridge-am43-blinds/node_modules/@abandonware/noble/lib/noble.js:421:18) at Characteristic.write (/usr/lib/node_modules/homebridge-am43-blinds/node_modules/@abandonware/noble/lib/characteristic.js:75:15) at internal/util.js:297:30 at new Promise () at Characteristic.write [as writeAsync] (internal/util.js:296:12) at AM43Device.sendCommandAsync (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Device.js:325:44) at AM43Device.updatePositionAsync (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Device.js:281:16) at Characteristic. (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Platform.js:461:32) (node:1779) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

torroa commented 4 years ago

I got similar issue if the device i had used to set up the AM43 motor with is close to the motor and bluetooth enabled. Try switching off bluetooth on the phone or tabled you used to set the limits and see if the problems goes away.

The issue I have now is that I have to relocate the Pi 4 - and the bluetooth range isn't great :P

renssies commented 4 years ago

You can also close (as in Swipe up) the blinds engine app on all devices to disconnect it and make it available to the plugin.

@torroa I've heard that disabling WiFi (if you aren't using it) can help increase the Bluetooth range. Otherwise, you can use an external Bluetooth 4.0 adapter that is known to work on Debian and disable the built-in Bluetooth of the Raspberry Pi.

Genestro commented 4 years ago

I also have the same error, but i am not home so the phone i used in the setup is not near the motor. When i restart Homebridge i can control the blinds again. Any idea how to fix this?

renssies commented 4 years ago

If you are using a Raspberry Pi you might want to check if there is a new version of the bluez-firmware. You can check this using sudo apt update.

Genestro commented 4 years ago

There was a new version of bluez-firmware ready to be installed on my PI. Let's see of it fixed the problem. Thanks for the help!

Genestro commented 4 years ago

[9/10/2020, 4:07:15 PM] [am43-blinds] Started scanning for AM43 blinds, stopping in 5 seconds [9/10/2020, 4:07:15 PM] [am43-blinds] Error: Could not start scanning, state is unknown (not poweredOn) at Noble.scan (/usr/lib/node_modules/homebridge-am43-blinds/node_modules/@abandonware/noble/lib/noble.js:107:21) at Noble.startScanning (/usr/lib/node_modules/homebridge-am43-blinds/node_modules/@abandonware/noble/lib/noble.js:136:10) at AM43Platform.startScanningForDevices (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Platform.js:171:11) at PlatformAccessory.accessory.scanForMissingDevices (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Platform.js:269:12) at Characteristic. (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Platform.js:449:21) at Characteristic.emit (events.js:314:20) at Characteristic.EventEmitter.emit (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/EventEmitter.js:60:38) at Characteristic._this.getValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:203:23) at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:768:32 at Array.forEach (:null:null) at Bridge.Accessory._this._handleGetCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:709:18) at HAPServer.emit (events.js:314:20) at HAPServer.EventEmitter.emit (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/EventEmitter.js:60:38) at HAPServer._this._handleCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/HAPServer.js:677:23) at IncomingMessage. (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/HAPServer.js:240:39) at IncomingMessage.emit (events.js:314:20) at endReadableNT (_stream_readable.js:1308:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)

Now i got a new error message in my logs i updated all my apps

Genestro commented 4 years ago

Fixed it by setting the Bluetooth permissions again

Genestro commented 4 years ago

I got the same (node:1779) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'fe51' of undefined error again. Even after updating everything. Any idea how to fix it?

renssies commented 4 years ago

Ok I dug a bit deeper and I might have found the issue, I wasn't nullifying some stuff that I should have been doing.

Please (re)install the plugin and I hope it will be fixed. (Just performing the npm install command from the Readme is enough)

drosenberg-gh commented 4 years ago

Working perfect, thanks. This is a great plugin.

helioyanagita commented 4 years ago

I have updated to the latest plugin and now I don't see the fe51 error any longer, however, I am coming across the following one now... Anyone experiencing the same and any thoughts?

[9/20/2020, 12:52:58 PM] [am43-blinds] Stopped searching for AM43 Blinds, found 1 devices (node:2328) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'writeAsync' of null at AM43Device.sendCommandAsync (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Device.js:325:44) at AM43Device.updateBatteryStatusAsync (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Device.js:287:16) at Characteristic. (/usr/lib/node_modules/homebridge-am43-blinds/lib/AM43Platform.js:421:30) at Characteristic.emit (events.js:315:20) at Characteristic.EventEmitter.emit (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22) at Characteristic._this.getValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:489:12) at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1239:22 at Array.forEach () at Bridge.Accessory._this._handleGetCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1167: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) at IncomingMessage. (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/HAPServer.ts:280:24) at IncomingMessage.emit (events.js:315:20) at endReadableNT (_stream_readable.js:1220:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) (node:2328) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:2328) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

dariusrosendahl commented 3 years ago

@drosenberg-gh Is it also doing this when the blinds motor is next to the Pi? For me the problem is apparently range. See #16

gielk commented 3 years ago

i got this comment

(node:26224) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'writeAsync' of undefined at AM43Device.sendCommandAsync (/usr/local/lib/node_modules/homebridge-am43-blinds/lib/AM43Device.js:343:44) at AM43Device.updatePositionAsync (/usr/local/lib/node_modules/homebridge-am43-blinds/lib/AM43Device.js:299:16) at Characteristic. (/usr/local/lib/node_modules/homebridge-am43-blinds/lib/AM43Platform.js:461:32) at Characteristic.emit (events.js:198:13) at Characteristic.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22) at Characteristic._this.getValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:489:12) at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1217:22 at Array.forEach () at Bridge.Accessory._this._handleGetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1145:10) at HAPServer.emit (events.js:198:13) at HAPServer.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22) at HAPServer._this._handleCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/HAPServer.ts:756:12) at IncomingMessage. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/HAPServer.ts:280:24) at IncomingMessage.emit (events.js:198:13) at endReadableNT (_stream_readable.js:1143:12) at process._tickCallback (internal/process/next_tick.js:63:19)

renssies commented 3 years ago

Since this issue seems to happen for more people I've created a new issue with some more information to help me find the root of this issue: https://github.com/renssies/homebridge-am43-blinds/issues/21.

I will be closing this issue because of that.