BaQs / pyEzviz

Python package for ezviz cameras
Apache License 2.0
105 stars 45 forks source link

Motion detection event #98

Closed rezzalex closed 1 year ago

rezzalex commented 1 year ago

Hello,

is it possible to "listen" to the battery cam motion detection event and send another call to something else ?

andrewcoo101 commented 1 year ago

The Ezviz cloud sends mqtt messages when motion is detected.

pyEzviz supports an mqtt option that listens for these events.

I've no experience of battery operated camera's - but assume that these events will be sent.

rezzalex commented 1 year ago

Hello,

thank you for your answer, I simply don't know how to use it...

Would it be possible to provide a guide /wiki ? list of possible command ?

Possible to propose a docker file or a container for this whole beautiful project ?

andrewcoo101 commented 1 year ago

This library is primarily a tool that allows camera features to dis/enabled or changed in some other way.

I believe many use pyezviz as part of home assistant. https://www.home-assistant.io/integrations/ezviz/

Home assistant is responsible for invoking the libary to change camera settings.

Personally I use the command line; this command prints usage information: python3 pyezviz -h

To run the code from this repo I made these changes: https://github.com/BaQs/pyEzviz/commit/e914b8c9893824b6690d81359f0f9d253cc4d496

rezzalex commented 1 year ago

thank you,

Could you indicate me how to use the MQTT option ?

From my perspective, the best "added-value" is to receive events from Ezviz to Domoticz, because "arming" the camera can be done using a simulated google vocal command, from Domoticz. Is it possible to receive a snapshot as well ? or the recording ? or the link to the recording?

andrewcoo101 commented 1 year ago

The mqtt option prints the mqtt events to standard output.

If you wish to use these events then you could either:

I can't remember exactly what information is returned, but I'm pretty sure there is a link to an image - check the information that is printed to std out for exact details.

I have no experience with Domoticz.

maxmontgmx commented 1 year ago

Hi all, I try mqtt feature without success. I don't receive any event in the standard output :

DEBUG:urllib3.connectionpool:https://apiieu.ezvizlife.com:443 "PUT /v3/apigateway/login HTTP/1.1" 200 785 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): pusheu.ezvizlife.com:443 DEBUG:urllib3.connectionpool:https://pusheu.ezvizlife.com:443 "POST /v1/getClientId HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:https://pusheu.ezvizlife.com:443 "POST /api/push/start HTTP/1.1" 200 None INFO:pyezviz.mqtt:Connected OK with return code 0 INFO:pyezviz.mqtt:Subscribed: 1 (2,) INFO:pyezviz.mqtt:Connected OK with return code 0 INFO:pyezviz.mqtt:Connected OK with return code 0 INFO:pyezviz.mqtt:Connected OK with return code 0

maxmontgmx commented 1 year ago

Push mode was disable. After enabling, it' sworking. Sorry for that.

rezzalex commented 1 year ago

The mqtt option prints the mqtt events to standard output.

If you wish to use these events then you could either:

  • parse standard output using some other command line tool or script
  • update the code to use the events directly.

I can't remember exactly what information is returned, but I'm pretty sure there is a link to an image - check the information that is printed to std out for exact details.

I have no experience with Domoticz.

@andrewcoo101 ; thank you. I have modified the code and use Domoticz API to trigger a dummy motion detection device.

x4080 commented 4 months ago

@maxmontgmx How do you get the motion detection mqtt event ?

DEBUG:urllib3.connectionpool:https://apiisgp.ezvizlife.com:443 "PUT /v3/apigateway/login HTTP/1.1" 200 785
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): pushsgp.ezvizlife.com:443
DEBUG:urllib3.connectionpool:https://pushsgp.ezvizlife.com:443 "POST /v1/getClientId HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://pushsgp.ezvizlife.com:443 "POST /api/push/start HTTP/1.1" 200 None
INFO:pyezviz.mqtt:Connected OK with return code 0
INFO:pyezviz.mqtt:Subscribed: 1 (2,)

My device is not displaying any motion detection, while my phone is receiving notifications, is there any settings to turn on ? Thanks

maxmontgmx commented 4 months ago

@x4080 , sorry I don't use MQTT anymore on this device.

x4080 commented 4 months ago

@maxmontgmx ok thanks anyway