Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Amcrest testers wanted: more responsive motion detection

$
0
0

@pnbruckner wrote:

The current implementation for motion detection uses polling. Every 5 seconds it checks to see if a motion detection event has happened. Obviously this can cause up to 5 seconds of delay between the event and the motion detection binary sensor changing to on.

The camera HTTP API does allow for subscribing to events, but that feature has yet to be used. Work is now being done to switch to this method. However, there are many camera models out there, with many different firmware versions in use. It would be helpful to gather some data about how these various cameras respond to the command.

To that end I’ve written a small Python script that will subscribe to the video motion detection event and output the received data when these events occur. If anyone would be willing to run it and share their results (especially if they are different from previously shared results), it would be much appreciated.

All you need is a command line that can run python3, and has the amcrest package installed. You can do this in a Python virtual environment like so:

python3 -m venv venv
source venv/bin/activate

Then run deactivate when you’re done.

Run the test like so:

python3 test_events.py host port user password

Where host is the camera’s IP address, port is the port number it listens on (80 is the default), user is the username of an account on the camera (admin is the default), and password is the account’s password.

When I run it on one of my cameras, I get output like this:

2020-01-22 22:42:02 'Code=VideoMotion;action=Start;index=0'
2020-01-22 22:42:05 'Code=VideoMotion;action=Stop;index=0'
2020-01-22 22:42:05 'Code=VideoMotion;action=Start;index=0'
2020-01-22 22:42:11 'Code=VideoMotion;action=Stop;index=0'

The pair of Start & Stop lines are printed for each motion detection event.

End the test by typing Ctrl-C.

Of course, motion detection needs to be enabled. You can do this via HA by using the camera.enable_motion_detection service. The test script can run at the same time HA is controlling the camera. There is no conflict between the two.

And now for the script. You can get it from here. (Be sure to use the Raw button when downloading.)

Thanks in advance!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles