Hi,
I’m struggling to find a solution to my problem where my Home Assistant running on a Pi4 works perfectly well after reboot, but after 3d-2w or so, it completely stops responding to api requests. The automation still works perfectly well, but the web interface is completely dead and the app stops working. SSH’ing into the device; netstat -l suggests that the device is NOT listening to port 8123. Restarting core assistant does fix the issue, but it’s super annoying that it does this consistently after some time. Looking at the logs, I do see some network errors, but I’m not convinced they’re responsible for this:
> 2021-03-27 00:24:00 ERROR (MainThread) [pyatv.support.mdns] fail to send to <pyatv.support.mdns.ReceiveDelegate object at 0xa297f9b8>
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1048, in sendto
> self._sock.sendto(data, addr)
> AttributeError: 'NoneType' object has no attribute 'sendto'
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 328, in _sendto
> receiver.sendto(message, target)
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 217, in sendto
> self.transport.sendto(message, target)
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1058, in sendto
> self._fatal_error(
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 705, in _fatal_error
> self._loop.call_exception_handler({
> AttributeError: 'NoneType' object has no attribute 'call_exception_handler'
> 2021-03-27 00:24:01 ERROR (MainThread) [pyatv.support.mdns] fail to send to <pyatv.support.mdns.ReceiveDelegate object at 0xa297fb50>
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1048, in sendto
> self._sock.sendto(data, addr)
> AttributeError: 'NoneType' object has no attribute 'sendto'
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 328, in _sendto
> receiver.sendto(message, target)
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 217, in sendto
> self.transport.sendto(message, target)
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1058, in sendto
> self._fatal_error(
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 705, in _fatal_error
> self._loop.call_exception_handler({
> AttributeError: 'NoneType' object has no attribute 'call_exception_handler'
> 2021-03-27 00:24:01 ERROR (MainThread) [pyatv.support.mdns] fail to send to <pyatv.support.mdns.ReceiveDelegate object at 0xa297f9b8>
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1048, in sendto
> self._sock.sendto(data, addr)
> AttributeError: 'NoneType' object has no attribute 'sendto'
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 328, in _sendto
> receiver.sendto(message, target)
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 217, in sendto
> self.transport.sendto(message, target)
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1058, in sendto
> self._fatal_error(
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 705, in _fatal_error
> self._loop.call_exception_handler({
> AttributeError: 'NoneType' object has no attribute 'call_exception_handler'
> 2021-03-27 00:24:02 ERROR (MainThread) [pyatv.support.mdns] fail to send to <pyatv.support.mdns.ReceiveDelegate object at 0xa297fb50>
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1048, in sendto
> self._sock.sendto(data, addr)
> AttributeError: 'NoneType' object has no attribute 'sendto'
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 328, in _sendto
> receiver.sendto(message, target)
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 217, in sendto
> self.transport.sendto(message, target)
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1058, in sendto
> self._fatal_error(
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 705, in _fatal_error
> self._loop.call_exception_handler({
> AttributeError: 'NoneType' object has no attribute 'call_exception_handler'
> 2021-03-27 00:24:02 ERROR (MainThread) [pyatv.support.mdns] fail to send to <pyatv.support.mdns.ReceiveDelegate object at 0xa297f9b8>
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1048, in sendto
> self._sock.sendto(data, addr)
> AttributeError: 'NoneType' object has no attribute 'sendto'
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 328, in _sendto
> receiver.sendto(message, target)
> File "/usr/local/lib/python3.8/site-packages/pyatv/support/mdns.py", line 217, in sendto
> self.transport.sendto(message, target)
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1058, in sendto
> self._fatal_error(
> File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 705, in _fatal_error
> self._loop.call_exception_handler({
> AttributeError: 'NoneType' object has no attribute 'call_exception_handler'
BTW: I’m running Hass OS and I had to enable ssh just to get access to the device after it gets messed up like this.