Camera ONVIF motion binary sensor doesn't clear

I have a Hikvision DS-2CD2087G2-L(U) and have ONVIF enabled.
The camera has been setup to do intrusion detection and inform the surveillance center.

(EDIT: new users can only post one embedded image, so see all three screenshots in one below…)

In Home Assistant there’s a binary sensor called binary_sensor.myfielddetector1_field_detection and that goes from clear to detected when there is intrusion detected, but only once…
It never resets:

I have one automation for testing, to light a Hue light bulb when motion is detected.
I can only get it to reset if I reboot the camera or Home Assistant.
What am I doing wrong?

What happens if you use Developer Tools / Services, pick the “Home Assistant Core Integration: Update entity” service and choose your binary_sensor.myfielddetector1_field_detection entity? Does it reset to Clear?

Unfortunately that doesn’t reset it:


I should add that one of the other actions the camera does is enable its flashlight.
And that triggers every time, so I don’t think it’s the camera that is stuck.

It seems that someting keeps triggering this entity:

When I refresh the page, that second line just gets updated with a few seconds.
Is it HA that does this?

I have used ONVIF Device Manager (ONVIF Device Manager download | SourceForge.net) to check what the camera is sending and I see both when a person gets detected and when the detection stops a few minutes later:


So it is HA that isn’t recognizing that second message:
image

Should I post a bug report?

EDIT: one thing I noticed is that the time is off by an hour. It doesn’t account for daylight saving time.
The camera has been setup to work with DST:



But the logs in ONVIF Device Manager don’t seem to take DST into account.
Could this be an issue?

I just picked up an EZVIZ doorbell camera and seeing the same thing with the ONVIF integration. Any help would be greatly appreciated!

Interesting, I disabled daylight savings on the camera and adjusted the timezone. After restarting hass it seemsto work fine.

Any suggestions how to fix this?

Hi Septor, thanks for experimenting.
Just to be sure, after you disable DST and manually switch the timezone, you have Home Assistant correctly activate and deactivate the MyFieldDetector entity when a person is detected by the camera?

I’m still not sure if this is an issue with HA or with the camera.

Yup, I have had it activating/clearing properly since I changed DST. This is likely a HASS issue since other apps don’t seem to have issues.

Has anyone got a solution for this?
I’d rather not disable DST in my camera as then the time on the videostream is wrong.
EDIT: and I tried disabling DST and it didn’t solve anything.

Hello guys!

I did a little research and found that my cheap camera from Ali (dooreye, xmeye) sends inverted events. Constantly sends “motion: true”, and during detection - “motion: false” . That’s why the home assistant can’t handle it properly. I think it’ possible to open an issue with a request to add the appropriate option for inverting to HA integration.
Also, if automation is important to you, but not gui, you can add a custom virtual sensor, which will be an inversion from the camera sensor. And it will works in automations.

You can test this theory by observing the sensor readings in HA. If they change their values for a short time after motion is detected by the camera, this is your case.

1 Like