reolink_dev icon indicating copy to clipboard operation
reolink_dev copied to clipboard

Motion detection not work

Open trancer86 opened this issue 4 years ago • 32 comments

Motion detection on Reolink E1 Zoom not work in HA.I used HA locally and the sensor does not work. What could be the problem. Version on HA:supervisor-2021.09. 0 Reolink E1 Zoom: Hardware N. IPC_515BSD6 Config Version v3.0.0.0 Firmware Version v3.0.0.247_21040708

Logger: homeassistant.components.camera Source: components/camera/init.py:465 Integration: Camera (documentation, issues) First occurred: 9:19:52 PM (1 occurrences) Last logged: 9:19:52 PM

The camera entity camera.camera does not support requesting width and height, please open an issue with the integration author

WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration reolink_dev which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

IMG_20210913_203707

trancer86 avatar Sep 13 '21 16:09 trancer86

can you specify your firmware version and also bring output of this URL:

http://your_camera_ip/cgi-bin/api.cgi?cmd=GetMdState&rs=&user=admin&password=blablah

cpainchaud avatar Sep 21 '21 09:09 cpainchaud

can you specify your firmware version and also bring output of this URL:

http://your_camera_ip/cgi-bin/api.cgi?cmd=GetMdState&rs=&user=admin&password=blablah

I have the same problem with the RLC-410 5mp camera, firmware version v3.0.0.136_20121100 Heres the output of what you asked for. [ { "cmd" : "GetMdState", "code" : 0, "value" : { "state" : 0 } } ]

Eddie46848 avatar Sep 21 '21 15:09 Eddie46848

Motion detection on Reolink E1 Zoom not work in HA.I used HA locally and the sensor does not work. What could be the problem. Version on HA:supervisor-2021.09. 0 Reolink E1 Zoom: Hardware N. IPC_515BSD6 Config Version v3.0.0.0 Firmware Version v3.0.0.247_21040708

Logger: homeassistant.components.camera Source: components/camera/init.py:465 Integration: Camera (documentation, issues) First occurred: 9:19:52 PM (1 occurrences) Last logged: 9:19:52 PM

The camera entity camera.camera does not support requesting width and height, please open an issue with the integration author

WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration reolink_dev which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

IMG_20210913_203707

Hi guys. I'm sorry to answer now. and for my bad english (i use google translate) First of all thanks to fwestenberg for the intellectual work to bring this integration to us! As written in the installation instructions for this integration, in order for the motion sensor to work properly, you must be able to connect locally to the HA. If you have set up Duckdns for external connection you will not be able to connect locally to HA (at least for me it was so) You need to set up a reverse proxy connection. I used video tutorials on how to configure the proxy server and everything went exactly as it should🙂. The sensor now works perfectly and can be used for automation.

trancer86 avatar Sep 21 '21 16:09 trancer86

Weirdly I got motion detection working again, it always worked fine up until a couple of months ago. I just uninstalled it from hacs and started from scratch and it started detecting motion again. Still get malformed user input when trying to change settings. I just configure through .storage.

Eddie46848 avatar Sep 21 '21 18:09 Eddie46848

@Eddie46848 I suspect it's due to the refresh time which Reolink has changed, do you have the possibility to move in front of the camera and try to get the output of http://your_camera_ip/cgi-bin/api.cgi?cmd=GetMdState live ? it should show "value" : { "state" : 1 } } instead of 0 . If it's 1 then please configure HA with a scan interval of less than 5 seconds:

reolink_dev: scan_interval: 2

cpainchaud avatar Sep 22 '21 08:09 cpainchaud

I have similar issue - related to subscription on NVR cams i believe. I have had some limited short term success on reinstalls, but soon the issue again. I’m running latest release versions of everything. Partial logs below show good on individual cams but none of the NVR cams.

2021-09-26 15:29:18 INFO (MainThread) [custom_components.reolink_dev.base] Host 192.168.5.47 subscribed successfully to webhook http://192.168.1.100:8123/api/webhook/62157eb528c986d1183ae176eb2bdd280af60c7a4748d80865d32dc7dbe94d31 2021-09-26 15:29:19 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.5.8 error renewing the Reolink subscription 2021-09-26 15:29:19 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.5.8 error renewing the Reolink subscription

dave-parsons avatar Sep 26 '21 22:09 dave-parsons

@Eddie46848 I suspect it's due to the refresh time which Reolink has changed, do you have the possibility to move in front of the camera and try to get the output of http://your_camera_ip/cgi-bin/api.cgi?cmd=GetMdState live ? it should show "value" : { "state" : 1 } } instead of 0 . If it's 1 then please configure HA with a scan interval of less than 5 seconds:

reolink_dev: scan_interval: 2

Hi goodday, I used the url and I got the state to be 1 when motion was detected, and zero when none was detected. However, I am using the rlc-410w and the binary sensor for motion detection is not updating. Additionally, i do not see an option for setting the scan interval but there is an option for timeout and "motion sensor of delay". Any assistance would be appreciated.

Note: I have uninstalled and reinstalled the addon from HACS and the problem still persists.

StephenGhool avatar Sep 29 '21 12:09 StephenGhool

@trancer86 : remember that E1 model is not supported by this lib, yet please try the latest version again. (@fwestenberg if you could provide some background to this limitation so it can be documented for future reference?)

@StephenGhool : any error message in your logs?

cpainchaud avatar Sep 30 '21 07:09 cpainchaud

@Eddie46848 I suspect it's due to the refresh time which Reolink has changed, do you have the possibility to move in front of the camera and try to get the output of http://your_camera_ip/cgi-bin/api.cgi?cmd=GetMdState live ? it should show "value" : { "state" : 1 } } instead of 0 . If it's 1 then please configure HA with a scan interval of less than 5 seconds:

reolink_dev: scan_interval: 2

thank you all for this integration!

it seems also my case with RLC-410. pooling that URL with my laptop I see state changing from 0 to 1. Which is the default value for scan_interval? so this integration is polling the reolink camera to check if a motion has been detected? 2 is the value you suggested? why not having 2 as default?

marcob79 avatar Sep 30 '21 13:09 marcob79

@cpainchaud I have reviewed the logs and I am not seeing anything related to the reolink camera. So no there are no error messages in the logs

StephenGhool avatar Sep 30 '21 18:09 StephenGhool

I’m seeing an issue with my RLC-520A. I’m getting person detection via the app but with the HA integration it’s not detection a person in the person motion. Regular motion is working. Other switches I saw that do not seem to work are IR sensor on/off and the push notifications. I’m not sure if my camera is compatible with these options. Be able to get notified via HA for person detection would be great. I’m using DOODs currently but get false alerts.

rysm83 avatar Oct 05 '21 22:10 rysm83

RLC-510WA too, motion, person or vehicle is not detected.

Siwus90 avatar Oct 07 '21 17:10 Siwus90

For me, the latest working version is 0.22, the following versions have removed support for:

  1. RLN8-410 (v3.0.0.130_21060706)
  • in the case of an NVR, motion sensors are not read.
  1. RLC-810A (v3.1.0.598_21091303)
  • In the case of IPC, error 502 is dropped during courtship
  • this is a beta firmware, so I would understand, but with version 0.22 the camera works fine.

leroyloren avatar Oct 08 '21 08:10 leroyloren

Hi, I have the same issue of motion sensors being unavailable.

Using the URL, the state changes from 0 to 1 when motion is detected. http://your_camera_ip/cgi-bin/api.cgi?cmd=GetMdState&rs=&user=admin&password=blablah

Here is my log snippet:

2021-10-11 20:46:15 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.0.180 subscription failed to its webhook, base object state will to NotAvailable 2021-10-11 20:46:15 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.0.180 error renewing the Reolink subscription 2021-10-11 20:46:15 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.0.180 error renewing the Reolink subscription 2021-10-11 20:46:16 WARNING (MainThread) [custom_components.reolink_dev.sensor] Search command provided a file record without a name: {'EndTime': {'day': 11, 'hour': 19, 'min': 16, 'mon': 10, 'sec': 53, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 9, 'min': 14, 'mon': 10, 'sec': 6, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 19, 'min': 14, 'mon': 10, 'sec': 6, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '7340032', 'type': 'sub', 'width': 0} 2021-10-11 20:46:16 WARNING (MainThread) [custom_components.reolink_dev.sensor] Search command provided a file record without a name: {'EndTime': {'day': 11, 'hour': 19, 'min': 16, 'mon': 10, 'sec': 52, 'year': 2021}, 'PlaybackTime': {'day': 11, 'hour': 9, 'min': 14, 'mon': 10, 'sec': 5, 'year': 2021}, 'StartTime': {'day': 11, 'hour': 19, 'min': 14, 'mon': 10, 'sec': 5, 'year': 2021}, 'frameRate': 0, 'height': 0, 'size': '133693440', 'type': 'main', 'width': 0} 2021-10-11 20:47:15 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.0.180 error renewing the Reolink subscription 2021-10-11 20:47:15 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.0.180 error renewing the Reolink subscription 2021-10-11 20:48:15 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.0.180 error renewing the Reolink subscription 2021-10-11 20:48:15 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.0.180 error renewing the Reolink subscription 2021-10-11 20:49:15 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.0.180 error renewing the Reolink subscription 2021-10-11 20:49:15 ERROR (MainThread) [custom_components.reolink_dev.base] Host 192.168.0.180 error renewing the Reolink subscription

zerocritical avatar Oct 11 '21 09:10 zerocritical

Same problem here with Reolink Dev 0.26 and NVR RLN8-410 running firmware 3.0.0.130. Everything looks fine, but the sensor never reports any motion. However, if I add the sensors manually in the config like this they actually work perfectly:

binary_sensor: 
  - platform: rest
    resource: http://10.0.1.15/api.cgi?cmd=GetMdState&channel=0&user=hass&password=XXXX
    name: cam01_motion
    device_class: motion
    value_template: "{{ value_json[0].value.state }}"
    scan_interval: 2
  - platform: rest
    resource: http://10.0.1.15/api.cgi?cmd=GetAiState&channel=0&user=hass&password=XXXX
    name: cam01_is_people
    device_class: motion
    value_template: "{{ value_json[0].value.people.alarm_state }}"
    scan_interval: 2

Just out curiosity, is adding them like this the same thing as doing it via the integration? Or do they use different technologies?

Also no errors from reolink in the logs. I did find these things though that might of interest:

2021-10-14 23:01:34 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.217 seconds (success: True)
2021-10-14 23:01:34 DEBUG (MainThread) [reolink.camera_api] send()= HTTP Request params ={'cmd': 'Snap', 'channel': 0, 'token': 'c971590e8a592d4'}
2021-10-14 23:01:34 DEBUG (MainThread) [reolink.camera_api] send HTTP Response status=200
2021-10-14 23:01:34 DEBUG (MainThread) [reolink.camera_api.data] send() HTTP Response data scrapped because it's too large
2021-10-14 23:01:44 DEBUG (MainThread) [reolink.camera_api] send()= HTTP Request params ={'cmd': 'Snap', 'channel': 0, 'token': 'c971590e8a592d4'}

And this:

"value" : {
"Push" : {
"enable" : 1,
"schedule" : {
"channel" : 0,
"table" : {
"AI_PEOPLE" : "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"AI_VEHICLE" : "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"MD" : "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
}
}
}
}
]

AI_PEOPLE being set to 1 sounds interesting?

MacL3an avatar Oct 14 '21 21:10 MacL3an

When you make your own binary_sensor with scan interval=2 it means that each sensor will hit the camera with an API call every 2 seconds so 2 sensors = 2 calls every 2 seconds. That could take CPU of the camera down, especially with newest firmware which forces you to use SSL.

This integration relies on getting the camera to send its updates by calling a webhook on HA, if you get no update it means that the camera is not able to hit the webhook. If you you get no webhook notification then please check that your internal URL is setup correctly and don't use DNS names but IP address of HA.

cpainchaud avatar Oct 14 '21 21:10 cpainchaud

I get webhook error too in my logs with the integration. I have checked i use internal IP URL with http:// and disabled https://

Anything else i should be trying?

Aslo for the manual sensor entries, motion detection works but throws this error for person detection: 2021-10-15 11:23:25 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'people' when rendering '{{ value_json[0].value.people.alarm_state }}'

My cameras are 820A. Any idea for that?

zerocritical avatar Oct 15 '21 00:10 zerocritical

When you make your own binary_sensor with scan interval=2 it means that each sensor will hit the camera with an API call every 2 seconds so 2 sensors = 2 calls every 2 seconds. That could take CPU of the camera down, especially with newest firmware which forces you to use SSL.

This integration relies on getting the camera to send its updates by calling a webhook on HA, if you get no update it means that the camera is not able to hit the webhook. If you you get no webhook notification then please check that your internal URL is setup correctly and don't use DNS names but IP address of HA.

Finally it works! Thank you @cpainchaud. Problem was I used the mDNS name and not the IP address as the Internal URL. I created a PR to clarify things I have been stuck with when setting up this integration. Now I can delete the polling based sensors.

MacL3an avatar Oct 15 '21 08:10 MacL3an

What webhook error @zerocritical ?

Please enable more logging:

logger:
  default: warning
  logs:
    custom_components.reolink_dev: debug
    custom_components.reolink_dev.base.data: warning
    reolink: debug

cpainchaud avatar Oct 15 '21 10:10 cpainchaud

Thanks for version 0.27 everything works fine with the beta firmware (v3.1.0.598_21091303)

Does anyone have experience if the motion detection response is faster directly from the camera, or from the NVR, or is it the same?

leroyloren avatar Oct 15 '21 22:10 leroyloren

i checked in home assistant logs and the subscription seems fine. I run a tcpdump while triggering a motion detection on my RLC 410, and I'm able to see POST sent from my camera to hass, but nothing in the logs in the same timeframe

image

@cpainchaud anything else that I can check or collect?

marcob79 avatar Oct 19 '21 17:10 marcob79

@marcob79 logs should be showing that the hook was called at the very least, if not then I am clueless

cpainchaud avatar Oct 25 '21 08:10 cpainchaud

I will test again and collect full fresh debug log with latest version and related TCP dump on my home assistant raspberry and raise a new ticket. Maybe the problem is a bit different from the one related to this issue

marcob79 avatar Oct 25 '21 19:10 marcob79

I'm seeing the same issue. Webhook URL sent to camera is:

http://192.168.0.38/api/webhook/7ff45542a34e367c4614694f95ae41474709bcbc82d35635b18e09bb108c702b

But when the camera sends Motion Push it uses:

/api/webhook/7a066a8b7792f23e87346b5eb7dd5db49532f7357d3687dd1231a83838283b50

The webhook ID is completely different and thus Home Assistant will simply disregard it.

image

image

Redferne avatar Oct 26 '21 10:10 Redferne

Did you make this test after HA restart? because for 15 minutes after resstart, this behavior is normal because Camera doesn't know the webhook has changed and keeps hitting the old one (unregister function is not working and Reolink doesn't care at all)

cpainchaud avatar Oct 26 '21 11:10 cpainchaud

Yes. It was after restart. So I left it running and it hit the correct webhook once. But it got stuck in Motion Detected state. Camera never sent a "IsMotion": "false" and the 60s timeout did not trigger.

image

Redferne avatar Oct 26 '21 13:10 Redferne

I can confirm I have the exact same problem with the clear callback not being called as expected. Setup as described in my ticket here and now running v0.33.

image

When looking in the logbook it doesn't show any changes the last 20 mins, but I have gotten like 5 push notifs from the Reolink app: image

I have emailed reolink about this.

MacL3an avatar Oct 26 '21 19:10 MacL3an

I also emailed Reolink about this. But they are less than helpful, stating there is no API/SDK. And that motion push notification is only supported in the App, which is utter bs.

Redferne avatar Nov 02 '21 07:11 Redferne

I did actually get a more useful reply when I told him this integration uses the ONVIF protocol (which I assume is true?):

He says the our ONVIF has not supported letting the NVR and IPC make "motion clear" ONVIF callback. But we are now developing this aspect and it may take about 2 months to realize it. 

Sorry about that but it will come true in about 2 months.

MacL3an avatar Nov 02 '21 08:11 MacL3an

2 months ... ffs ... let me check why the code 'timeout self detection' doesn't work

cpainchaud avatar Nov 02 '21 08:11 cpainchaud