elad-bar / ha-shinobi

Shinobi Video custom component for HA
53 stars 5 forks source link

Shinobi integration stops working after some time #41

Closed ez12a closed 1 year ago

ez12a commented 1 year ago

Home Assistant 2022.11.5 Running in Docker. ha-shinobi v2.0.30

Have automations that key off of the motion binary sensors in shinobi. they'll work for a few hours and then stop responding.

Enabled debug logging and see this message repeatedly when the integration is not working: 2022-12-21 19:30:22.060 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second

Restarting the integration or HA revives it. Any ideas?

elad-bar commented 1 year ago

That message by itself as written in it is informative and says it will reconnect, the question whether theres is additional message that notify something got disconnected? If not, how much time after this message it didn't connect? Most likely I will need more details to understand what is the issue, The message is about the message queue that got empty and it waits for x seconds to reconnect, If it fails to connect I would expect the dailure message following this one

Thanks

ez12a commented 1 year ago

Thanks for the reply, i dont see anything indicating a disconnect: 2022-12-21 17:50:58.186 DEBUG (MainThread) [custom_components.shinobi.component.api.websocket] Payload (42) received, Type: os 2022-12-21 17:51:04.772 DEBUG (MainThread) [custom_components.shinobi.component.api.websocket] Sending message, Data: 42["pong", {"beat": 1}], Status: Connected to the API 2022-12-21 17:51:08.188 DEBUG (MainThread) [custom_components.shinobi.component.api.websocket] Payload (42) received, Type: os 2022-12-21 17:51:12.771 DEBUG (MainThread) [custom_components.shinobi.component.api.websocket] Sending message, Data: 42["pong", {"beat": 1}], Status: Connected to the API 2022-12-21 17:51:15.631 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second 2022-12-21 17:51:16.635 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second

elad-bar commented 1 year ago

don't see the problem here, as mentioned, once the queue got empty, it will reconnect and keep on getting new events, can you post here the configuration for the logger?

thanks

ez12a commented 1 year ago

The Logger configured as indicated in the readme.

I stop seeing the heartbeat(?) Entries and "Status: Connected to the API" messages when the integration isn't working.

As a workaround I've got an hourly restart of the integration in an automation.

elad-bar commented 1 year ago

You don't nned to see that message if the state was not changed, can you please post the entire log so i'll investigate it?

Thanks

ez12a commented 1 year ago

home-assistant.log Attached

rouloy commented 1 year ago

Don't know if this add to the issue, but I see the same message over and over again. 2023-02-02 17:18:14.325 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second

And in between: 2023-02-02 17:16:16.269 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/shinobi/component/managers/home_assistant.py", line 61, in async_send_heartbeat await self.ws.async_send_heartbeat() File "/config/custom_components/shinobi/component/api/websocket.py", line 171, in async_send_heartbeat await self._ws.ping(SHINOBI_WS_PING_MESSAGE) File "/usr/lib/python3.10/site-packages/aiohttp/client_ws.py", line 143, in ping await self._writer.ping(message) File "/usr/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 676, in ping await self._send_frame(message, WSMsgType.PING) File "/usr/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 646, in _send_frame self._write(header + mask + message) File "/usr/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 663, in _write raise ConnectionResetError("Cannot write to closing transport") ConnectionResetError: Cannot write to closing transport

elad-bar commented 1 year ago

It's not the same issue, as it seems you really experiencing disconnection, please open a separate issue, In addition, please mention what version of shinobi are you using and was there a restart during that time or before the error appeared

Thanks

elad-bar commented 1 year ago

pls check v3.0.1 and update if still happens

thanks

elad-bar commented 1 year ago

Closing the issue due to lack of activity, if still relevant, please open new issue with up to date logs

Thanks