elad-bar / DahuaVTO2MQTT

Listens to events from Dahua VTO unit and publishes them via MQTT Message
103 stars 39 forks source link

Doesn't recover after doorbell loses power/reboots #19

Closed ttcole1254 closed 3 years ago

ttcole1254 commented 3 years ago

I'm not sure if this can be fixed, but currently when power is cut to the doorbell or it reboots, the script will read "ERROR main server closed the connection" and "WARNING asyncio socket.send() raised exception." It will keep repeating the second warning until the docker container is reset, even if the doorbell comes back online. This causes the code to fail weekly when the doorbell does its reboot. Is there a way to have this fail gracefully, and re-attempt the connection? Otherwise everything works perfectly, great job with this!

rostikk80 commented 3 years ago

Same here. Since the move to python, I have started getting WARNING asyncio socket.send() raised exception in the log. Would it be possible to fix this? Would also be great to implement some kind of a health check.

arcidodo commented 3 years ago

my doorbell lose connection after one hour this is the output in the addon of home assistant:

Traceback (most recent call last): File "/usr/lib/python3.8/asyncio/selector_events.py", line 860, in _read_ready__data_received self._protocol.data_received(data) File "/app/DahuaVTO.py", line 119, in data_received message_id = message.get("id") AttributeError: 'NoneType' object has no attribute 'get' 2021-01-07 19:55:08,769 ERROR main server closed the connection 2021-01-07 19:56:03,619 INFO main Keep alive 2021-01-07 19:56:58,619 INFO main Keep alive 2021-01-07 19:57:53,620 INFO main Keep alive 2021-01-07 19:58:48,621 INFO main Keep alive 2021-01-07 19:59:43,621 INFO main Keep alive 2021-01-07 19:59:43,622 WARNING asyncio socket.send() raised exception. 2021-01-07 20:00:38,622 INFO main Keep alive 2021-01-07 20:00:38,623 WARNING asyncio socket.send() raised exception. 2021-01-07 20:01:33,623 INFO main Keep alive 2021-01-07 20:01:33,623 WARNING asyncio socket.send() raised exception.

Spartan-II-117 commented 3 years ago

I have found a hackish way to get this accomplished. as i am having the same issue. I submitted a PR to hopefully get it working.

markverg commented 3 years ago

thanks, having the same issue here image

you can see the doorbell reboots (don't know why), after that it's only giving this error and doesn't recover. Thanks a lot for that PR @Spartan-II-117, looking forward to it!

elad-bar commented 3 years ago

I will check it over the weekend

Warmaker-be commented 3 years ago

@elad-bar the problem isn't solved with your update. I'm still receiving 'WARNING asyncio socket.send() raised exception.' with version 1.0.12. this is after the mandatory mainentance restart of the VTO. image

tom-winkler commented 3 years ago

Maybe consider crashing the service if it cannot recover on its own - this would enable my homeassistant plugin to restart.