Closed vegedb closed 1 year ago
I am also consistently experiencing significant delay on the motion detection both at the start and end (.i.e. starts well after motion detected by reolink, and ends well after motion had ended in reolink). Happy to provide more info to help. (Home Assistant 2023.5.0, Reolink RLC520A)
Hey there @starkillerog, mind taking a look at this issue as it has been labeled with an integration (reolink
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
reolink documentation reolink source (message by IssueLinks)
@vegedb did you check if the camera time and your HomeAssistant time are actually synchronized (there is no delay between the time reported by the camera and the HomeAssistant time)?
Could you enable debug logging under Settings
->Devices & Services
->Reolink integration overflow menu (three vertical dots)
->Enable debug logging
,
Then restart Home Assitant, wait for 5 minutes in which you make some motion events in front of the camera, disable debug logging and post the log here.
If you appreciate the reolink integration and want to support its development, please consider sponsering the upstream library or purchase Reolink products through this affiliate link.
@vegedb did you check if the camera time and your HomeAssistant time are actually synchronized (there is no delay between the time reported by the camera and the HomeAssistant time)?
Yes side by side footage of reolink stream and stream using home assistant entity are the same by the second.
Also the time sensor of home assistant is the same as reolink settings page.
Could you enable debug logging under
Settings
->Devices & Services
->Reolink integration overflow menu (three vertical dots)
->Enable debug logging
, Then restart Home Assitant, wait for 5 minutes in which you make some motion events in front of the camera, disable debug logging and post the log here.
@vegedb In the log it shows the ONVIF events are comming in fine and there is only a few ms between the moment the webhook is called and it is fully porcessed.
The log shows the first motion+people event came in at 2023-05-10 14:47:56.345 (and was processed at 2023-05-10 14:47:56.350, so 5 ms after it came in). At what time does the Reolink app show this event? And at what time does the history component of HomeAssistant show this event?
Moreover, when looking at the binary sensors in HomeAssistant on your phone (live), do you also observe they turn on 10 seconds delayed when walking/running in the view of the camera (suddenly make a motion event on the camera)? Basically is it only the history/timestamp that is wrong, or is there a actual 10 seconds delay?
@starkillerOG
The log shows the first motion+people event came in at 2023-05-10 14:47:56.345 (and was processed at 2023-05-10 14:47:56.350, so 5 ms after it came in). At what time does the Reolink app show this event? And at what time does the history component of HomeAssistant show this event?
14:47:47 according to the reolink app. That's the 10 secs.
Basically is it only the history/timestamp that is wrong, or is there a actual 10 seconds delay?
Actual 10 secs delay.
Also I've made an issue on https://github.com/koush/scrypted/discussions/770 related to the problem. He says "Reolink may be slow to deliver motion events." Seems like its pretty much confirmed its the device's end that's the problem. Do you think so? If yes, how could I fix it or is this a reolink widespread problem only fixed by their firmware.
@vegedb in that case it is indeed the camera that is just beeing slow to push the message, nothing I can really do about it.
You could request support from Reolink firmware engineers here: https://support.reolink.com/hc/en-us/requests/new/. Please explain the ONVIF WS base notification event comes in at the webhook 10 seconds delayed and ask them to look into the firmware of your camera.
I think you are using the Reolink Doorbell PoE right? Do you have it connected to something else then HomeAssistant?
I have a PoE doorbell too, but I do not experiance any delay with my doorbell.
I have a PoE doorbell too, but I do not experiance any delay with my doorbell.
Damn, this will make me feel betrayed lol.
Do you have it connected to something else then HomeAssistant?
Scrypted homekit. Are you using it?
@vegedb No I am only using HomeAssistant.
Would it be possible to turn off/shutdown Scrypted, HomeKit and HomeAssistant. Then power cycle the doorbell, then only start HomeAssistant and see if you still experiance the 10 second delay? (As a test).
Maybe the doorbell is not able to handle 3 ONVIF connections at the same time and HomeAssistant, scrypted and homekit are fighting for the connection?
Would it be possible to turn off/shutdown Scrypted, HomeKit and HomeAssistant. Then power cycle the doorbell, then only start HomeAssistant and see if you still experiance the 10 second delay? (As a test).
Maybe the doorbell is not able to handle 3 ONVIF connections at the same time and HomeAssistant, scrypted and homekit are fighting for the connection?
When I recall back when I installed it, it was only home assistant, no scrypted. And it was already showing 10 secs late.
However I'll test it again with this new firmware. I'll get back to you on this when I do it.
Out of curiosity is it possible to do polling? When using the cameras in built FTP and email notifications there is no delay at all so if there's some non ONVIF way of getting the motion detection state that could work better in this case.
To answer my own question you can make requests to the camera directly:
curl --header "Content-Type: application/json" \
--request POST \
-k 'https://192.168.1.88/api.cgi?user=admin&password=yourpassword' \
--data '[{"cmd":"GetMdState","action":1,"param":{"channel":0}}]'
Which responds:
[
{
"cmd" : "GetMdState",
"code" : 0,
"value" : {
"state" : 0
}
}
]
state
is 0
for no motion and 1
for motion and seems to not have any lag (from basic testing running the command in a loop while wandering in front of the camera).
Is that something that could be added to the integration? An option to do polling if ONVIF does not work well?
@rhyst Polling for motion+AI people, vehicle, face, pet and visitor is already implemented in the integration and happens every 60 seconds. However with polling you will always have a delay up to the polling intervall. I am working on implementing ONVIF pull point long polling, see discussion here: https://github.com/home-assistant/core/pull/92837
@vegedb do you perhaps have the internet/WAN blocked on your camera? Just wondering if that might be causing the delay internally in the camera, since the camera might first try to push the notification to the Reolink cloud, timeout, and then push locally through ONVIF.....
Especially since I do not see any delay on my doorbell (I am currently using a NVR in between though).
The PR sounds like it would be perfect if it was possible to manually enable it in this case where the ONVIF events "work" but are less reliable than long polling.
I also did have the push notifications enabled despite not setting up reolink cloud so I will disable that and see if it improves.
@vegedb I saw in the log that your doorbell is reporting some weird device information:
{
"cmd" : "GetDevInfo",
"code" : 0,
"value" : {
"DevInfo" : {
"B485" : 0,
"IOInputNum" : 0,
"IOOutputNum" : 0,
"audioNum" : 1,
"buildDay" : "build 23022302",
"cfgVer" : "v3.0.0.0",
"channelNum" : 1,
"detail" : "DB_00M5MP_PS10E1W0110000000",
"diskNum" : 1,
"exactType" : "IPC",
"firmVer" : "v3.0.0.2033_23041302",
"frameworkVer" : 1,
"hardVer" : "DB_00M5MP_P",
"model" : "Reolink",
"name" : "t",
"pakSuffix" : "pak,paks",
"serial" : "0000000000000",
"type" : "BELL",
"wifi" : 0
}
}
},
The model only states "Reolink" while it schould state (and in my camera does state): "Reolink Video Doorbell PoE"
The name of the camera is also only "t" which seems odd (although you could have set it as such).
Moreover the hardware version states "DB_00M5MP_P" which is also weird, the only PoE doorbell that is out (to my knoladge) is DB_566128M5MP_P
So I would advice to do a full reset of the camera and see if that fixes anything. Otherwise maybe contact reolink support and ask for assistance, maybe they want to do a RMA and give you a replacement, or at least give you some troubleshooting steps.
Now that a third backup in the form off ONVIF long polling is also available (see PR https://github.com/home-assistant/core/pull/94770) starting from HA 2023.7 which will be released July 5th 2023, I think we can close this.
If you still experiance problems on HA 2023.7, please let me know.
If you appreciate the reolink integration and want to support its development, please consider sponsering the upstream library or purchase Reolink products through this affiliate link.
The problem
Home Assistant: 07:08:49
Reolink App: 07:08:38
Details
As you can see home assistant shows 07:08:49 while the reolink app shows 07:08:38 when motion starts. This 10 second delay is consistent with ALL motion clips.
Reolink camera only uses http. ONVIF and RTPS all enabled.
What version of Home Assistant Core has the issue?
Home Assistant 2023.5.0