HomeAssistant icon indicating copy to clipboard operation
HomeAssistant copied to clipboard

DC1接入进来后,过段时间报异常:socket is not connected

Open chainone opened this issue 5 years ago • 2 comments

然后观察了下hass机器的netstat,发现DC1不再主动连hass了,很可能是引发DC1官方固件的问题导致不再连接。这块你有碰到类似的情况么?

chainone avatar Sep 22 '19 05:09 chainone

相关log日志:

2019-09-22 09:24:23 ERROR (SyncWorker_18) [custom_components.phicomm_dc1m.switch] sock except:[Errno 57] Socket is not connected sock:<socket.socket fd=14, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.50.145', 8000)>
2019-09-22 09:24:23 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.dc1 fails
Traceback (most recent call last):
  File "/usr/local/homeassistant/custom_components/phicomm_dc1m/switch.py", line 294, in update
    elif sockA.getpeername() is None:
OSError: [Errno 57] Socket is not connected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/share/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
"home-assistant.log" 323L, 38536C                                                                                                                       1,1           Top
        40005,
        "Display Is Turned off"
    ],
    "id": 1
}
2019-09-22 09:24:23 ERROR (SyncWorker_18) [custom_components.phicomm_dc1m.switch] sock except:[Errno 57] Socket is not connected sock:<socket.socket fd=14, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.50.145', 8000)>
2019-09-22 09:24:23 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.dc1 fails
Traceback (most recent call last):
  File "/usr/local/homeassistant/custom_components/phicomm_dc1m/switch.py", line 294, in update
    elif sockA.getpeername() is None:
OSError: [Errno 57] Socket is not connected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/share/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/share/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 441, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/homeassistant/custom_components/phicomm_dc1m/switch.py", line 326, in update
    sockA.shutdown(2)
OSError: [Errno 57] Socket is not connected
2019-09-22 09:24:43 WARNING (SyncWorker_10) [custom_components.phicomm_dc1m.switch] PhicommDC1Switch Client list is empty
2019-09-22 09:25:04 WARNING (SyncWorker_1) [custom_components.phicomm_dc1m.switch] PhicommDC1Switch Client list is empty
2019-09-22 09:25:24 WARNING (SyncWorker_2) [custom_components.phicomm_dc1m.switch] PhicommDC1Switch Client list is empty

chainone avatar Sep 22 '19 05:09 chainone

确认应该是DC1的问题,一旦socket error后,DC1就不会再进行连接,上报信息了。

chainone avatar Sep 22 '19 10:09 chainone