alexbn71 / AgentDVR-Telegram

A PHP script to send alerts to your Telegram bot with the free version of AgentDVR
9 stars 0 forks source link

need help #2

Open nicomarti83 opened 1 year ago

nicomarti83 commented 1 year ago

Hi, I'm trying to use your telegram_sendphoto.sh but I think it miss somethink to work.

What are APIUSER and APIPWD? Credentials used to connect to the web interface? How can I consult logs from CURL command ? Thanks in advance

alexbn71 commented 1 year ago

Hi,
take a look at this page: https://www.ispyconnect.com/userguide-agent-api.aspx

image

let me know if you need more help

nicomarti83 commented 1 year ago
Capture d’écran 2023-09-01 à 13 43 48 Capture d’écran 2023-09-01 à 13 44 03

Ok, the auth problem is solved but the manual alert do nothing... no telegram notification and "grabs" folder empty... However the script seem to work when I start it in the container, exept the jpg file into "grabs" is empty probably because the two parameters ({ID} '{MSG}') are missing. The result is an error from telegram api error_code":400,"description":"Bad Request: file must be non-empty. So I guess my action configuration in agent dvr is bad but I don't understant why ...

alexbn71 commented 1 year ago

I need to know your Commands folder path (the container path):

image

I think you have to update this path... image

nicomarti83 commented 1 year ago

in the HOST : /home/xxx/docker/agent-dvr/Commands in container : /AgentDVR/Commands

alexbn71 commented 1 year ago

in the HOST : /home/xxx/docker/agent-dvr/Commands in container : /AgentDVR/Commands

Ok check the path in the script... and do the necessary changes

nicomarti83 commented 1 year ago

I think I alrealy change the path.

Capture d’écran 2023-09-01 à 18 01 10
alexbn71 commented 1 year ago

I think I alrealy change the path.

Capture d’écran 2023-09-01 à 18 01 10

Test the URL in your browser... ie in my case: http://mininas-2:8090/grab.jpg?oid=13&size=1280x720&maintainAR=true

remember to replace "${AGENTDVRURL}" and ${ID} variables and check the port, in my case 8090

the browser should show a frame of your cam

nicomarti83 commented 1 year ago

After being prompted for my credentials it work.

nicomarti83 commented 1 year ago

Hum... after making lots of tests (changing folders rights, restarting my docker, rebuilt the action from begining) I finaly receve pictures (of the begining of the recording) on telegram without text... I don't know what unblocked the situation... I continue to investigate about the missing text and the useless picture.

alexbn71 commented 1 year ago

Why "useless picture"?

nicomarti83 commented 1 year ago

Useless because the event who trigger the script is always missing from the picture... I think because I configure somewhere (don't know where)a pre alert recording.

alexbn71 commented 1 year ago

I noticed that on "Manual Alert" the MSG variable is set to "Manual Alert" (and telegram receive a picture with text) but on motion detect AgentDVR does not set MSG

on my old telegram notifications the image was received with "Alert" text (on motion detect). It seems that something changed recently

alexbn71 commented 1 year ago

I noticed that there is a new variable implemented by AgentDVR {BASE64IMAGE}. For this reason I have changed the script... now it does't needs API access and the image sent is exactly the one captured by AgentDVR event. You could try this new version

NB: Remember to update the Task Parameters to {ID} '{MSG}' {BASE64IMAGE}

nicomarti83 commented 1 year ago

The script seem to work with the manual alert, the resolution is low but suffisiant to figure what's going on. I'll try tomorow to see if it capture the alert event. Thank's a lot for the improvement.

alexbn71 commented 1 year ago

With {BASE64IMAGE} solution is AgentDVR that set the resolution. The old solution that uses AgentDVR API was setting the resolution to 1280x720

nicomarti83 commented 1 year ago

Everything seem to work fine now, thank you for helping.