JarekToro / homebridge-roku-tv

Apache License 2.0
10 stars 4 forks source link

crashes homebridge on start #31

Open yocontra opened 1 year ago

yocontra commented 1 year ago

Screenshot 2023-02-04 at 8 11 54 PM

Nothing special about my setup - installed plugin, did not do any configuration - TCL Roku TV is in the other room on the wifi network.

yocontra commented 1 year ago

After making these two tweaks works fine.

yocontra commented 1 year ago

Spoke too soon, more issues with the name attribute - this time starting an app crashes homebridge.

TypeError: Cannot read properties of undefined (reading 'name')
    at ActiveIdentifier.<anonymous> (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge-roku-tv-plugin/src/roku-tv-accessory.ts:197:60)
    at ActiveIdentifier.emit (node:events:513:28)
    at /Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2596:16
    at new Promise (<anonymous>)
    at ActiveIdentifier.<anonymous> (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2594:14)
    at step (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/tslib/tslib.js:193:27)
    at Object.next (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/tslib/tslib.js:174:57)
    at /Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/tslib/tslib.js:167:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/tslib/tslib.js:163:16)
    at ActiveIdentifier.Characteristic.handleSetRequest (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:871:24)
    at Accessory.<anonymous> (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1889:29)
    at step (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/tslib/tslib.js:193:27)
    at Object.next (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/tslib/tslib.js:174:57)
    at /Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/tslib/tslib.js:167:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/tslib/tslib.js:163:16)
    at Accessory.handleCharacteristicWrite (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1545:24)
    at _loop_2 (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1762:12)
    at Accessory.handleSetCharacteristics (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1533:17)
    at HAPServer.emit (node:events:513:28)
    at HAPServer.handleCharacteristics (/Users/contra/.nvm/versions/node/v16.17.0/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/HAPServer.ts:955:12)

Same as before adding if (!app) return resolves - https://github.com/JarekToro/homebridge-roku-tv/blob/master/src/roku-tv-accessory.ts#L197

Not sure what app is causing this to return undefined like this, possibly one of the TV inputs?

traviswparker commented 1 year ago

Yes, Roku changed the Home ID from 123456 (the same combination as my luggage!) to 562859. The const value in settings.ts needs to be updated.

To fix it locally, in the installed plugin's dir, find the dist/settings.js file and change it there.

Additionally, this plug-in is no longer on npm and it does not build without some changes to package.json due to changes in npm. Remove all of the ^ marks from the versions in package.json and add hap-nodejs to the devDependencies. Fix settings.ts. Once you do that, 'npm install' will grab the right versions and 'npm run build' will work. Then go up one level and 'npm install' the folder to install the plugin to HB.