tchellomello / python-amcrest

A Python 2.7/3.x module for Amcrest and Dahua Cameras using the SDK HTTP API.
GNU General Public License v2.0
216 stars 76 forks source link

Motion detected event should be filtered by channel id #133

Open akram opened 4 years ago

akram commented 4 years ago

The 6.9 GetEventIndexes section of the API documentation gives a way to know for which channel an event happened:

URL Syntax http://<ip>/cgi-bin/eventManager.cgi?action=getEventIndexes&code=<eventCode>

Comment | Get channels indexes that event of code eventCode happens. eventCode includes:VideoMotion: VideoLoss: VideoBlind: AlarmLocal:motion detection event video loss detection eventvideo blind detection event. alarm detection event.
-- | --
Response | channels[0]=0 channels[1]=2 channels[2]=3 ...(This response means event happened on channel 0, channel 2, and channel 3.)

Using this, we should be able to have a method telling if a motion detected event has occured for a given channel or not.

Currently, it seems that we only check that channels are present in the response, but we do not give access to the filtered information.

https://github.com/tchellomello/python-amcrest/blob/100344cec2b6ae9e112aae4bf5d49b7c3ee51c63/src/amcrest/event.py#L143