bropat / eufy-security-ws

Small server wrapper around eufy-security-client library to access it via a WebSocket.
MIT License
176 stars 26 forks source link

[Bug]: Camera picture OK but updates not working #217

Closed lxrootard closed 1 year ago

lxrootard commented 1 year ago

Version

latest (schema v17)

Node version

bropat/eufy-security-ws latest d32d92c6d647 9 days ago 161MB

Operating System type

Docker

Operating system version

bullseye

Describe the bug

hi @bropat

I'm having issues fetching the snapshot detection events: no picture property event received but device.getProperties REST call for first camera picture property gets an array of bytes that I'm able to convert to a valid jpg: array: {"data":{"type":"Buffer","data":[255,216,255,224,0,16,74,70,73,70,0,1,1,0,0,1,0,1,0,0,255,219,0,197,....

However device.getProperties REST call for 2nd camera returns null although I receive the screenshot on the Eufy app???

[EDIT] it appears several detections from the same camera give identical (old) picture, no picture events are received

As an alternative I still don't understand how the station.download_image API is supposed to work and it seems I'm not the only one

Some clarification would be great thanks!

To reproduce

  1. set the station in detection mode
  2. trigger alarm from camera1 and device.getProperties > detection event + snapshot received
  3. trigger alarm from camera2 and device.getProperties > detection event received but snapshot not updated??
  4. trigger alarm from camera1 and device.getProperties > same picture as in step 2

Screenshots & Logfiles

No response

Additional context

No response

ajvdw commented 1 year ago

See also https://github.com/fuatakgun/eufy_security/issues/823

sythesigh commented 1 year ago

Hi, my last detected image for my 2c camera is still only displaying an image from when I installed the camera. My doorbell images are updating fine in my home assistant Lovelace cards, but the 2c is not. It has been like this since the beginning of June. I am not sure you are aware. Thanks.

lxrootard commented 1 year ago

@sythesigh many of us are waiting for this fix

sythesigh commented 1 year ago

Hello @bropat, Thank you for trying with the latest update, however, nothing has changed on my 2c image updates, and now my video doorbell has stopped updating the image preview also.

fuatakgun commented 1 year ago

@bropat does this fix require schema version 19? If so, I haven't updated it yet on my side.

bropat commented 1 year ago

@fuatakgun unfortunately no ;)

sythesigh commented 1 year ago

@fuatakgun @bropat thanks guys! That’s sorted both cameras for me. Thank you for your hard work. Much appreciated 👍🏻😁

ajvdw commented 1 year ago

I'm still experiencing this bug on my 2K doorbell camera.

ajvdw commented 1 year ago

Today I installed 1.6.1. The picture remains the one that was present during the startup of the add-on. I have a 2K doorbell camera (T8210) that only support P2P streaming.

Logfile: Logger: homeassistant.components.camera Source: components/camera/init.py:817 Integration: Camera (documentation, issues) First occurred: 7:05:06 AM (2 occurrences) Last logged: 7:05:54 AM

Error requesting stream: camera.doorbell does not support play stream service

When I restart the add-on, I get notified with:

Error: <Task finished name='Task-2594' coro=<WebSocketClient._process_messages() done, defined at /config/custom_components/eufy_security/eufy_security_api/web_socket_client.py:62> result=None>

When the doorbell is pressed, eufy-security-ws logfile lists:

2023-08-09 05:40:43.411 DEBUG [PushNotificationService.onMessage] Normalized push message received { name: 'Doorbell', event_time: 1691559642647, type: 7, station_sn: 'T8010Pxxxxxxxxx', device_sn: 'T8210Pyyyyyy', title: 'Eufy Security', content: 'Doorbell:Someone has press doorbell', push_time: 1691559643364, channel: 0, cipher: 241, event_session: '20230809_074042', event_type: 3103, file_path: '', pic_url: '', push_count: 1, notification_style: 1 } 2023-08-09 05:40:43.413 DEBUG [EufySecurity.onPushMessage] Received push message { name: 'Doorbell', event_time: 1691559642647, type: 7, station_sn: 'T8010xxxxxx', device_sn: 'T8210yyyyyy', title: 'Eufy Security', content: 'Doorbell:Someone has press doorbell', push_time: 1691559643364, channel: 0, cipher: 241, event_session: '20230809_074042', event_type: 3103, file_path: '', pic_url: '', push_count: 1, notification_style: 1 }

alexeiw123 commented 1 year ago

Images are also not updating beyond add-on startup on T8423 (Floodlight Cam 2 Pro). My other camera devices (T8210 and T8422) are working fine.

ajvdw commented 1 year ago

Updated to 1.6.3, still no refresh of the image.

lxrootard commented 1 year ago

@bropat same with me with 1.6.3: the bug is still there on my 2C cams: no event received and snapshot is still the original one...

bropat commented 1 year ago

Without debug logs I can't help you.

lxrootard commented 1 year ago

Without debug logs I can't help you.

@bropat I've already provided the reproducing instructions and logs when I opened this issue, see on top of this thread. The situation is unchanged. What else do you want me to provide?

ajvdw commented 1 year ago

Without debug logs I can't help you. @bropat, log info was posted two weeks ago, nothing changed. I only get two events when the doorbell is pushed. [PushNotificationService.onMessage] Normalized push message received and [EufySecurity.onPushMessage] Received push message

I expected a decode of the thumbnail in that log after the received push message. But the file_path: '' and pic_url: '' are empty in the event.

bropat commented 1 year ago

@ajvdw I am still missing the line "Raw push message received" to draw any conclusions.

ajvdw commented 1 year ago

@ajvdw I am still missing the line "Raw push message received" to draw any conclusions. I looks like:

2023-08-20 18:22:43.714 DEBUG [PushNotificationService.onMessage] Raw push message received { id: '220A182F', from: '348804314802', to: 'dDnu1crNqJNHUCC7ceW_al', category: 'com.oceanwing.battery.cam', persistentId: '0:1692555763669786%0d2a775cf9fd7ecd', ttl: 3600, sent: '1692555763657', payload: { device_sn: 'T8210xxxxxxxx', payload: { event_type: 3103, device_sn: 'T8210yyyyyyyy', name: 'Doorbell', channel: 0, cipher: 241, session_id: '20230820_202243', pic_url: '', create_time: 1692555763032, file_path: '', notification_style: 1, push_count: 1 }, station_sn: 'T8010xxxxxxxx', 'google.c.sender.id': '348804314802', title: 'Eufy Security', type: '7', push_time: '1692555763650', event_time: '1692555763033', content: 'Doorbell:Someone has press doorbell' } }

bropat commented 1 year ago

@ajvdw As you can see, no image arrives via the push notification and therefore no image can be processed. Check your notification settings in the Eufy app.

ajvdw commented 1 year ago

@bropat , I allow notifications and screen popup for both the main and second account. Now it shows a link to the stream, but still no pic url. But on my mobile I get the notifications but the popup never appears..... Maybe that's the same problem.

2023-08-20 18:43:44.170 DEBUG [PushNotificationService.onMessage] Raw push message received { id: '3157E6FF', from: '348804314802', to: 'dDnu1crNqJNHUCC7ceW_al', category: 'com.oceanwing.battery.cam', persistentId: '0:1692557024111575%0d2a775cf9fd7ecd', ttl: 3600, sent: '1692557024105', payload: { device_sn: 'T8210xxxx', payload: { event_type: 3103, device_sn: 'T8210xxxxxx', name: 'Doorbell', channel: 0, cipher: 241, session_id: '20230820_204343', pic_url: '', create_time: 1692557023456, file_path: 'h264_20230820204343', notification_style: 1, push_count: 1 }, station_sn: 'T8010yyyyyy', 'google.c.sender.id': '348804314802', title: 'Eufy Security', type: '7', push_time: '1692557024097', content: 'Doorbell:Someone has press doorbell', event_time: '1692557023456' } } 2023-08-20 18:43:44.180 DEBUG [PushNotificationService.onMessage] Normalized push message received { name: 'Doorbell', event_time: 1692557023456, type: 7, station_sn: 'T8010xxxxxx', device_sn: 'T8210yyyyyy', title: 'Eufy Security', content: 'Doorbell:Someone has press doorbell', push_time: 1692557024097, channel: 0, cipher: 241, event_session: '20230820_204343', event_type: 3103, file_path: '/media/mmcblk0p1/Camera00/h264_20230820204343.dat', pic_url: '', push_count: 1, notification_style: 1 } 2023-08-20 18:43:44.184 DEBUG [EufySecurity.onPushMessage] Received push message { name: 'Doorbell', event_time: 1692557023456, type: 7, station_sn: 'T8010yyyyy', device_sn: 'T8210xxxxxxx', title: 'Eufy Security', content: 'Doorbell:Someone has press doorbell', push_time: 1692557024097, channel: 0, cipher: 241, event_session: '20230820_204343', event_type: 3103, file_path: '/media/mmcblk0p1/Camera00/h264_20230820204343.dat', pic_url: '', push_count: 1, notification_style: 1 }

So more info, but the image still doesn't refresh in the integration. It shows: Doorbell Event Image became unknown 8:54:13 PM - 1 minute ago

alexeiw123 commented 1 year ago

As you can see, no image arrives via the push notification and therefore no image can be processed. Check your notification settings in the Eufy app.

Well, this fixed it for me. User error was causing me the issue I guess!

My notification setting for the Eufy cam need to be set to 'full' and then it started working. Because I also use a separate account for my Home Assistant Eufy, I had to make sure the notification setting was updated in that account too.

ajvdw commented 1 year ago

@bropat, I'm one step closer to the solution, I get a Pic_url but then I get: 2023-08-21 07:41:02.391 DEBUG [HTTPApi.request] Request: { method: 'GET', endpoint: URL { href: 'https://security-app-eu.eufylife.com/v1/s/g/pKZ6ve-Gs', origin: 'https://security-app-eu.eufylife.com', protocol: 'https:', username: '', password: '', host: 'security-app-eu.eufylife.com', hostname: 'security-app-eu.eufylife.com', port: '', pathname: '/v1/s/g/pKZsdfsdf-Gs', search: '', searchParams: URLSearchParams {}, hash: '' }, responseType: 'buffer', token: '53e2207778c685029f8c60a565d9026079368c027676dd9d', data: undefined } 2023-08-21 07:41:05.883 DEBUG [HTTPApi.requestEufyCloud.got_1.default.extend.hooks.beforeRetry] Retrying [1]: ERR_NON_2XX_3XX_RESPONSE (https://security-app-eu.eufylife.com/v1/s/g/pKZ6ve-Gs) 404 GET https://zhixin-security-eu.s3.eu-central-1.amazonaws.com/pushthumb/2023/08/21/station/T8010xxxxxxxx/Sfed13mtsHVbdvnu.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJYLV2KOLW6PU4FSA%2F20230821%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20230821T074102Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=d934751461db6fa047b12a857e9426b3c49be3e543bf31c4e00c7978e90c3705 <?xml version="1.0" encoding="UTF-8"?>

NoSuchKeyThe specified key does not exist.pushthumb/2023/08/21/station/T8010xxxxxxxx/Sfed13mtsHVbdvnu.jpg4ARXFP1HJT64ZNHWPbEShXjw1vlSk5h36X+i3ZajvKyXU5iPrAARrJhdIy/pRmMrvqGOAGEqWTjaIvxZL9wkqu8MAT4=

2023-08-21 07:41:06.009 DEBUG [HTTPApi.request] Response: { token: '53e2207778c685029f8c60a565d9026079368c027676dd9d', request: { method: 'GET', endpoint: URL { href: 'https://security-app-eu.eufylife.com/v1/s/g/pKZ6ve-Gs', origin: 'https://security-app-eu.eufylife.com', protocol: 'https:', username: '', password: '', host: 'security-app-eu.eufylife.com', hostname: 'security-app-eu.eufylife.com', port: '', pathname: '/v1/s/g/pKZ6ve-Gs', search: '', searchParams: URLSearchParams {}, hash: '' }, responseType: 'buffer' }, response: <Buffer 65 75 66 79 73 65 63 75 72 69 74 79 3a 54 38 30 31 30 50 32 33 32 30 32 32 30 38 36 36 3a 30 31 39 35 34 34 37 31 32 33 3a c5 60 78 b8 13 f5 c8 a1 5b ... 81923 more bytes> }

ajvdw commented 1 year ago

Closing in, next error

2023-08-21 07:41:02.391 DEBUG [HTTPApi.request] Request: { method: 'GET', endpoint: URL { href: 'https://security-app-eu.eufylife.com/v1/s/g/pKZ6ve-Gs', origin: 'https://security-app-eu.eufylife.com', protocol: 'https:', username: '', password: '', host: 'security-app-eu.eufylife.com', hostname: 'security-app-eu.eufylife.com', port: '', pathname: '/v1/s/g/pKZ6ve-Gs', search: '', searchParams: URLSearchParams {}, hash: '' }, responseType: 'buffer', token: '53e2207778c685029f8c60a565d9026079368c027676dd9d', data: undefined } 2023-08-21 07:41:05.883 DEBUG [HTTPApi.requestEufyCloud.got_1.default.extend.hooks.beforeRetry] Retrying [1]: ERR_NON_2XX_3XX_RESPONSE (https://security-app-eu.eufylife.com/v1/s/g/pKZ6ve-Gs) 404 GET https://zhixin-security-eu.s3.eu-central-1.amazonaws.com/pushthumb/2023/08/21/station/T8010xxxxxxxx/Sfed13mtsHVbdvnu.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJYLV2KOLW6PU4FSA%2F20230821%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20230821T074102Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=d934751461db6fa047b12a857e9426b3c49be3e543bf31c4e00c7978e90c3705 <?xml version="1.0" encoding="UTF-8"?>

NoSuchKeyThe specified key does not exist.pushthumb/2023/08/21/station/T8010xxxxxxxx/Sfed13mtsHVbdvnu.jpg4ARXFP1HJT64ZNHWPbEShXjw1vlSk5h36X+i3ZajvKyXU5iPrAARrJhdIy/pRmMrvqGOAGEqWTjaIvxZL9wkqu8MAT4=

2023-08-21 07:41:06.009 DEBUG [HTTPApi.request] Response: { token: '53e2207778c685029f8c60a565d9026079368c027676dd9d', request: { method: 'GET', endpoint: URL { href: 'https://security-app-eu.eufylife.com/v1/s/g/pKZ6ve-Gs', origin: 'https://security-app-eu.eufylife.com', protocol: 'https:', username: '', password: '', host: 'security-app-eu.eufylife.com', hostname: 'security-app-eu.eufylife.com', port: '', pathname: '/v1/s/g/pKZ6ve-Gs', search: '', searchParams: URLSearchParams {}, hash: '' }, responseType: 'buffer' }, response: <Buffer 65 75 66 79 73 65 63 75 72 69 74 79 3a 54 38 30 31 30 50 32 33 32 30 32 32 30 38 36 36 3a 30 31 39 35 34 34 37 31 32 33 3a c5 60 78 b8 13 f5 c8 a1 5b ... 81923 more bytes> }

I expected the username and password to be populated for the request.

bropat commented 1 year ago

@ajvdw

I expected the username and password to be populated for the request.

No, username and password are not required here. The error here is that the Eufy Cloud generated the url for the image, but the image was not yet ready when the query was made (HTTP ERROR 404 - Not found).

bropat commented 1 year ago

@lxrootard

set the station in detection mode trigger alarm from camera1 and device.getProperties > detection event + snapshot received trigger alarm from camera2 and device.getProperties > detection event received but snapshot not updated?? trigger alarm from camera1 and device.getProperties > same picture as in step 2

Have reproduced everything with a Homebase 2 and 2 eufy T8114 and found no errors. I get the correct image of the respective camera with the proprerty changed event, so the problem lies somewhere else but not here. For this reason I am now closing this issue.