Hello,
I have set up a Reolink RLC-520A in home assistant (2023.4.2) with the core reolink integration. I have an automation set up to capture images when motion is detected. The issue is that the motion entirty in HA seems to have a very long latency i.e. it’s state changes to “On” around 30 seconds after motion is detected and “Off” around 30 seconds after the motion ends. The result is that all the images that are captured are from after the motion event.
I believe the camera supports ONVIF push notifications so I would expect the the entity to change states much more quickly.
Where do I begin debugging this? Posted the automation below in case I have made any obvious errors:
alias: Notifications for Motion Detection
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.cam_motion
to: "on"
for:
hours: 0
minutes: 0
seconds: 0
action:
- variables:
filename: cam_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg
- service: camera.snapshot
target:
entity_id: camera.cam_snapshots
data:
filename: /media/cams/{{ filename }}
- service: notify.mobile_app_phone
data:
data:
image: /media/local/cams/{{ filename }}
ttl: 0
priority: high
channel: Alert
importance: high
vibrationPattern: 100, 1000, 100, 1000, 100, 1000, 100, 1000, 100, 1000
clickAction: entityId:camera.cam_sub
tag: motion
title: motion detected
message: Motion detected at {{ now().strftime("%Y%m%d-%H%M%S") }}
- repeat:
while:
- condition: state
entity_id: binary_sensor.cam_motion
state: "on"
enabled: true
sequence:
- variables:
filename: cam_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg
- service: camera.snapshot
target:
entity_id: camera.cam_snapshots
data:
filename: /media/cams/{{ filename }}
- service: notify.email
data:
message: Motion detected
data:
images:
- /media/cams/{{ filename }}
html: |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Motion detected</title>
<style type="text/css">
h1,h2,h3,h4,h5,h6 {
font-family:Arial,sans-serif;
}
</style>
</head>
<body><img style="width: 100%; max-width: 640px;" alt="Image from camera" src="cid:{{ filename }}" /></body>
</html>
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
mode: single
Thanks!