Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Cannot read property 'id' of undefined" in SoundTouchPlatform.HomebridgePlatform.accessoryFromDevice #9

Closed
sebro83 opened this issue Jun 16, 2019 · 12 comments

Comments

@sebro83
Copy link

sebro83 commented Jun 16, 2019

I'm running a Soundtouch 10 and 20 with the following config:

   {
    "platform": "SoundTouchPlatform",
    "name": "SoundTouch",
    "discoverAllAccessories": true,
    "global": {
        "verbose": true,
        "sources": [
            {
                "source": "QPLAY",
                "enabled": false
            }
        ]
    }
  }

Even a more specific config, defining name, IP etc. results in the same error in the log and the devices not being available via homebridge:

Jun 16 15:36:29 homebridge homebridge[9496]: [2019-6-16 15:36:29] [SoundTouch] Initializing SoundTouchPlatform platform...

Jun 16 15:36:29 homebridge homebridge[9496]: [2019-6-16 15:36:29] [SoundTouch] Searching accessories...
...
Jun 16 15:36:30 homebridge homebridge[9496]: [2019-6-16 15:36:30] Homebridge is running on port 51826.
Jun 16 15:36:34 homebridge homebridge[9496]: [2019-6-16 15:36:34] [SoundTouch] [Kitchen] Found device
Jun 16 15:36:34 homebridge homebridge[9496]: [2019-6-16 15:36:34] [SoundTouch] [Badlautsprecher] Found device
Jun 16 15:36:34 homebridge homebridge[9496]: [2019-6-16 15:36:34] [SoundTouch] [Kitchen] Found preset n°1 '...' on device
...
Jun 16 15:36:34 homebridge homebridge[9496]: [2019-6-16 15:36:34] [SoundTouch] [Kitchen] Found preset n°6 '...' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Badlautsprecher] Found preset n°1 '...' on device
...
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Badlautsprecher] Found preset n°6 '...' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Badlautsprecher] Found local source 'AUX' with account 'AUX' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Badlautsprecher] Found local source 'QPLAY' with account 'QPlay1UserName' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Badlautsprecher] Found local source 'QPLAY' with account 'QPlay2UserName' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Badlautsprecher] Found local source 'BLUETOOTH' with account '' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Kitchen] Found local source 'AUX' with account 'AUX' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Kitchen] Found local source 'BLUETOOTH' with account '' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Kitchen] Found local source 'QPLAY' with account 'QPlay1UserName' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] [Kitchen] Found local source 'QPLAY' with account 'QPlay2UserName' on device
Jun 16 15:36:35 homebridge homebridge[9496]: [2019-6-16 15:36:35] [SoundTouch] TypeError: Cannot read property 'id' of undefined
Jun 16 15:36:35 homebridge homebridge[9496]: at SoundTouchPlatform.HomebridgePlatform.accessoryFromDevice (/usr/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:108:
Jun 16 15:36:35 homebridge homebridge[9496]: at /usr/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:97:84
Jun 16 15:36:35 homebridge homebridge[9496]: at Array.map ()
Jun 16 15:36:35 homebridge homebridge[9496]: at SoundTouchPlatform. (/usr/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:97:47)
Jun 16 15:36:35 homebridge homebridge[9496]: at step (/usr/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:45:23)
Jun 16 15:36:35 homebridge homebridge[9496]: at Object.next (/usr/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:26:53)
Jun 16 15:36:35 homebridge homebridge[9496]: at fulfilled (/usr/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:17:58)

Do you have an idea how to resolve that issue?

@gerritfries
Copy link

Same problem for me with Soundtouch 20

@paewrblue
Copy link

paewrblue commented Jun 17, 2019

I'm having the same issue. Even thought, I try to stick to simple setup;

{
"platform": "SoundTouchPlatform",
"name": "SoundTouch",
"discoverAllAccessories": true
}

my error is here;

[SoundTouch] TypeError: Cannot read property 'length' of undefined
at Object.compactMap (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/soundtouch-api/dist/utils/array-compact-map.js:6:31)
at /usr/local/lib/node_modules/homebridge-soundtouch-platform/dist/sound-touch-device.js:158:60
at step (/usr/local/lib/node_modules/homebridge-soundtouch-platform/dist/sound-touch-device.js:32:23)
at Object.next (/usr/local/lib/node_modules/homebridge-soundtouch-platform/dist/sound-touch-device.js:13:53)
at fulfilled (/usr/local/lib/node_modules/homebridge-soundtouch-platform/dist/sound-touch-device.js:4:58)

@REvilo82
Copy link

`{
"platform": "SoundTouchPlatform",
"name": "SoundTouch",
"discoverAllAccessories": true
},
{
"platform": "SoundTouchPlatform",
"name": "SoundTouch",
"accessories": [
{
"name": "SoundTouch Kr",
"room": "Bathroom",
"volume": {
"unmuteValue": 40,
"maxValue": 80
}
}
]
},

@REvilo82
Copy link

[6/17/2019, 8:09:48 PM] [SoundTouch] Error: Can't find device using the name 'SoundTouch Kr' on your network
at Object.apiNotFoundWithName (/usr/local/lib/node_modules/homebridge-soundtouch-platform/dist/errors.js:4:12)
at Object. (/usr/local/lib/node_modules/homebridge-soundtouch-platform/dist/sound-touch-device.js:83:40)
at step (/usr/local/lib/node_modules/homebridge-soundtouch-platform/dist/sound-touch-device.js:32:23)
at Object.next (/usr/local/lib/node_modules/homebridge-soundtouch-platform/dist/sound-touch-device.js:13:53)
at fulfilled (/usr/local/lib/node_modules/homebridge-soundtouch-platform/dist/sound-touch-device.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
[6/17/2019, 8:09:49 PM] [SoundTouch] TypeError: Cannot read property 'id' of undefined
at SoundTouchPlatform.HomebridgePlatform.accessoryFromDevice (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:108:85)
at /usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:97:84
at Array.map ()
at SoundTouchPlatform. (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:97:47)
at step (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:45:23)
at Object.next (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:26:53)
at fulfilled (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:17:58)

@Nastras
Copy link

Nastras commented Jun 17, 2019

For me the plugin runs without problems. Here's my config on which you can orient or adapt.
Think then it should also run with you;)

Ps. I would leave "discoverAllAccessories": true and manually create the speakers as with me.

"accessories": [],

"platforms": [{
"platform": "SoundTouchPlatform",
"name": "Bose SoundTouch",
"accessories": [{
"name": "Lautsprecher Garage",
"ip": "xxxxxxxxx",
"onVolume": 25,
"unmuteVolume": 20,
"source": "true",
"volume": {
"mode": "speaker"
},
"presets": [{
"name": "Sender 1",
"index": 1
},
{
"name": "Sender 2",
"index": 2
},
{
"name": "Sender 3",
"index": 3
},
{
"name": "Sender 4",
"index": 4
},
{
"name": "Sender 5",
"index": 5
},
{
"name": "Sender 6",
"index": 6
}
]
},
{
"name": "Lautsprecher Badezimmer",
"ip": "xxxxxxxxxx",
"onVolume": 10,
"unmuteVolume": 10,
"source": "true",
"volume": {
"mode": "speaker"
},
"presets": [{
"name": "Sender 1",
"index": 1
},
{
"name": "Sender 2",
"index": 2
},
{
"name": "Sender 3",
"index": 3
},
{
"name": "Sender 4",
"index": 4
},
{
"name": "Sender 5",
"index": 5
},
{
"name": "Sender 6",
"index": 6
}
]
},
{
"name": "Lautsprecher Kueche",
"ip": "xxxxxxxxxx",
"onVolume": 10,
"unmuteVolume": 10,
"source": "true",
"volume": {
"mode": "speaker"
},
"presets": [{
"name": "Sender 1",
"index": 1
},
{
"name": "Sender 2",
"index": 2
},
{
"name": "Sender 3",
"index": 3
},
{
"name": "Sender 4",
"index": 4
},
{
"name": "Sender 5",
"index": 5
},
{
"name": "Sender 6",
"index": 6
}
]
},
{
"name": "Lautsprecher Wohnzimmer",
"ip": "xxxxxxxx",
"onVolume": 10,
"unmuteVolume": 10,
"source": "true",
"volume": {
"mode": "speaker"
},
"presets": [{
"name": "Sender 1",
"index": 1
},
{
"name": "Sender 2",
"index": 2
},
{
"name": "Sender 3",
"index": 3
},
{
"name": "Sender 4",
"index": 4
},
{
"name": "Sender 5",
"index": 5
},
{
"name": "Sender 6",
"index": 6
}
]
}
],
"global": {
"sources": [{
"source": "QPLAY",
"enabled": false
}
]
}
}
]
}`

@sebro83
Copy link
Author

sebro83 commented Jun 17, 2019

Hey @Nastras,

Thanks for pasting an example that should work. I adapted it like the following (Badlautsprecher being a soundtouch 10 and Kuechenlautsprecher the soundtouch 20).

Names and IPs are correct. Rest was left untouched. Next try for me would be to physically disconnect one device and see if it stems from a specific one of them. Or afterwards do a factory reset of the soundtouch devices.

However I still suspect this to be a small issue in the code - after all it's just a nullpointer, right @bbriatte? ;)

{
"platform": "SoundTouchPlatform",
"name": "Bose SoundTouch",
"accessories": [{
"name": "Badlautsprecher",
"ip": "192.168.178.35",
"onVolume": 10,
"unmuteVolume": 10,
"source": "true",
"volume": {
"mode": "speaker"
},
"presets": [{
"name": "Sender 1",
"index": 1
},
{
"name": "Sender 2",
"index": 2
},
{
"name": "Sender 3",
"index": 3
},
{
"name": "Sender 4",
"index": 4
},
{
"name": "Sender 5",
"index": 5
},
{
"name": "Sender 6",
"index": 6
}
]
},
{
"name": "Kuechenlautsprecher",
"ip": "192.168.178.26",
"onVolume": 10,
"unmuteVolume": 10,
"source": "true",
"volume": {
"mode": "speaker"
},
"presets": [{
"name": "Sender 1",
"index": 1
},
{
"name": "Sender 2",
"index": 2
},
{
"name": "Sender 3",
"index": 3
},
{
"name": "Sender 4",
"index": 4
},
{
"name": "Sender 5",
"index": 5
},
{
"name": "Sender 6",
"index": 6
}
]
}
],
"global": {
"sources": [{
"source": "QPLAY",
"enabled": false
}]
}
}

@Nastras
Copy link

Nastras commented Jun 18, 2019

Name is the device name you assigned in the Soundtouch app for your speaker.
7226386F-BE4B-4700-AF9C-589C8BB6F21F

@gerritfries
Copy link

Thanks for your help, but it still gives me the same error.

[SoundTouch] TypeError: Cannot read property 'id' of undefined
at SoundTouchPlatform.HomebridgePlatform.accessoryFromDevice (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:108:85)
at /usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:97:84
at Array.map ()
at SoundTouchPlatform. (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:97:47)
at step (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:45:23)
at Object.next (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:26:53)
at fulfilled (/usr/local/lib/node_modules/homebridge-soundtouch-platform/node_modules/homebridge-base-platform/dist/platform.js:17:58)

@REvilo82
Copy link

REvilo82 commented Jun 18, 2019 via email

@bbriatte
Copy link
Owner

Hi @gerritfries @sebro83 @paewrblue,

Check the new release 1.2.4 on npm, and tell me if it works

@paewrblue
Copy link

Hi @bbriatte

It works like a charm now.
Thank you so much for your help :)

@sebro83
Copy link
Author

sebro83 commented Jun 23, 2019

Thank you @bbriatte, works perfectly now!

@sebro83 sebro83 closed this as completed Jun 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants