louis49 / homebridge-plugin-androidtv

MIT License
22 stars 12 forks source link

Strange Pairing Issue #23

Closed mackmoe closed 2 years ago

mackmoe commented 2 years ago

Hi, I had a strange issue with the plugin where this is the error message I'm seeing in the logs:

Start Pairing Connect
192.168.50.116 Pairing connected
192.168.50.116 Pairing secure connected 
Receive : 7,8,2,16,200,1,90,0
Receive : {"protocolVersion":2,"status":"STATUS_OK","pairingRequestAck":{}}
Receive : 16,8,2,16,200,1,162,1,8,18,4,8,3,16,6,24,1
Receive : {"protocolVersion":2,"status":"STATUS_OK","pairingOption":{"outputEncodings":[{"type":"ENCODING_TYPE_HEXADECIMAL","symbolLength":6}],"preferredRole":"ROLE_TYPE_INPUT"}}
Receive : 8,8,2,16,200,1,250,1,0
Receive : {"protocolVersion":2,"status":"STATUS_OK","pairingConfigurationAck":{}}
Pairing SHIELD
Sending code :  <"Enter this code with your HomeKit app on your iOS device to pair with Homebridge">
Error: Bad Code
    at PairingManager.sendCode (/var/lib/homebridge/node_modules/.pnpm/androidtv-remote@1.0.10/node_modules/androidtv-remote/dist/pairing/PairingManager.js:60:27)
    at AndroidRemote.sendCode (/var/lib/homebridge/node_modules/.pnpm/androidtv-remote@1.0.10/node_modules/androidtv-remote/dist/index.js:81:32)
    at /var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:214:42
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:26:103)
    at _next (/var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:28:194)
    at /var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:28:364
    at new Promise (<anonymous>)
    at /var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:28:97
    at DeviceManager.sendCode (/var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:224:7)
192.168.50.116 Pairing Connection closed true
false

The weird thing is that no matter what I use, the 2nd time I send a code, homebridge will freakout and reboot:

Sending code :  
[5/9/2022, 5:33:40 PM] TypeError: Cannot read properties of null (reading 'modulus')
    at PairingManager.sendCode (/var/lib/homebridge/node_modules/.pnpm/androidtv-remote@1.0.10/node_modules/androidtv-remote/dist/pairing/PairingManager.js:50:70)
    at AndroidRemote.sendCode (/var/lib/homebridge/node_modules/.pnpm/androidtv-remote@1.0.10/node_modules/androidtv-remote/dist/index.js:81:32)
    at /var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:214:42
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:26:103)
    at _next (/var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:28:194)
    at /var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:28:364
    at new Promise (<anonymous>)
    at /var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:28:97
    at DeviceManager.sendCode (/var/lib/homebridge/node_modules/.pnpm/homebridge-androidtv@2.2.0/node_modules/homebridge-androidtv/dist/homebridge/DeviceManager.js:224:7)
[5/9/2022, 5:33:40 PM] Got SIGTERM, shutting down Homebridge...
[5/9/2022, 5:33:45 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[5/9/2022, 5:33:50 PM] [HB Supervisor] Restarting Homebridge...
[5/9/2022, 5:33:50 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[5/9/2022, 5:33:50 PM] [HB Supervisor] Started Homebridge v1.4.1 with PID: 268088

What I wanted to ask was if you know whether or not the actual android tv will store a previously used code? I'd imagine so. If that's true, then I think it'd just be a matter of busting the cache or deleting the file that holds that data right?

mackmoe commented 2 years ago

I swear I did nothing at all... just gave it some time and tried again and wouldn't you know it...

Start Pairing Connect
192.168.50.116 Pairing connected
192.168.50.116 Pairing secure connected 
Receive : 7,8,2,16,200,1,90,0
Receive : {"protocolVersion":2,"status":"STATUS_OK","pairingRequestAck":{}}
Receive : 16,8,2,16,200,1,162,1,8,18,4,8,3,16,6,24,1
Receive : {"protocolVersion":2,"status":"STATUS_OK","pairingOption":{"outputEncodings":[{"type":"ENCODING_TYPE_HEXADECIMAL","symbolLength":6}],"preferredRole":"ROLE_TYPE_INPUT"}}
Receive : 8,8,2,16,200,1,250,1,0
Receive : {"protocolVersion":2,"status":"STATUS_OK","pairingConfigurationAck":{}}
Pairing SHIELD
Sending code :  5B79A3
Receive : 42,8,2,16,200,1,202,2,34,10,32,91,167,210,218,12,172,160,5,243,43,203,172,220,61,134,58,212,98,67,162,62,20,143,242,57,5,111,190,24,239,96,81
Receive : {"protocolVersion":2,"status":"STATUS_OK","pairingSecretAck":{"secret":"W6fS2gysoAXzK8us3D2GOtRiQ6I+FI/yOQVvvhjvYFE="}}
192.168.50.116 Paired!
192.168.50.116 Pairing Connection closed false
Start Remote Connect
192.168.50.116 Remote secureConnect
192.168.50.116 Receive : {"remoteConfigure":{"code1":639,"deviceInfo":{"model":"SHIELD Android TV","vendor":"NVIDIA","unknown1":1,"unknown2":"11","packageName":"com.google.android.tv.remote.service","appVersion":"5.1.415324728"}}}
Create Remote {"remoteConfigure":{"code1":622,"deviceInfo":{"model":"ProLiant DL365 G5","vendor":"HP","unknown1":1,"unknown2":"1","packageName":"androitv-remote","appVersion":"1.0.0"}}}
Sending {"remoteConfigure":{"code1":622,"deviceInfo":{"model":"ProLiant DL365 G5","vendor":"HP","unknown1":1,"unknown2":"1","packageName":"androitv-remote","appVersion":"1.0.0"}}}
[5/9/2022, 8:28:37 PM] [HomebridgeAndroidTV] Discover :  {
  host: '192.168.50.116',
  name: 'SHIELD',
  paired: true,
  pairing: false,
  powered: false,
  online: true,
  started: true,
  volume_max: 0,
  volume_current: 0,
  volume_muted: false,
  app_package_current: '',
  type: 31
}
[5/9/2022, 8:28:37 PM] [HomebridgeAndroidTV] SHIELD Registering device 4af38647-e9f1-46f7-b887-f059fd3b2ce4
[5/9/2022, 8:28:37 PM] [HomebridgeAndroidTV] SHIELD Adding channel Info 1b4a3014-8d74-47bf-985f-8f2e774e77fc
[5/9/2022, 8:28:37 PM] [HomebridgeAndroidTV] SHIELD Adding key Power 5238d30a-7ff8-4579-a60f-3b4b9b50858c
[5/9/2022, 8:28:37 PM] [HomebridgeAndroidTV] SHIELD Adding application Netflix 51e2b3fe-a51d-4941-8bb4-bf213d912e55
[5/9/2022, 8:28:37 PM] SHIELD 0EE1 is running on port 46489.
[5/9/2022, 8:28:37 PM] Please add [SHIELD 0EE1] manually in Home app. Setup Code: 650-45-662
192.168.50.116 Receive : {"remoteSetActive":{}}
Create Remote {"remoteSetActive":{"active":622}}
Sending {"remoteSetActive":{"active":622}}
192.168.50.116 Receive : {"remoteImeKeyInject":{"appInfo":{"appPackage":"com.hulu.livingroomplus"}}}
192.168.50.116 Receive : {"remoteStart":{"started":true}}
[5/9/2022, 8:28:37 PM] [HomebridgeAndroidTV] SHIELD powered true
192.168.50.116 Receive : {"remoteSetVolumeLevel":{"unknown1":228,"unknown2":9,"playerModel":"SHIELD Android TV","unknown4":1}}

Good2Go! xD

Sorry for not waiting longer to open this... myb