Describe the bug
When the connection is lost the atv object can be None which leads to backtrace and improper cleanup:
Error doing job: Exception in callback _SelectorSocketTransport._call_connection_lost(ConnectionRes...eset by peer'))
Traceback (most recent call last):
File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/lib/python3.7/asyncio/selector_events.py", line 916, in _call_connection_lost
super()._call_connection_lost(exc)
File "/usr/lib/python3.7/asyncio/selector_events.py", line 690, in _call_connection_lost
self._protocol.connection_lost(exc)
File "/srv/homeassistant-3.7/lib/python3.7/site-packages/pyatv/mrp/connection.py", line 50, in connection_lost
self.atv.listener.connection_lost(exc)
File "/home/homeassistant/.homeassistant/custom_components/apple_tv/__init__.py", line 166, in connection_lost
_LOGGER.warning('Connection lost to Apple TV "%s"', self.atv.name)
AttributeError: 'MrpAppleTV' object has no attribute 'name'
To Reproduce
Unknown.
Expected behavior
Don't cause exceptions.
System Setup (please complete the following information):
Additional context
Yeah, this looks utterly wrong. It's not that self.atv is None, but it has no name property. It should be fetched from the config entry instead. I will try to fix that.
Pushed an update now!
Did you manage to verify if the update solved the problem? If that's the case, feel free to close the issue!
I haven't seen the problem since, thanks for the quick fix!