materik / homebridge-harmonyhub-plugin

Logitech HarmonyHub plugin for Homebridge
39 stars 2 forks source link

Not working - TypeError: self.name is not a function. #38

Closed ianepperson closed 3 years ago

ianepperson commented 3 years ago

I'm very new to Homebridge and am loving it. I tried this plugin to control my Harmony Hub but it isn't working for me. There's an error showing in the logs with a nice traceback though:

[14/11/2020, 19:48:51] [homebridge-harmonyhub-plugin] {HarmonyHub} Found <1> hubs
[14/11/2020, 19:48:51] [homebridge-harmonyhub-plugin] {HarmonyHub} <aade1f61-b47f-4196-aa0c-cb4372a7c617> <Harmony Hub>
[14/11/2020, 19:48:52] [homebridge-harmonyhub-plugin] {HarmonyHub} create new client for <Harmony Hub>
[14/11/2020, 19:48:53] [homebridge-harmonyhub-plugin] {HarmonyHub} Found <6> activities: <YouTube, Watch a Movie, Watch Netflix, Listen to Music, Internet Radio, Watch Apple TV>
[14/11/2020, 19:48:53] [homebridge-harmonyhub-plugin] {HarmonyHubAccessory} adding <6> activities
[14/11/2020, 19:48:53] [homebridge-harmonyhub-plugin] {HarmonyHubAccessory} addActivity <YouTube>
[14/11/2020, 19:48:53] [homebridge-harmonyhub-plugin] {HarmonyHubAccessory} loadActivities: TypeError: self.name is not a function
    at new ActivityService (/usr/local/lib/node_modules/homebridge-harmonyhub-plugin/lib/activity-service.js:15:64)
    at Accessory._this.addService (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:269:11)
    at PlatformAccessory.addService (/usr/local/lib/node_modules/homebridge/src/platformAccessory.ts:92:41)
    at Accessory.addService (/usr/local/lib/node_modules/homebridge-harmonyhub-plugin/lib/accessory.js:38:49)
    at HarmonyHubAccessory.addActivity (/usr/local/lib/node_modules/homebridge-harmonyhub-plugin/lib/harmonyhub-accessory.js:47:27)
    at /usr/local/lib/node_modules/homebridge-harmonyhub-plugin/lib/harmonyhub-accessory.js:140:37
    at arrayMap (/usr/local/lib/node_modules/homebridge-harmonyhub-plugin/node_modules/lodash/lodash.js:639:23)
    at Function.map (/usr/local/lib/node_modules/homebridge-harmonyhub-plugin/node_modules/lodash/lodash.js:9556:14)
    at /usr/local/lib/node_modules/homebridge-harmonyhub-plugin/lib/harmonyhub-accessory.js:139:30
    at tryCallOne (/usr/local/lib/node_modules/homebridge-harmonyhub-plugin/node_modules/promise/lib/core.js:37:12)

Running Homebridge v1.1.6 on a Raspberry Pi using https://github.com/homebridge/homebridge-raspbian-image

ianepperson commented 3 years ago

Should each of these self.name() calls actually be activity.name()?

https://github.com/materik/homebridge-harmonyhub-plugin/blob/master/lib/activity-service.js#L11-L15

Prototypical inheritance often mixes me up.

materik commented 3 years ago

Sorry for my lack of response. Should be fixed now!

ianepperson commented 3 years ago

Thanks @materik , it's working great now!

materik commented 3 years ago

awesome 👍