HuJohner / homebridge-appletv

Apache License 2.0
22 stars 7 forks source link

Plugin crashed for unknown reasons #6

Open CooperCGN opened 1 year ago

CooperCGN commented 1 year ago

Describe The Bug:

Plugin threw error, child bridge restarted. There was no interaction between me and Apple TV at that point, so I have no clue what that error might have caused

To Reproduce:

Expected behavior:

Logs:

/var/lib/homebridge/node_modules/@hujohner/homebridge-appletv/node_modules/@sebbo2002/node-pyatv/src/lib/tools.ts:261
        throw new Error(errorStr);
              ^
Error: Got pyatv Error: no response to POST /feedback (RTSP/1.0)

pyatv Stacktrace:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/pyatv/support/http.py", line 390, in send_and_receive
    await event.wait()
  File "/usr/lib/python3.9/asyncio/locks.py", line 226, in wait
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/pyatv/support/http.py", line 390, in send_and_receive
    await event.wait()
  File "/usr/local/lib/python3.9/dist-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.9/dist-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/pyatv/core/protocol.py", line 56, in heartbeater
    await sender_func(message)
  File "/usr/local/lib/python3.9/dist-packages/pyatv/protocols/airplay/remote_control.py", line 75, in _send_feedback
    await self.rtsp.feedback()
  File "/usr/local/lib/python3.9/dist-packages/pyatv/support/rtsp.py", line 227, in feedback
    return await self.exchange("POST", uri="/feedback", allow_error=allow_error)
  File "/usr/local/lib/python3.9/dist-packages/pyatv/support/rtsp.py", line 265, in exchange
    resp = await self.connection.send_and_receive(
  File "/usr/local/lib/python3.9/dist-packages/pyatv/support/http.py", line 393, in send_and_receive
    raise TimeoutError(f"no response to {method} {uri} ({protocol})") from ex
TimeoutError: no response to POST /feedback (RTSP/1.0)

    at parseState (/var/lib/homebridge/node_modules/@hujohner/homebridge-appletv/node_modules/@sebbo2002/node-pyatv/src/lib/tools.ts:261:15)
    at NodePyATVDeviceEvents.applyPushUpdate (/var/lib/homebridge/node_modules/@hujohner/homebridge-appletv/node_modules/@sebbo2002/node-pyatv/src/lib/device-events.ts:94:40)
    at NodePyATVDeviceEvents.parsePushUpdate (/var/lib/homebridge/node_modules/@hujohner/homebridge-appletv/node_modules/@sebbo2002/node-pyatv/src/lib/device-events.ts:84:14)
    at /var/lib/homebridge/node_modules/@hujohner/homebridge-appletv/node_modules/@sebbo2002/node-pyatv/src/lib/device-events.ts:156:36
    at Array.forEach (<anonymous>)
    at Socket.onStdOut (/var/lib/homebridge/node_modules/@hujohner/homebridge-appletv/node_modules/@sebbo2002/node-pyatv/src/lib/device-events.ts:156:18)
    at Socket.emit (node:events:525:35)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Socket.Readable.push (node:internal/streams/readable:234:10)
[21/02/2023, 13:44:33] [@hujohner/homebridge-appletv] Child bridge process ended
[21/02/2023, 13:44:33] [@hujohner/homebridge-appletv] Process Ended. Code: 1, Signal: null

Plugin Config:

{
    "devices": [
        {
            "name": "ATV4K",
            "host": "10.0.1.XXX",
            "credentials": "redacted",
            "device_state_sensors": [
                "idle",
                "paused",
                "playing"
            ]
        }
    ],
    "platform": "AppleTV",
    "_bridge": {
        "username": "0E:BA:39:87:3C:8C",
        "port": 53459
    }
}

Screenshots:

Environment:

jianyu-li commented 1 year ago

I don't know if this made the difference in my setup but I was getting errors too until I named my apple tv EXACTLY how its named when it comes up in the atvremote scan step.

CooperCGN commented 1 year ago

Actually the name that shows up during scan should be the one that is set in your Apple TV, so I don’t know if that makes the difference. I think the plug-in might need some error handling like when the connection to the Apple TV is closed or timing out for whatever reason. Imam sadly no coder so I can’t tell if that’s already being done.