Ezviz integration: download the "last_alarm_pic"

Hello,

I have integrated my BC1C Ezviz camera into my Home Assistant installation.

I can see a device entity called sensor.bc1c_last_alarm_pic which contains, as far as Ican understand, the address of the last picture taken by the camera when triggered. Is there a way to download that pic? Or, in general, to access the snapshots taken by the camera at detection?

That would be very useful to have an alternative storage compared to the camera memory card (which could be quite easily stolen…) but also to post-process that pic to check whether something is really going on or if it is a a false positive. It could also be used to attach it to HA notification.

Thanks in advance for help.

I have the same camera and also looking for this option to grab the picture of the link in the sensor and than display it in a picture entity card.
SO far no luck with this.
Any help would be apreciated

2 Likes

First there needs to be an alarm triggered for the url to be available in last_alarm_pic.

if there is no alarm picture a link to ezviz logo wil be shown:
https://eustatics.ezvizlife.com/ovs_mall/web/img/index/EZVIZ_logo.png?ver=3007907502

When alarm is triggered a link to a file like “Gxxxxxxxx_1_20220606183647-Gxxxxxxxx-1-xxxxx-2-1” will be visable:
https://ieu.ezvizlife.com/v3/alarms/pic/get?fileId=20220904194426-Fxxxxxxxx-1-10002-2-1&deviceSerialNo=Fxxxxxxxx&cn=1&ct=5&lc=7&bn=5_alarm.eu&isDevVideo=0

You can copy/paste that url in your browser and download it (unsecured…hmmm).

I did manage to download the 140k file, so there is data there, but the format is not recognisable in any sofware i could find.
I does not have an extension and there is also no filteype data in the file that i could find.
I tried setting the extension to several common formats but no banana for this monkey.

here’s an example of the file if you dare download it:

1 Like

I got similar problem with other ezviz camera device. The solution in my case was that the image is by default encrypted, so I changed that option in the ezviz app and now i’m able to see the image correctly.

[Sorry for my late reply]

Thanks for your suggestion, @CFFAA: deactivating the encryption allows me to download an accessible image file (I could then store it, post-process it to check human presence, join it to a notification…).

However, I am quite worried about leaving these files not encrypted out in the internet… A better option would be to decrypt the file locally once downloaded, as it is done by the Ezviz app (I suppose). I guess it would be not that hard once we know the encryption algorithm and the associated password… right ? Any idea on the encryption algorithm used by Ezviz ?

I opened a feature request concerning the management of Ezviz encryption in this integration:

Please vote it if you think it would be useful for you too.

1 Like

Related to this? I have an automation to create a snapshot when an alarm is triggered.
So I receive a .jpg in the media directory. Nice picture, but the subject of the alarm is not visible anymore, as the timestamp of the snaphot-picture is about 40 seconds later than the alarm-picture in the ezviz app.

Good Morning!
I don’t know if this topic is still relevant!
I’m having the same problem, I have an integration that uses the EZVIZ API and I’m having an epic battle to download and decrypt the Last_Alarm_Pic image.
There is an SDK from EZVIZ for the PC, but I wasn’t successful with it, I tried with C#.
I requested support from them, I received a response that disabled encryption, including a command from the API itself to disable it.
Has anyone gotten more information about the encryption employed? It seems to me that it is a SHA256, in the SDK, the data requested in the process are the APP ID, Serial and the encryption code.

1 Like

In the app I tried to disable enciption but it’s only it seems that it’s only the encryption for video and does not affect images. Have you had any luck. Could you please share the documentation that you got from EZVIZ?

hello, I haven’t got much yet, I’m trying to understand how their SDK for PC works, but my C++ is a bit rusty so, moving forward slowly!

As for the address they had given me, which in theory would disable encryption, it is the one below, but remember that it only takes effect for new captures.

[POST] - {areaDomain}/api/lapp/device/encrypt/off

Content-Type: application/x-www-form-urlencoded
accessToken=at.8z25h2063dapeus7c99bb0r6e0kjfjz5&deviceSerial=427734888&validateCode=ABCDEF

My hope is that I can put the SDK to work, it has a specific function to decrypt the images, in my case it solves the problem because the platform we developed managed to implement the routine.

2 Likes

Good morning people!

follow guit project in c#, SDK working, to access the streaming and also, decrypting the images.

sorry, it’s not perfect, but it’s already a light at the end of the tunnel!

2 Likes

I have found on hacs a component that claims to decode the picture but it uses the chinese server

A blog entry can be found here: HomeAssistant 萤石云摄像头取图插件,支持智能猫眼 - 哔哩哔哩

Nice! Are you planing to make a HA implemantation of this?

Hello!
no, our idea is to include it in our local server, so that the workstations can download and decode the images of the events!

But a solution for those who need it would be to host it in a virtual machine, like in AWS for example, I believe it would be possible to even keep it in one of the free configurations, with few modifications in the code it is possible to transform it into an http server and respond to requests as in a API, which would solve the problem for most projects based on the open API.

my pyton is a little rusty, not to mention weak!
Correct me if I’m wrong!
but I think this script only downloads the “frame” image from the camera, it does not support decrypting the images, the Chinese server is precisely where their API is hosted.

so no hope there! The ideal situation would be to have this included in the existent integration

1 Like

I tried also by asking some help on stack overflow here, but with no success for the moment…

Facing same problem, any new idea?

service: notify.mobile_app_poco_f3
data:
  message: "<span style=\"color: red\">BACK DOOR!</span>"
  title: "Motion detection"
  data:
    icon_url:  "{{ states('sensor.khorio_aule_last_alarm_pic') }}"