core: When Amcrest binary sensor goes offline sometimes it never reconnects

Home Assistant release with the issue:

0.101.2

Last working Home Assistant release (if known):

0.100.2 Operating environment (Hass.io/Docker/Windows/etc.):

venv

Integration:

amcrest https://www.home-assistant.io/integrations/amcrest/

Description of problem:

When the camera becomes unavailable due to some connection error sometimes it never reconnects and I have to restart HA for it to reconnect.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

amcrest:
 - host: 192.168.1.42
   port: 1025
   username: !secret amcrest_user
   password: !secret amcrest_pass
   name: "Den Camera"
   resolution: high
   stream_source: rtsp
   binary_sensors:
   - motion_detected

Traceback (if applicable):

2019-11-04 13:21:07 ERROR (SyncWorker_4) [homeassistant.components.amcrest] Den Camera camera offline: Too many errors
2019-11-04 13:21:07 ERROR (SyncWorker_4) [homeassistant.components.amcrest.binary_sensor] Could not update Den Camera Motion Detected binary sensor due to error: CommError
2019-11-04 13:22:11 WARNING (SyncWorker_0) [amcrest.http] <AMC000Y1_4ANYP5:SERIAL> Trying again due to error: ReadTimeout(ReadTimeoutError("HTTPConnectionPool(host='192.168.1.42', port=1025): Read timed out. (read timeout=3.05)",),)

Additional information: After the traceback no attempt to reconnect is made. Possibly caused by #26630. I never had this issue until I upgraded to 0.101.2 Previously the camera would go offline and less than a minute later it will come back. Now it has been unavailable for a long time.

image

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 30 (17 by maintainers)

Most upvoted comments

Thank you @pnbruckner. Issue is resolved! Working great again.

I installed 0.104.2 (which has PR 26630 already reverted) and amcrest 1.5.6 and did some tests.

I could switch the camera on and off and home-assistant reconnected correctly. I never was able to reproduce the problem of the camera suddenly disconnecting randomly but I will keep it turned on for a couple of days to test if it disconnects, just in case.

In any case, this is good news, and so far, everything works perfectly here. Thanks, @pnbruckner .

@pnbruckner Thanks for looking into it. I’ve been running HA 0.103.6 with amcrest v1.5.4 and PR 26630 applied for the last ~40 hours (looking at the stream from HA each now and then and also generating FTP transfers from the camera due to movements detection) and so far I couldn’t reproduce any problem, so I’m glad you could have a look.

I’ll test amcrest v1.5.5 (with PR 26630 reverted in HA) during this week (with a little luck, this afternoon or tomorrow afternoon) and let you know the results.