pyEzviz icon indicating copy to clipboard operation
pyEzviz copied to clipboard

Battery Cameras - Working Modes

Open uvjim opened this issue 3 years ago • 4 comments

Hi,

I recently purchased the BC1C camera. I noticed that this is picked up by the module with multiple sensors etc being created in Home Assistant. I'm looking to be able to change the mode that the camera works in. At first glance the sleep toggle does what I want, however, in the Android app this shows the camera as offline after a period of time (I'm assuming that sleeping the camera also sleeps the Wi-Fi and there for it can't connect again). I can bring the camera back online by changing the power state (plugging or unplugging the charger from it). Also, whilst in sleep mode I am unable to view and recorded videos from the device, or change any settings.

There are however Working Modes and one of those appears to do what I need. The following screenshot shows these in the app. Is it possible for these to be made available as selectable options in Home Assistant? Am happy to do some testing if need be.

Thanks in advance.

uvjim avatar Aug 07 '21 17:08 uvjim

It seems that the information is retrieved from the camera after calling get_all_per_serial_infos and is stored in statusInfos.optionals.batteryCameraWorkMode. It looks like the options are an enumeration similar to the SoundMode.

Power Saving Mode: 0
Performance Mode: 1
Record Mode: 2
Super Power-saving: 3
Configure Working Mode: 4

What I'm currently not sure, and unable to sniff at present, is which API endpoint is used to set these values.

Any help would be appreciated.

uvjim avatar Aug 11 '21 21:08 uvjim

OK. Have tried tonight to find the URL and payloads needed. Unfortunately, every time I try to sniff the traffic using Fiddler or Charles (both on Windows) the ezviz app (on Android) goals to get any network connection so goes no further. I'm unable to find the required URL and payloads to implement this.

If anyone else could take a look that would be great.

Thanks in advance.

uvjim avatar Aug 12 '21 20:08 uvjim

Hi @uvjim,

This is most likely a call to the ezviz CAS server. You'll need to use wireshark to capture the request.

All calls to the ezviz cas server is encrypted so it takes a bit of fiddling to get this to work. I make use of mitmproxy with the setting rawtcp enabled. You'll also need to log the SSL keys in a file and use that in wireshark.

This should decrypt the 1st layer (SSL). Can then see what the AES128 encrypted string looks like. The ezvizcas file has code to decrcrypt this data by retrieving the decryption keys for your account via an api call. (used for the enable/disable motion detection function)

Apologies for the long explanation but it's quite difficult for me to do without access to the encrypted command string sent.

RenierM26 avatar Sep 04 '21 05:09 RenierM26

Thanks. I'll take a look at mitmproxy and see if I can decipher anything.

I'm using the Android app so I'm assuming I just need to configure the Android wireless connection to use mitmproxy as the proxy for the connection.

uvjim avatar Sep 21 '21 19:09 uvjim

Hi @uvjim,

I have added a function to set the battery work mode in the latest pyezviz release.

RenierM26 avatar Jun 18 '23 10:06 RenierM26

Thanks @RenierM26 I'll take a look. I assume this will make it through to the Home Assistant integration in due course as well.

uvjim avatar Jun 21 '23 10:06 uvjim