gormanb / homebridge-connector-hub

A HomeBridge plugin to expose Connector Motor Hub blinds, shades, curtains and similar devices to Homekit
Apache License 2.0
14 stars 4 forks source link

Error during Homebridge starting plugin, causes homebridge to fail. Error is "TypeError: Cannot read properties of undefined (reading 'type')" #26

Closed mxfabbri closed 10 months ago

mxfabbri commented 11 months ago

Describe The Bug: Did a standard/simple install and configuration of this plugin. Only added the App key. Restarted Homebridge after install/configution to make the plugin active. Connector-hub software throws an error processing configuration items (json config) causing homebridge to terminate. Homebridge attempts to restart, again gets the error and terminates. Rinse and repeat forever....

To Reproduce:

Use the configuration menu provided during plugin install to setup the minimal required parameters (app key). Restart Homebridge to start the plugin.

Expected behavior:

I expect that the plugin will not bring down homebridge.
Note: I could start this in a child process, but then it would fail repeatedly....

Logs: [03/12/2023, 10:31:44] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa617730008', msgID: '20231203103139547', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:44] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:44] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa617730002', msgID: '20231203103139556', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:44] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:44] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa61773000c', msgID: '20231203103139564', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:44] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:44] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa617730004', msgID: '20231203103139575', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:44] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:44] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa617730005', msgID: '20231203103139585', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:44] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:44] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa617730006', msgID: '20231203103139593', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:44] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:44] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa617730007', msgID: '20231203103139601', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:44] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:44] Got SIGTERM, shutting down Homebridge... [03/12/2023, 10:31:45] [SimpliSafe Alarm] SimpliSafe credentials refresh was successful [03/12/2023, 10:31:45] [SimpliSafe Alarm] Discovering devices from SimpliSafe [03/12/2023, 10:31:45] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa617730009', msgID: '20231203103140458', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:45] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:45] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa61773000a', msgID: '20231203103140467', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:45] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:45] [ConnectorHub] [DEBUG] Discovered device: { msgType: 'ReadDeviceAck', mac: '483fdaa61773000b', msgID: '20231203103140475', token: 'EDAC6E0F4EDC8F45', actionResult: 'AccessToken error' } [03/12/2023, 10:31:45] TypeError: Cannot read properties of undefined (reading 'type') at identifyTdbuDevices (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:132:28) at ConnectorHubPlatform.registerDevice (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/platform.ts:127:54) at Socket. (/var/lib/homebridge/node_modules/homebridge-connector-hub/src/connectorhub/connector-device-discovery.ts:53:16) at Socket.emit (node:events:517:28) at UDP.onMessage (node:dgram:942:8) [03/12/2023, 10:31:54] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null

Plugin Config:

Show your Homebridge config.json here, remove any sensitive information.

{ "connectorKey": "a3bfbcca-a7c3-4a", "invertReverseList": false, "enableDebugLog": false, "platform": "ConnectorHub" } Screenshots:

Environment:

mxfabbri commented 11 months ago

Trying integrate 3 Day Blinds hub into HomeKit.

mxfabbri commented 11 months ago

Using 3 Day Blind branded bridge: AMP Bridge PN: 62104000

gormanb commented 10 months ago

Hi @mxfabbri, thanks for raising this issue.

First, to clarify, when you say above that:

Connector-hub software throws an error processing configuration items (json config) causing homebridge to terminate. Homebridge attempts to restart, again gets the error and terminates. Note: I could start this in a child process, but then it would fail repeatedly....

Are you saying that there are two issues here - one being the "json config" error, and the other being a different failure when you start the plugin in a child bridge? Or are you saying that you were able to start Homebridge with this plugin in a child bridge, but that child bridge kept failing with the same error that was previously terminating Homebridge?

The following log lines indicate what's causing this issue:

{
msgType: 'ReadDeviceAck',
mac: '483fdaa617730008',
msgID: '20231203103139547',
token: 'EDAC6E0F4EDC8F45',
actionResult: 'AccessToken error'
}

The problem here is that the device has not actually reported its state, which should be in a data field in the ReadDeviceAck message - hence the exception you saw in the logs, "Cannot read properties of undefined." The reason is given by the actionResult field in the device's response: "AccessToken error." This is very unusual, because according to the network protocol, ReadDevice requests don't require an AccessToken. Only WriteDevice requests require this, since they are asking to make a change to the device's state.

It's possible that your particular brand of blinds doesn't follow the network spec, and requires the AccessToken to be specified even for read requests. I'll see if I can put together a beta version that attaches the access token to read requests as well as write requests to see if it fixes your problem.

gormanb commented 10 months ago

Hi @mxfabbri - I've just published 1.1.5-beta.0 which sends the access token along with read requests. Can you install that version and see whether it resolves the problem?

mxfabbri commented 10 months ago

I will install it in about two hours.Sent from my mobile deviceOn Dec 9, 2023, at 5:55 PM, Bernard Gorman @.***> wrote: Hi @mxfabbri - I've just published 1.1.5-beta.0 which sends the access token along with read requests. Can you install that version and see whether it resolves the problem?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

mxfabbri commented 10 months ago

Benard,I installed 1.1.5-beta.0.   It appeared to start correctly.   It found the bridge and 

On Saturday, December 9, 2023 at 05:55:53 PM CST, Bernard Gorman ***@***.***> wrote:  

Hi @mxfabbri - I've just published 1.1.5-beta.0 which sends the access token along with read requests. Can you install that version and see whether it resolves the problem?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mxfabbri commented 10 months ago
On Saturday, December 9, 2023 at 05:55:53 PM CST, Bernard Gorman ***@***.***> wrote:  

Hi @mxfabbri - I've just published 1.1.5-beta.0 which sends the access token along with read requests. Can you install that version and see whether it resolves the problem?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mxfabbri commented 10 months ago

Bernard,I installed 1.1.5-beta.0.  It appeared to: 1) start correctly, 2)found the AMP Bridge, and 3) found and added all of my existing blinds.    The blinds show up in the Homebridge Accessory tab.   The blinds have not yet shown up in my Home app.   Will the blinds show in the Home app?  Are they present, but not in a obvious place?  The information from the log for the start-up and accessory add is show below.  Thank you for responding so quickly!

^[[37m[09/12/2023, 16:43:14] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Launched child bridge with PID 208035

^[[37m[09/12/2023, 16:43:14] ^[[39mRegistering platform 'homebridge-connector-hub.ConnectorHub'

^[[37m[09/12/2023, 16:43:14] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Loaded homebridge-connector-hub v1.1.5-beta.0 child bridge successfully

^[[37m[09/12/2023, 16:43:15] ^[[39m^[[36m[homebridge-connector-hub]^[[39m No device IPs configured, defaulting to multicast discovery

^[[37m[09/12/2023, 16:43:15] ^[[39mHomebridge v1.7.0 (HAP v0.11.1) (homebridge-connector-hub) is running on port 33110.

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 08-483fdaa61773

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 02-483fdaa61773

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 12-483fdaa61773

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 04-483fdaa61773

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 05-483fdaa61773

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 06-483fdaa61773

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 07-483fdaa61773

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 08-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 08-483fdaa61773', 50 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 02-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 02-483fdaa61773', 50 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 12-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 12-483fdaa61773', 50 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 04-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 04-483fdaa61773', 50 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 05-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 05-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 06-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 06-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 07-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:16] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 07-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 09-483fdaa61773

^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 10-483fdaa61773

^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Adding new accessory: Roller Blinds 11-483fdaa61773

^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 09-483fdaa61773', 100 ]

^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 09-483fdaa61773', 20 ]

^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 09-483fdaa61773', 20 ]

^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 10-483fdaa61773', 0 ]

^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 10-483fdaa61773', 50 ]

^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating position: [ 'Roller Blinds 11-483fdaa61773', 0 ] ^[[37m[09/12/2023, 16:43:17] ^[[39m^[[36m[homebridge-connector-hub]^[[39m Updating battery: [ 'Roller Blinds 11-483fdaa61773', 50 ] On Saturday, December 9, 2023 at 05:55:53 PM CST, Bernard Gorman @.***> wrote:

Hi @mxfabbri - I've just published 1.1.5-beta.0 which sends the access token along with read requests. Can you install that version and see whether it resolves the problem?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

gormanb commented 10 months ago

Hi @mxfabbri - glad to hear that things are working now!

The blinds have not yet shown up in my Home app.
Will the blinds show in the Home app? Are they present, but not in a obvious place?

Yes, once the blinds are registered in Homebridge they should automatically show up in the Home app, although it may take a little time. If they don't show up within 10-15 minutes, I'd suggest closing the Home app completely and then re-opening it. The Home app will place the blinds into whatever room is set as your default room.