fwestenberg / reolink_dev

Home Assistant Reolink addon
MIT License
550 stars 101 forks source link

Motion sensor timeout #444

Open vmonkey opened 2 years ago

vmonkey commented 2 years ago

Describe the bug Occasionally, both of my RLC-410 5MP cameras report an "unknown" motion sensor state. I have verified it in the Synology Surveillance Station (which is used for recording the streams) that no motion indeed occurred and that the cameras were available. Cameras and the HA device are in the same network.

To Reproduce I am not able to reproduce the error 'on demand'. In HA logs, I can see

2022-02-03 18:02:55 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Kamera 2.motion_states data 2022-02-03 18:02:55 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Kamera 1.motion_states data

Expected behavior The motion sensor to be available always.

Screenshots Not applicable

Environment: Please provide useful information about your environment, like:

Additional context None.

I would be happy to provide more details - feel free to request anything needed.

cpainchaud commented 2 years ago

Hi,

This is happening to me as well a few times every day. Reolink's management HTTP service seems to be quite unstable. (video stream can still work properly). There is nothing I can do with what. I noticed that rebooting cameras once a day was keeping them stable.

DarwinData commented 2 years ago

I am getting the same error as the OP whenever I restart HA core.

skynet01 commented 2 years ago

Same here unfortunately. Any tips other than a reboot? Disable some services maybe? Don't use https?

marek787 commented 2 years ago

Same issue here with camera RLC-820A

cpainchaud commented 2 years ago

Hi, I tried to use HA's AIOHTTP's provided HTTP in recent push 0.50 to ensure they are all in same event loop. If that doesn't solve your issue then I am clueless about what is going on

vmonkey commented 2 years ago

@cpainchaud Thanks for the update. Unfortunately, half an hour after HA restart the issue is back again for me.

cpainchaud commented 2 years ago

you keep getting "Timeout fetching reolink.Kamera 1.motion_states data" error messages?

If that is the case, I just can't tell what is wrong, I am not able to reproduce that behavior at home. The only reason for a timeout would be the camera not answering fast enough (30 seconds, that tons of time already...) or some deep HA knowledge which I have am missing because what it does is really dumb : just ask the camera for its status via HTTP, no dark magic ... :/

herrfrei commented 2 years ago

I have the same issue here, also with v0.50. Yesterday I restarted HA core and the errors started to come. Two maybe interesting error messages with traceback are also in my log:

2022-03-13 00:21:07 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
2022-03-13 00:30:37 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
...
2022-03-13 01:38:37 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
2022-03-13 01:52:07 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
2022-03-13 02:00:37 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport data
2022-03-13 02:00:37 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API
2022-03-13 02:00:37 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event
    await self._base.api.get_all_motion_states()
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 608, in get_all_motion_states
    response = await self.send(body)
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 1721, in send
    raise CredentialsInvalidError()
reolink.exceptions.CredentialsInvalidError

2022-03-13 02:01:37 WARNING (MainThread) [reolink.subscription_manager] Subscription process ended with wrong HTTP status: 400: Bad Request
2022-03-13 02:01:37 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.1.69 error renewing the Reolink subscription
2022-03-13 02:02:07 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
2022-03-13 02:03:37 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
...
2022-03-13 05:39:07 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
2022-03-13 05:59:07 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
2022-03-13 06:03:37 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Motion states could not be queried from API
2022-03-13 06:03:37 ERROR (MainThread) [custom_components.reolink_dev.binary_sensor] Traceback (most recent call last):
  File "/config/custom_components/reolink_dev/binary_sensor.py", line 122, in handle_event
    await self._base.api.get_all_motion_states()
  File "/usr/local/lib/python3.9/site-packages/reolink/camera_api.py", line 609, in get_all_motion_states
    json_data = json.loads(response)
  File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2022-03-13 06:04:37 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
2022-03-13 06:27:07 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Carport.motion_states data
Nadav-K commented 2 years ago

same here...

2022-03-26 21:11:48 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Front door.motion_states data 2022-03-26 22:00:18 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Front door.motion_states data 2022-03-26 23:11:48 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Front door.motion_states data 2022-03-26 23:27:18 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Front door.motion_states data 2022-03-26 23:37:48 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.Front door.motion_states data

jone9618 commented 2 years ago

For what it is worth I am getting the same errors appearing in my logs, despite rebooting my cameras every 24 hours. Error returns no matter how many times I restart Core.

DarwinData commented 2 years ago

Same error here with RLC-410W, Firmware: v3.0.0.136_20121102

2022-04-08 06:54:54 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.East Camera.motion_states data

gilbert-grape commented 2 years ago

same here. I have a very stable lan/network with no lag. My 2 RLC-811A cams are connected wired by LAN cable. Even with a 1GB network cable I have 10 days a day on both cams these timeouts.

skynet01 commented 2 years ago

Same cameras as @gilbert-grape on lan connection and just like him random timeouts. I know it's probably really hard to trace but it sounds like everyone experiences this

vmonkey commented 2 years ago

@cpainchaud I still have the issue- it occurs occasionally and can not be avoided with increased timeout. Maybe, would it be possible to retry a timed out request once more? If the reason is an unstable reolink API, this might eliminate most of the cases.

gilbert-grape commented 2 years ago

Thats a good idea. What about a number in the settings next the timeout in seconds with how many retry it should do?

skynet01 commented 2 years ago

That's great idea, you can also increase the time-out dynamically? So at first try it after 2 seconds then 5 then 15 etc.

angrycatmeowmeow commented 2 years ago

jumping on the bandwagon with the same in my logs `This error originated from a custom integration.

Logger: custom_components.reolink_dev Source: helpers/update_coordinator.py:196 Integration: Reolink IP camera (documentation, issues) First occurred: 18:47:22 (6 occurrences) Last logged: 19:14:54

Timeout fetching reolink.Garage East.motion_states data Timeout fetching reolink.Crouton Cam.motion_states data Timeout fetching reolink.Garage West.motion_states data Timeout fetching reolink.Lounge.motion_states data`

shyney7 commented 2 years ago

Have the same problem when my automation is triggered to record a video. Video is recorded but I get Timeout fetching reolink.ReolinkE1Z-Flur.motion_states data in the logs.

redpizza69 commented 2 years ago

I have hundreds of these errors in my log too 2022-08-05 03:27:12 ERROR (MainThread) [custom_components.reolink_dev] Timeout fetching reolink.frontdoor.motion_states data

Electronlibre2012 commented 2 years ago

Hello, same boat, but if i look in my nvr410 history,there is "grey" times in the timeline for 1 min every 2 hours and when sensors have a lot of activity, for example when its winding and trees in my garden are moving a lot, that seem to spam a lot the motions sensor and the nvr crash.

i have send my logs to Reolink and they reply that i have to remove my Nvr from HA, and check my network, and even lower the bit rate of my cam...

i have a Nvr410 kit with 4 D520 cams and even that is they are only 5Mp quality, they said my bandwith is not enough...

i have a fresh Lan network with Cat6a cable and i have verify all my connexions with a tester, and succeed to have a 2,5Gb Lan on several points in my house. I have 24 outlet Rj45, and most of them are on 1Gb, some works at 2,5Gb with my switch 2,5Gb (only 5 Rj45).

For my camera they are directly connected to my NVR with the patch cable of 10 meter provide in the kit. For the 5th and the 6th i have bought a cat5e 15 meters long. I think Cat5e is enought for 7000Kbits of data transfert...hope so.

The only thing i notice in the log was the packets dropped in the Wan port of the NVr. No dropped packets in the lan side of the NVR,no errors packets.

The dropped packets are 67826, seems to be huge...dont know if its to ha when they are dropped...

Is someone has a NVR410 and see grey period in the timeline please ? (under APP android or reolink APP PC or webserver)

albanleandri commented 1 year ago

Hello folks. Is there any news on this?

I do also have the issue with the v 0.57 of this repo, and latest HA version (Home Assistant 2022.12.1, Supervisor 2022.11.2, Operating System 9.3, Frontend 20221208.0 - latest)

This error originated from a custom integration.

Logger: custom_components.reolink_dev
Source: helpers/update_coordinator.py:168
Integration: Reolink IP camera (documentation, issues)
First occurred: 2:46:02 PM (1 occurrences)
Last logged: 2:46:02 PM

Timeout fetching reolink.Reolink - RLC410 - 1.motion_states data

I would rather not go for the forked repo linked just above my message as this one as many more contributors.

skynet01 commented 1 year ago

This repo hasn't been updated in 3 month 🙄 the fork you don't want to try receives updates often. And yes it has this specific issue fixed.

angrycatmeowmeow commented 1 year ago

Which fork are we switching to? I see 98 of them.

shyney7 commented 1 year ago

Which fork are we switching to? I see 98 of them.

https://github.com/JimStar/reolink_cctv