grover / homebridge-dacp

Remotely control Apple TV and iTunes via HomeKit.
MIT License
151 stars 14 forks source link

Apple TV 12.1.1 compatibility #59

Closed johninaustin closed 2 years ago

johninaustin commented 5 years ago

Apple now validates the user agent. Use "Remote/1021".

nievamarenostrum commented 5 years ago

where do I have to use that command, in the configure.json?

johninaustin commented 5 years ago

You update the DacpConnection.js file, changing the User-Agent... it's part of this pull request.

DBabs1 commented 5 years ago

where do I have to use that command, in the configure.json?

If anyone wants to rush this into a homebridge running on a pi, the path to the file is /usr/local/lib/node_modules/homebridge-dacp/sr/dacp/ adding the one line from Johninaustin fixes the issue after a reboot of homebridge.

nievamarenostrum commented 5 years ago

tested and working. Thank you!

sidjohn1 commented 5 years ago

I've also made the change and it worked like a champ!

damianromanowski commented 5 years ago

Can confirm this fixes #60 and probably #58 as well.

CooperCGN commented 5 years ago

The fix worked for me until today. I have no idea where it comes from, either the Homebridge update or the latest tvOS 12.1.2 but I suddenly get the following error in homebridge and the accessory is shown as not responding in the Home app.

[2019-1-26 09:44:01] [DACP] Starting DACP browser...
[2019-1-26 09:44:01] Homebridge is running on port 51847.
[2019-1-26 09:44:03] [DACP] The accessory Apple TV is announced as 10.0.1.38:3689.
[2019-1-26 09:44:03] [DACP] It's an AppleTV6,2 named Wohnzimmer
[2019-1-26 09:44:03] [DACP] Attempting to reconnect to Apple TV in 0.1 seconds.
[2019-1-26 09:44:03] [DACP] Connecting to Apple TV (10.0.1.38:3689)
[2019-1-26 09:44:03] [DACP] Creating status connection to 10.0.1.38:3689
Established connection to 10.0.1.38:3689 with session ID 3
error on aeSX
RangeError [ERR_OUT_OF_RANGE]: The value of "byteLength" is out of range. It must be >= 1 and <= 6. Received 8
    at boundsError (internal/buffer.js:50:9)
    at Buffer.readIntBE (internal/buffer.js:333:3)
    at _decode (/usr/local/lib/node_modules/homebridge-dacp/src/daap/Decoder.js:927:26)
    at _decode (/usr/local/lib/node_modules/homebridge-dacp/src/daap/Decoder.js:933:19)
    at Object.decode (/usr/local/lib/node_modules/homebridge-dacp/src/daap/Decoder.js:963:10)
    at Request.request [as _callback] (/usr/local/lib/node_modules/homebridge-dacp/src/dacp/DacpConnection.js:145:29)
    at Request.self.callback (/usr/local/lib/node_modules/homebridge-dacp/node_modules/request/request.js:185:22)
    at Request.emit (events.js:189:13)
    at Request.<anonymous> (/usr/local/lib/node_modules/homebridge-dacp/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:189:13)
[2019-1-26 09:44:05] [DACP] Connected to Wohnzimmer
[2019-1-26 09:44:12] [Config] Using Form Authentication
[2019-1-26 09:44:12] [Config] Console v3.9.4 is listening on port 8086.
[2019-1-26 09:45:51] [DACP] Returning current playback state: paused
Carl05M commented 5 years ago

I manually edited Dacpconnection.js as described.

The DACP switch works in Home app to control play-pause but does not report status change if play/pause activated by bluetooth AppleTV remote or iOS controller.

Log reports the same error as CooperCGN when trying to use alternate-playpause-switch.

error on aeSX RangeError [ERR_OUT_OF_RANGE]: The value of "byteLength" is out of range. It must be >= 1 and <= 6. Received 8 at boundsError (internal/buffer.js:58:9) at Buffer.readIntBE (internal/buffer.js:341:3) at _decode (/usr/local/lib/node_modules/homebridge-dacp/src/daap/Decoder.js:927:26) at _decode (/usr/local/lib/node_modules/homebridge-dacp/src/daap/Decoder.js:933:19) at Object.decode (/usr/local/lib/node_modules/homebridge-dacp/src/daap/Decoder.js:963:10) at Request.request [as _callback] (/usr/local/lib/node_modules/homebridge-dacp/src/dacp/DacpConnection.js:145:29) at Request.self.callback (/usr/local/lib/node_modules/homebridge-dacp/node_modules/request/request.js:185:22) at Request.emit (events.js:197:13) at Request.<anonymous> (/usr/local/lib/node_modules/homebridge-dacp/node_modules/request/request.js:1161:10) at Request.emit (events.js:197:13) at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/homebridge-dacp/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:285:13) at IncomingMessage.emit (events.js:202:15) at endReadableNT (_stream_readable.js:1129:12) at processTicksAndRejections (internal/process/next_tick.js:76:17) [3/5/2019, 5:11:14 PM] [DACP] Connected to Lounge

Log shows playback status changing.

[3/5/2019, 5:11:43 PM] [DACP] Returning current playback state: paused [3/5/2019, 5:11:54 PM] [DACP] Setting current playback state: playing [3/5/2019, 5:11:54 PM] [DACP] Creating properties connection to 192.168.1.30:3689 [3/5/2019, 5:11:54 PM] [DACP] Playback status update done. [3/5/2019, 5:11:57 PM] [DACP] Setting current playback state: playing [3/5/2019, 5:11:57 PM] [DACP] Playback status update done. [3/5/2019, 5:12:41 PM] [DACP] Setting current playback state: playing [3/5/2019, 5:12:41 PM] [DACP] Playback status update done. [3/5/2019, 5:12:42 PM] [DACP] Setting current playback state: playing [3/5/2019, 5:12:42 PM] [DACP] Playback status update done.