henry-spanka / homebridge-freeathome

Platform Plugin to manage free@home accessories via HomeBridge
MIT License
56 stars 10 forks source link

Plugin crashes after random time (Unexpected error while processing stanza event) #36

Closed Robin-Se closed 3 years ago

Robin-Se commented 4 years ago

I'm new to this plugin. First of all: It's really cool. I have never expected to find a free@home plugin. I love it. But: After a random time the log notifies a "unknown protocol version". Thereafter it quits with an unexpected error: _[11/5/2020, 11:21:13 AM] [GHS9] Unknown Protocol Version detected. Ignoring ... [11/5/2020, 11:21:13 AM] [GHS9] Unexpected error while processing stanza event [11/5/2020, 11:21:13 AM] [GHS9] Error: Insufficient data for reading at MessageReader.readString (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/MessageReader.js:47:19) at SystemAccessPoint. (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:250:36) at Generator.next () at /usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:8:71 at new Promise () at __awaiter (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:4:12) at SystemAccessPoint.handleNewSessionResult (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:241:16) at SystemAccessPoint. (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:224:32) at Generator.next () at /usr/local/lib/node_modules/homebridge-freeathome/nodemodules/freeathome-api/dist/lib/SystemAccessPoint.js:8:71 [11/5/2020, 11:21:13 AM] [GHS9] Insufficient data for reading

henry-spanka commented 4 years ago

Which version do you run? Please disable logging (Monitor) in the web interface of the SysAp if it is enabled.

Robin-Se commented 4 years ago

Hi Henry

The SysAP runs on firmware 2.5.5. Homebrige runs on version v4.32.0 (on Mac OS Catalina 10.15). Your plugin is v2.0.3

Viele Grüsse Robin

Am Sa., 14. Nov. 2020 um 17:44 Uhr schrieb Henry Spanka < notifications@github.com>:

Which version do you run? Please disable logging (Monitor) in the web interface of the SysAp if it is enabled.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/henry-spanka/homebridge-freeathome/issues/36#issuecomment-727233217, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARUWHNV5Y6GNYOUS6VL2IT3SP2XXNANCNFSM4TLVQQBA .

henry-spanka commented 4 years ago

Please modify the file and add the following line (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js)

...
if (version !== constants_1.General.PROTOCOL_VERSION) {
    this.logger.log("Unknown Protocol Version detected. Ignoring ...");
    return;
}
...

Should be approx. line 249.

Robin-Se commented 4 years ago

Thank you for the support! I added the return statement at the given position (new line is line 249). I curious and hope this solves the problem.

I'll keep you up-to-date.

Am Sa., 14. Nov. 2020 um 17:56 Uhr schrieb Henry Spanka < notifications@github.com>:

Please modify the file and add the following line ( /usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js )

...if (version !== constants_1.General.PROTOCOL_VERSION) { this.logger.log("Unknown Protocol Version detected. Ignoring ..."); return;} ...

Should be approx. line 249.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/henry-spanka/homebridge-freeathome/issues/36#issuecomment-727234871, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARUWHNQWLOX62ZGLH6VVHVLSP2ZD5ANCNFSM4TLVQQBA .

Robin-Se commented 4 years ago

Unfornuately the problem is still there. It worked for approx 30 minutes. Here the latest log: [11/15/2020, 10:13:07 AM] [GHS9] Updating accessory Raumtemperaturregler Schlafzimmer with uuid ABB700C9B6E6ch0000 (node:63089) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null at /usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/connection/index.js:311:19 at new Promise (<anonymous>) at Client.write (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/connection/index.js:302:12) at Client.send (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/connection/index.js:290:16) at Client.send (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/client-core/lib/Client.js:19:18) at GuardedClient.send (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/GuardedClient.js:44:28) at SystemAccessPoint.<anonymous> (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:329:31) at Generator.next (<anonymous>) at /usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:8:71 at new Promise (<anonymous>) (Usenode --trace-warnings ...to show where the warning was created) (node:63089) 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:63089) [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. [11/15/2020, 10:32:53 AM] [GHS9] Connected as dc37af36-78ad-43de-b042-af8cba3397ed@busch-jaeger.de/freeathome-api [11/15/2020, 10:32:53 AM] [GHS9] Sent Authenticator [11/15/2020, 10:32:53 AM] [GHS9] Unknown Protocol Version detected. Ignoring ... (node:63089) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null at /usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/connection/index.js:311:19 at new Promise (<anonymous>) at Client.write (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/connection/index.js:302:12) at Client.send (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/connection/index.js:290:16) at Client.send (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/client-core/lib/Client.js:19:18) at GuardedClient.send (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/GuardedClient.js:44:28) at SystemAccessPoint.<anonymous> (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:329:31) at Generator.next (<anonymous>) at /usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:8:71 at new Promise (<anonymous>) (node:63089) 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: 4) [11/15/2020, 11:39:21 AM] [GHS9] Connected as dc37af36-78ad-43de-b042-af8cba3397ed@busch-jaeger.de/freeathome-api [11/15/2020, 11:39:21 AM] [GHS9] Sent Authenticator [11/15/2020, 11:39:21 AM] [GHS9] Unknown Protocol Version detected. Ignoring ... (node:63089) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null at /usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/connection/index.js:311:19 at new Promise (<anonymous>) at Client.write (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/connection/index.js:302:12) at Client.send (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/connection/index.js:290:16) at Client.send (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/@xmpp/client-core/lib/Client.js:19:18) at GuardedClient.send (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/GuardedClient.js:44:28) at SystemAccessPoint.<anonymous> (/usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:329:31) at Generator.next (<anonymous>) at /usr/local/lib/node_modules/homebridge-freeathome/node_modules/freeathome-api/dist/lib/SystemAccessPoint.js:8:71 at new Promise (<anonymous>) (node:63089) 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: 6) [11/15/2020, 2:50:55 PM] [GHS9] Connected as dc37af36-78ad-43de-b042-af8cba3397ed@busch-jaeger.de/freeathome-api [11/15/2020, 2:50:55 PM] [GHS9] Sent Authenticator [11/15/2020, 2:50:55 PM] [GHS9] Unknown Protocol Version detected. Ignoring ...

henry-spanka commented 4 years ago

Hmm, not really sure what the issue is. Make sure that you have a stable ethernet connection to the SysAp. Might have something to do with macOS. You might want to run it on linux instead, for example hoobs.

Robin-Se commented 4 years ago

Hmm, an ethernet wireing is not possible as there is no possibility to get a cable into the wall, where the SysAP was installed by the former owner. So all I have is an WLAN connection to the MESH network...

Robin-Se commented 4 years ago

Hmm, it seems as it's caused by interruptions of the WLAN connection. The protocol looks fine until I try to change a state via Apple Home. For me it looks like the plugin is no longer logged it to the SysAP. Is there a chance to logout / login in again after the connection was lost? It seem only to happen if the SysAP is only connected via WLAN. Or is there a chance to define somewhere the idle-time or do some random action like getting the actual state of devices?. Here's the latest log FYI: [11/23/2020, 5:45:38 AM] [GHS9] Error: connect ENETUNREACH 192.168.188.14:5280 - Local (0.0.0.0:64700) [11/23/2020, 5:45:38 AM] [GHS9] connect ENETUNREACH 192.168.188.14:5280 - Local (0.0.0.0:64700) [11/23/2020, 5:45:40 AM] [GHS9] Connected as dc37af36-78ad-43de-b042-af8cba3397ed@busch-jaeger.de/freeathome-api [11/23/2020, 5:45:40 AM] [GHS9] Sent Authenticator [11/23/2020, 5:45:40 AM] [GHS9] Unknown Protocol Version detected. Ignoring ... [11/23/2020, 7:27:13 AM] [GHS9] Connected as dc37af36-78ad-43de-b042-af8cba3397ed@busch-jaeger.de/freeathome-api [11/23/2020, 7:27:13 AM] [GHS9] Sent Authenticator [11/23/2020, 7:27:13 AM] [GHS9] Unknown Protocol Version detected. Ignoring ... [11/23/2020, 8:29:04 AM] [GHS9] Connected as dc37af36-78ad-43de-b042-af8cba3397ed@busch-jaeger.de/freeathome-api [11/23/2020, 8:29:04 AM] [GHS9] Sent Authenticator [11/23/2020, 8:29:04 AM] [GHS9] Unknown Protocol Version detected. Ignoring ... [11/23/2020, 8:53:25 AM] [GHS9] Set Datapoint: ABB23F041F51/ch000C/idp0000/0 [11/23/2020, 8:53:30 AM] [GHS9] SysAp did not respond in time: 000C/odp0000/0 [11/23/2020, 8:53:30 AM] [GHS9] If this issue persists please try to login as the API user in the free@home UI. The SysAp might disable websocket notifications if the connection is idle for too long.

henry-spanka commented 4 years ago

I am not sure there is. But BJ now has their own API. I will try to switch to the native API in the future. It should hopefully be more stable. See #40

Robin-Se commented 3 years ago

Seems as I found the solution. The MacBook looses the network connection (WLAN) after a certain time. If the energy-saving options are disabled, no disconnections occur.

Robin-Se commented 3 years ago

I mooved everything from tha MacBook to HOOBS on a Raspberry PI and I'm preety happy now.