Aymkdn / assistant-freebox-cloud

Assistant Freebox in the Cloud
74 stars 14 forks source link

Android TV (v2) 1st Configuration Message get error from TV #140

Closed Sirogha closed 11 months ago

Sirogha commented 11 months ago

Hello

I have TCL tv (android TV). I try use your algorithm (url) and get error from TV, when send 1st Configuration Message (steps):

1) When my app connect to TV via 6466 port, i got packet from TV. 85,10,83,8,253,4,18,78,10,12,83,109,97,114,116,32,84,86,32,80,114,111,18,3,84,67,76,24,1,34,2,49,49,42,36,99,111,109,46,103,111,111,103,108,101,46,97,110,100,114,111,105,100,46,116,118,46,114,101,109,111,116,101,46,115,101,114,118,105,99,101,50,13,53,46,50,46,52,55,51,50,53,52,49,51,51 (dec) 550A5308FD04124E0A0C536D6172742054562050726F120354434C1801220231312A24636F6D2E676F6F676C652E616E64726F69642E74762E72656D6F74652E73657276696365320D352E322E343733323534313333 (hex) remote_configure { code1: 637 device_info { model: "Smart TV Pro" vendor: "TCL" unknown1: 1 unknown2: "11" package_name: "com.google.android.tv.remote.service" app_version: "5.2.473254133" } } 2) I try to send configuration message. This packet have small error - androitv-remove instead androidtv-remote, but androidtv-remote not work too. 36,10,34,8,238,4,18,29,24,1,34,1,49,42,15,97,110,100,114,111,105,116,118,45,114,101,109,111,116,101,50,5,49,46,48,46,48 (dec) 240A2208EE04121D18012201312A0F616E64726F6974762D72656D6F74653205312E302E30 (hex) remote_configure { code1: 622 device_info { unknown1: 1 unknown2: "1" package_name: "androitv-remote" app_version: "1.0.0" } } 3) I got packet from TV with error. 42,26,40,8,3,18,36,10,34,8,238,4,18,29,24,1,34,1,49,42,15,97,110,100,114,111,105,116,118,45,114,101,109,111,116,101,50,5,49,46,48,46,48 (dec) 2A1A28080312240A2208EE04121D18012201312A0F616E64726F6974762D72656D6F74653205312E302E30 (hex) remote_error { value: true message { remote_configure { code1: 622 device_info { unknown1: 1 unknown2: "1" package_name: "androitv-remote" app_version: "1.0.0" } } }

Can any help?

Aymkdn commented 11 months ago

Sorry, I cannot help.

I know it's very painful and I did my best to provide a documentation based on what I discovered. But it's really difficult to make it work.

I guess that if you're at the step to send on 6466, it means you succeed with the pairing step… Maybe you can verify you don't send too early the packets, and that you send them in the correct order... Other than that, I cannot help.

You could also play with the JS implementation that works great and could help: https://github.com/louis49/androidtv-remote

Good luck!

Sirogha commented 11 months ago

https://github.com/louis49/androidtv-remote have same error ` AndroidRemote { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, host: '192.168.100.3', cert: { key: undefined, cert: undefined }, pairing_port: 6467, remote_port: 6466, service_name: 'Service Name',

} Start Pairing Connect 192.168.100.3 Pairing connected 192.168.100.3 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":{}} Code : 27247C Sending code : 27247C Receive : 42,8,2,16,200,1,202,2,34,10,32,39,7,176,213,140,50,218,19,169,117,107,145,104,201,253,128,23,229,48,225,186,231,47,115,69,76,245,211,205,53,162,96 Receive : {"protocolVersion":2,"status":"STATUS_OK","pairingSecretAck":{"secret":"Jwew1Ywy2hOpdWuRaMn9gBflMOG65y9zRUz10801omA="}} 192.168.100.3 Paired! 192.168.100.3 Pairing Connection closed false Start Remote Connect 192.168.100.3 Remote secureConnect true 192.168.100.3 Receive : {"remoteConfigure":{"code1":637,"deviceInfo":{"model":"Smart TV Pro","vendor":"TCL","unknown1":1,"unknown2":"11","packageName":"com.google.android.tv.remote.service","appVersion":"5.2.473254133"}}} Create Remote {"remoteConfigure":{"code1":622,"deviceInfo":{"model":"MacBookPro16,1","vendor":"Apple Inc.","unknown1":1,"unknown2":"1","packageName":"androitv-remote","appVersion":"1.0.0"}}} Sending {"remoteConfigure":{"code1":622,"deviceInfo":{"model":"MacBookPro16,1","vendor":"Apple Inc.","unknown1":1,"unknown2":"1","packageName":"androitv-remote","appVersion":"1.0.0"}}} 192.168.100.3 Receive : {"remoteError":{"value":true,"message":{"remoteConfigure":{"code1":622,"deviceInfo":{"model":"MacBookPro16,1","vendor":"Apple Inc.","unknown1":1,"unknown2":"1","packageName":"androitv-remote","appVersion":"1.0.0"}}}}} node:events:508 throw err; // Unhandled 'error' event ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({ error: RemoteError { value: true, message: RemoteMessage { remoteConfigure: [RemoteConfigure] } } }) at new NodeError (node:internal/errors:405:5) at RemoteManager.emit (node:events:506:17) at TLSSocket. (/Users/hibiki/Documents/BitBucket/twillio_scripts/node_modules/androidtv-remote/dist/remote/RemoteManager.js:107:21) at TLSSocket.emit (node:events:517:28) at addChunk (node:internal/streams/readable:368:12) at readableAddChunk (node:internal/streams/readable:341:9) at Readable.push (node:internal/streams/readable:278:10) at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) { code: 'ERR_UNHANDLED_ERROR', context: { error: RemoteError { value: true, message: RemoteMessage { remoteConfigure: RemoteConfigure { code1: 622, deviceInfo: RemoteDeviceInfo { model: 'MacBookPro16,1', vendor: 'Apple Inc.', unknown1: 1, unknown2: '1', packageName: 'androitv-remote', appVersion: '1.0.0' } } } } } }

Node.js v18.19.0 `