Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some sensors do not update automatically #4

Open
3 tasks done
ShagoY opened this issue Dec 21, 2024 · 8 comments
Open
3 tasks done

Some sensors do not update automatically #4

ShagoY opened this issue Dec 21, 2024 · 8 comments
Assignees
Labels
Bug Something isn't working

Comments

@ShagoY
Copy link

ShagoY commented Dec 21, 2024

Checklist

  • I have enabled debug logging for my installation.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of any previous issues..

Describe the issue

Error get media file.

My image.pet_feeder_last_*_event didn't seem to update. While looking at the logs, I saw several errors.

image

Debug logs

First log :
2024-12-21 20:44:35.745 ERROR (MainThread) [pypetkitapi.medias] Error get media file from http://petkit-cloud-storage-7-prod-eu.oss-eu-central-1.aliyuncs.com/d4sh/300005185/5_EVENT_PREVIEW1734808492?Expires=1734813865&OSSAccessKeyId=LTAI5tMrYpaAxKw1cLNGfVC5&Signature=4%2FACAwBQKuF19N2JaiCwxkOIJuQ%3D: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_5_event_preview1734808492.jpg.enc'
2024-12-21 20:44:35.751 ERROR (MainThread) [pypetkitapi.medias] Error get media file from http://petkit-cloud-storage-7-prod-eu.oss-eu-central-1.aliyuncs.com/d4sh/300005185/5_EVENT_PREVIEW1734808492?Expires=1734813865&OSSAccessKeyId=LTAI5tMrYpaAxKw1cLNGfVC5&Signature=4%2FACAwBQKuF19N2JaiCwxkOIJuQ%3D: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_5_event_preview1734808492.jpg.enc'
2024-12-21 20:44:35.867 ERROR (MainThread) [pypetkitapi.medias] Error get media file from http://petkit-cloud-storage-7-prod-eu.oss-eu-central-1.aliyuncs.com/d4sh/300005185/4_EVENT_PREVIEW1734801673?Expires=1734813865&OSSAccessKeyId=LTAI5tMrYpaAxKw1cLNGfVC5&Signature=Ovq7GR8kFCUyc%2BWzonYqPeyfyWc%3D: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_4_event_preview1734801673.jpg.enc'
2024-12-21 20:44:35.870 ERROR (MainThread) [pypetkitapi.medias] Error get media file from http://petkit-cloud-storage-7-prod-eu.oss-eu-central-1.aliyuncs.com/d4sh/300005185/4_EVENT_PREVIEW1734801673?Expires=1734813865&OSSAccessKeyId=LTAI5tMrYpaAxKw1cLNGfVC5&Signature=Ovq7GR8kFCUyc%2BWzonYqPeyfyWc%3D: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_4_event_preview1734801673.jpg.enc'
2024-12-21 20:44:35.971 ERROR (MainThread) [root] Error decrypting image from file /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734808465.jpg.enc: Zero-length input cannot be unpadded
2024-12-21 20:44:35.972 ERROR (MainThread) [pypetkitapi.medias] Failed to decrypt /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734808465.jpg.enc
2024-12-21 20:44:35.985 ERROR (MainThread) [root] Error decrypting image from file /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734808465.jpg.enc: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734808465.jpg.enc'


Debug log :
2024-12-21 21:07:20.395 DEBUG (MainThread) [pypetkitapi.client] Getting API server list
2024-12-21 21:07:20.395 DEBUG (MainThread) [pypetkitapi.client] Request: GET https://passport.petkt.com/v1/regionservers
2024-12-21 21:07:20.896 DEBUG (MainThread) [pypetkitapi.client] Found matching server: account_type='email' gateway='https://api.eu-pet.com/latest/' id='FR' name='France'
2024-12-21 21:07:20.897 INFO (MainThread) [pypetkitapi.client] Logging in to PetKit server
2024-12-21 21:07:20.897 DEBUG (MainThread) [pypetkitapi.client] Login method: using password
2024-12-21 21:07:20.897 DEBUG (MainThread) [pypetkitapi.client] Request: POST https://api.eu-pet.com/latest/user/login
2024-12-21 21:07:20.991 DEBUG (MainThread) [pypetkitapi.client] Fetching account data
2024-12-21 21:07:20.991 DEBUG (MainThread) [pypetkitapi.client] Request: GET https://api.eu-pet.com/latest/group/family/list
2024-12-21 21:07:21.041 DEBUG (MainThread) [pypetkitapi.client] List devices data for account: device_list=[] expired=False group_id=300140629 name='Ma famille' owner=100683640 pet_list=[] user_list=[User(avatar='https://petkit-storage-image-prod-eu.oss-eu-central-1.aliyuncs.com/uavatar/2024/12/22/1734799758133100683640', created_at=1705880238516, is_owner=1, user_id=100683640, user_name='Home Assistant')]
2024-12-21 21:07:21.042 DEBUG (MainThread) [pypetkitapi.client] List devices data for account: device_list=[Device(created_at=1706119725321, device_id=400014845, device_name='Fontaine', device_type='W5', group_id=300081737, type=14, type_code=4, unique_id='400014845-14'), Device(created_at=1721305887770, device_id=300005185, device_name='Pet Feeder', device_type='D4sh', group_id=300081737, type=25, type_code=0, unique_id='300005185-25')] expired=False group_id=300081737 name='Ma famille' owner=100629971 pet_list=[] user_list=[User(avatar='https://sandbox-img5.petkit.cn/banner/2022/10/13/6347d75a44ad08000b011e7dDzwc693i5', created_at=1692902467605, is_owner=1, user_id=100629971, user_name='Mr\nShagoY'), User(avatar='https://petkit-storage-image-prod-eu.oss-eu-central-1.aliyuncs.com/uavatar/2024/12/22/1734799758133100683640', created_at=1705880458908, is_owner=0, user_id=100683640, user_name='Home Assistant')]
2024-12-21 21:07:21.042 DEBUG (MainThread) [pypetkitapi.client] Devices in account: [Device(created_at=1706119725321, device_id=400014845, device_name='Fontaine', device_type='W5', group_id=300081737, type=14, type_code=4, unique_id='400014845-14'), Device(created_at=1721305887770, device_id=300005185, device_name='Pet Feeder', device_type='D4sh', group_id=300081737, type=25, type_code=0, unique_id='300005185-25')]
2024-12-21 21:07:21.044 DEBUG (MainThread) [pypetkitapi.client] Reading device type : w5 (id=400014845)
2024-12-21 21:07:21.044 DEBUG (MainThread) [pypetkitapi.client] Request: POST https://api.eu-pet.com/latest/w5/deviceData
2024-12-21 21:07:21.044 DEBUG (MainThread) [pypetkitapi.client] Reading device type : d4sh (id=300005185)
2024-12-21 21:07:21.044 DEBUG (MainThread) [pypetkitapi.client] Request: POST https://api.eu-pet.com/latest/d4sh/device_detail
2024-12-21 21:07:21.150 DEBUG (MainThread) [pypetkitapi.client] Device data fetched OK for w5
2024-12-21 21:07:21.330 DEBUG (MainThread) [pypetkitapi.client] Device data fetched OK for d4sh
2024-12-21 21:07:21.331 DEBUG (MainThread) [pypetkitapi.client] Reading device type : w5 (id=400014845)
2024-12-21 21:07:21.332 DEBUG (MainThread) [pypetkitapi.client] Endpoint not found for device type: w5
2024-12-21 21:07:21.332 DEBUG (MainThread) [pypetkitapi.client] Reading device type : d4sh (id=300005185)
2024-12-21 21:07:21.332 DEBUG (MainThread) [pypetkitapi.client] Request: POST https://api.eu-pet.com/latest/d4sh/getDeviceRecord
2024-12-21 21:07:21.602 DEBUG (MainThread) [pypetkitapi.client] Device records fetched OK for d4sh
2024-12-21 21:07:21.612 DEBUG (MainThread) [pypetkitapi.client] Petkit data fetched successfully in: 0:00:01.217230
2024-12-21 21:07:21.619 DEBUG (MainThread) [custom_components.petkit] Finished fetching petkit data in 1.224 seconds (success: True)
2024-12-21 21:07:22.454 DEBUG (MainThread) [custom_components.petkit] w5 supports 'Today pump run time'
2024-12-21 21:07:22.454 DEBUG (MainThread) [custom_components.petkit] w5 supports 'Last update'
2024-12-21 21:07:22.454 DEBUG (MainThread) [custom_components.petkit] w5 supports 'Filter percent'
2024-12-21 21:07:22.454 DEBUG (MainThread) [custom_components.petkit] w5 supports 'Purified water'
2024-12-21 21:07:22.454 DEBUG (MainThread) [custom_components.petkit] w5 DOES NOT support 'Drink times' (value is None)
2024-12-21 21:07:22.454 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Device status'
2024-12-21 21:07:22.454 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Desiccant left days'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Battery level'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Rssi'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Error message'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh is NOT COMPATIBLE with 'Times dispensed d3'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Times dispensed'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh DOES NOT support 'Total planned' (value is None)
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh DOES NOT support 'Planned dispensed'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh DOES NOT support 'Total dispensed' (value is None)
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh DOES NOT support 'Manual dispensed' (value is None)
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh DOES NOT support 'Amount eaten'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Times eaten'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh DOES NOT support 'Food in bowl'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Avg eating time'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Manual dispensed hopper 1'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Manual dispensed hopper 2'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Total planned hopper 1'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Total planned hopper 2'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Planned dispensed hopper 1'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Planned dispensed hopper 2'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Total dispensed hopper 1'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Total dispensed hopper 2'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Food bowl percentage'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'End date care plus subscription'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh DOES NOT support 'Food left'
2024-12-21 21:07:22.455 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'RAW distribution data'
2024-12-21 21:07:22.469 DEBUG (MainThread) [custom_components.petkit] w5 supports 'Lack warning'
2024-12-21 21:07:22.469 DEBUG (MainThread) [custom_components.petkit] w5 supports 'Battery'
2024-12-21 21:07:22.470 DEBUG (MainThread) [custom_components.petkit] w5 DOES NOT support 'On ac power'
2024-12-21 21:07:22.470 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Camera status'
2024-12-21 21:07:22.470 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Feeding'
2024-12-21 21:07:22.470 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Battery installed'
2024-12-21 21:07:22.470 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Care plus subscription'
2024-12-21 21:07:22.470 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Eating'
2024-12-21 21:07:22.470 DEBUG (MainThread) [custom_components.petkit] d4sh force ignore for 'Food level'
2024-12-21 21:07:22.470 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Food level 1'
2024-12-21 21:07:22.470 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Food level 2'
2024-12-21 21:07:22.475 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Indicator light'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Child lock'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Shortage alarm'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh DOES NOT support 'Feed tone'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Feed sound'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Dispensing notif'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Refill notif'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Pet visit notif'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Pet eat notif'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Move notif'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Surplus control'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'System notification'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Camera'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Low battery notif'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Microphone'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Night vision'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Voice dispense'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh DOES NOT support 'Do not disturb'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Desiccant notif'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Pet tracking'
2024-12-21 21:07:22.476 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Video timestamp'
2024-12-21 21:07:22.483 DEBUG (MainThread) [custom_components.petkit] d4sh is NOT COMPATIBLE with 'Manual feed single'
2024-12-21 21:07:22.483 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Manual feed dual h1'
2024-12-21 21:07:22.483 DEBUG (MainThread) [custom_components.petkit] d4sh supports 'Manual feed dual h2'
2024-12-21 21:07:22.484 DEBUG (MainThread) [custom_components.petkit] d4sh is NOT COMPATIBLE with 'Call pet'
2024-12-21 21:07:22.485 DEBUG (MainThread) [custom_components.petkit] d4sh is NOT COMPATIBLE with 'Surplus'
2024-12-21 21:07:22.486 DEBUG (MainThread) [custom_components.petkit] d4sh is NOT COMPATIBLE with 'Manual Feed'
2024-12-21 21:07:22.486 DEBUG (MainThread) [custom_components.petkit] d4sh is NOT COMPATIBLE with 'Min Eating Duration'
2024-12-21 21:07:22.486 DEBUG (MainThread) [custom_components.petkit] d4sh is NOT COMPATIBLE with 'Manual Feed'
2024-12-21 21:07:43.529 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_5_event_preview1734808492.jpg don't need to download it
2024-12-21 21:07:43.530 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_4_event_preview1734801673.jpg don't need to download it
2024-12-21 21:07:43.549 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_5_event_preview1734808492.jpg don't need to download it
2024-12-21 21:07:43.549 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_4_event_preview1734801673.jpg don't need to download it
2024-12-21 21:07:43.552 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_5_event_preview1734808492.jpg don't need to download it
2024-12-21 21:07:43.552 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_4_event_preview1734801673.jpg don't need to download it
2024-12-21 21:07:43.694 DEBUG (MainThread) [pypetkitapi.medias] Save file OK : /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg.enc
2024-12-21 21:07:43.701 DEBUG (MainThread) [pypetkitapi.medias] Save file OK : /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg.enc
2024-12-21 21:07:43.702 DEBUG (MainThread) [pypetkitapi.medias] Save file OK : /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg.enc
2024-12-21 21:07:43.711 DEBUG (MainThread) [pypetkitapi.medias] Decrypt was successful
2024-12-21 21:07:43.712 DEBUG (MainThread) [pypetkitapi.medias] Decrypt was successful
2024-12-21 21:07:43.714 DEBUG (MainThread) [pypetkitapi.medias] Decrypt was successful
2024-12-21 21:07:43.723 DEBUG (MainThread) [pypetkitapi.medias] Save file OK : /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg
2024-12-21 21:07:43.724 DEBUG (MainThread) [custom_components.petkit] Getting image for d4sh Path is :/config/custom_components/petkit/images/d4sh_300005185_5_event_preview1734808492.jpg
2024-12-21 21:07:43.726 DEBUG (MainThread) [pypetkitapi.medias] Save file OK : /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg
2024-12-21 21:07:43.726 ERROR (MainThread) [pypetkitapi.medias] Error get media file from http://petkit-cloud-storage-7-prod-eu.oss-eu-central-1.aliyuncs.com/d4sh/300005185/8_EVENT_PREVIEW1734811232?Expires=1734815241&OSSAccessKeyId=LTAI5tMrYpaAxKw1cLNGfVC5&Signature=HPMoOKY6Pk3WTsSJfYgywh9dqls%3D: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg.enc'
2024-12-21 21:07:43.726 DEBUG (MainThread) [custom_components.petkit] Getting image for d4sh Path is :/config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg
2024-12-21 21:07:43.728 DEBUG (MainThread) [pypetkitapi.medias] Save file OK : /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg
2024-12-21 21:07:43.731 ERROR (MainThread) [pypetkitapi.medias] Error get media file from http://petkit-cloud-storage-7-prod-eu.oss-eu-central-1.aliyuncs.com/d4sh/300005185/8_EVENT_PREVIEW1734811232?Expires=1734815241&OSSAccessKeyId=LTAI5tMrYpaAxKw1cLNGfVC5&Signature=HPMoOKY6Pk3WTsSJfYgywh9dqls%3D: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg.enc'
2024-12-21 21:07:43.732 DEBUG (MainThread) [custom_components.petkit] Getting image for d4sh Path is :/config/custom_components/petkit/images/d4sh_300005185_4_event_preview1734801673.jpg
2024-12-21 21:07:51.794 DEBUG (MainThread) [pypetkitapi.client] List devices data for account: device_list=[] expired=False group_id=300140629 name='Ma famille' owner=100683640 pet_list=[] user_list=[User(avatar='https://petkit-storage-image-prod-eu.oss-eu-central-1.aliyuncs.com/uavatar/2024/12/22/1734799758133100683640', created_at=1705880238516, is_owner=1, user_id=100683640, user_name='Home Assistant')]
2024-12-21 21:07:51.795 DEBUG (MainThread) [pypetkitapi.client] List devices data for account: device_list=[Device(created_at=1706119725321, device_id=400014845, device_name='Fontaine', device_type='W5', group_id=300081737, type=14, type_code=4, unique_id='400014845-14'), Device(created_at=1721305887770, device_id=300005185, device_name='Pet Feeder', device_type='D4sh', group_id=300081737, type=25, type_code=0, unique_id='300005185-25')] expired=False group_id=300081737 name='Ma famille' owner=100629971 pet_list=[] user_list=[User(avatar='https://sandbox-img5.petkit.cn/banner/2022/10/13/6347d75a44ad08000b011e7dDzwc693i5', created_at=1692902467605, is_owner=1, user_id=100629971, user_name='Mr\nShagoY'), User(avatar='https://petkit-storage-image-prod-eu.oss-eu-central-1.aliyuncs.com/uavatar/2024/12/22/1734799758133100683640', created_at=1705880458908, is_owner=0, user_id=100683640, user_name='Home Assistant')]
2024-12-21 21:07:51.796 DEBUG (MainThread) [pypetkitapi.client] Devices in account: [Device(created_at=1706119725321, device_id=400014845, device_name='Fontaine', device_type='W5', group_id=300081737, type=14, type_code=4, unique_id='400014845-14'), Device(created_at=1721305887770, device_id=300005185, device_name='Pet Feeder', device_type='D4sh', group_id=300081737, type=25, type_code=0, unique_id='300005185-25')]
2024-12-21 21:07:51.796 DEBUG (MainThread) [pypetkitapi.client] Reading device type : w5 (id=400014845)
2024-12-21 21:07:51.796 DEBUG (MainThread) [pypetkitapi.client] Request: POST https://api.eu-pet.com/latest/w5/deviceData
2024-12-21 21:07:51.797 DEBUG (MainThread) [pypetkitapi.client] Reading device type : d4sh (id=300005185)
2024-12-21 21:07:51.798 DEBUG (MainThread) [pypetkitapi.client] Request: POST https://api.eu-pet.com/latest/d4sh/device_detail
2024-12-21 21:07:51.866 DEBUG (MainThread) [pypetkitapi.client] Device data fetched OK for w5
2024-12-21 21:07:51.962 DEBUG (MainThread) [pypetkitapi.client] Device data fetched OK for d4sh
2024-12-21 21:07:51.963 DEBUG (MainThread) [pypetkitapi.client] Reading device type : w5 (id=400014845)
2024-12-21 21:07:51.963 DEBUG (MainThread) [pypetkitapi.client] Endpoint not found for device type: w5
2024-12-21 21:07:51.963 DEBUG (MainThread) [pypetkitapi.client] Reading device type : d4sh (id=300005185)
2024-12-21 21:07:51.963 DEBUG (MainThread) [pypetkitapi.client] Request: POST https://api.eu-pet.com/latest/d4sh/getDeviceRecord
2024-12-21 21:07:52.086 DEBUG (MainThread) [pypetkitapi.client] Device records fetched OK for d4sh
2024-12-21 21:07:52.086 DEBUG (MainThread) [pypetkitapi.client] Petkit data fetched successfully in: 0:00:00.291908
2024-12-21 21:07:52.087 DEBUG (MainThread) [custom_components.petkit] Finished fetching petkit data in 0.293 seconds (success: True)
2024-12-21 21:07:52.101 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_5_event_preview1734808492.jpg don't need to download it
2024-12-21 21:07:52.102 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_4_event_preview1734801673.jpg don't need to download it
2024-12-21 21:07:52.102 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_8_event_preview1734811232.jpg don't need to download it
2024-12-21 21:07:52.102 DEBUG (MainThread) [custom_components.petkit] Getting image for d4sh Path is :/config/custom_components/petkit/images/d4sh_300005185_5_event_preview1734808492.jpg
2024-12-21 21:07:52.103 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_5_event_preview1734808492.jpg don't need to download it
2024-12-21 21:07:52.103 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_4_event_preview1734801673.jpg don't need to download it
2024-12-21 21:07:52.103 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_8_event_preview1734811232.jpg don't need to download it
2024-12-21 21:07:52.103 DEBUG (MainThread) [custom_components.petkit] Getting image for d4sh Path is :/config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734811232.jpg
2024-12-21 21:07:52.104 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_5_event_preview1734808492.jpg don't need to download it
2024-12-21 21:07:52.104 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_4_event_preview1734801673.jpg don't need to download it
2024-12-21 21:07:52.104 DEBUG (MainThread) [pypetkitapi.medias] File already exist : d4sh_300005185_8_event_preview1734811232.jpg don't need to download it
2024-12-21 21:07:52.104 DEBUG (MainThread) [custom_components.petkit] Getting image for d4sh Path is :/config/custom_components/petkit/images/d4sh_300005185_4_event_preview1734801673.jpg

Diagnostics dump

No response

@Jezza34000
Copy link
Owner

Hello,
These messages are not really errors. They will be removed in the next release to avoid misinterpretation.
Check on your application if the latest preview of the "Feed" "Eat" "Visit" tabs matches what is downloaded here.

@Jezza34000 Jezza34000 added the Bug Something isn't working label Dec 22, 2024
@ShagoY
Copy link
Author

ShagoY commented Dec 22, 2024

Ok after testing, it turns out that some sensors and images don't update automatically.

For example, binary_sensor.pet_feeder_eating and image.pet_feeder_last_eat_event were updated when I manually reloaded the integration at 12h28 (I also relaunched the integration at 02h28):
image
image

While sensor.pet_feeder_times_eaten recorded my cats' visits:
image

Another bug: I switched my subscription from Premium to Basic, so the new Basic subscription will be activated at the end of the old one.
However, the binary_sensor.pet_feeder_care_subscription indicates “off”:
image

@ShagoY ShagoY changed the title Error get media file Some sensors do not update automatically Dec 22, 2024
@Jezza34000
Copy link
Owner

@ShagoY
Copy link
Author

ShagoY commented Dec 23, 2024

Hi Jezza,
Sometimes when I go to my dashboard, which displays the 3 image sensors, some of them don't appear. I have to refresh manually to get everything back in order.
But every time, I get errors in my logs:

Logger: aiohttp.server
Source: /usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py:451
First occurred: December 22, 2024 at 18:05:18 (21 occurrences)
Last logged: 09:45:20

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 480, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/image/__init__.py", line 309, in get
    return await self.handle(request, image_entity)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/image/__init__.py", line 316, in handle
    image = await _async_get_image(image_entity, IMAGE_TIMEOUT)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/image/__init__.py", line 101, in _async_get_image
    if image_bytes := await image_entity.async_image():
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/petkit/image.py", line 123, in async_image
    await self.media_handler.get_last_image(
        self.coordinator.data.get(self.device.id)
    )
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/medias.py", line 66, in get_last_image
    await self._process_records(records, record_type)
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/medias.py", line 108, in _process_records
    await process_item(record.items)
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/medias.py", line 87, in process_item
    await self.media_download_decode.get_file(
        last_item.preview, last_item.aes_key
    )
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/medias.py", line 141, in get_file
    decrypted_data = await self._decrypt_image_from_file(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        encrypted_file_path, aes_key
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/medias.py", line 197, in _decrypt_image_from_file
    Path(file_path).unlink()
    ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/pathlib/_local.py", line 746, in unlink
    os.unlink(self)
    ~~~~~~~~~^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_4_event_preview1734887082.jpg.enc'
Logger: root
Source: custom_components/petkit/image.py:123
integration: Petkit Smart Devices (documentation, issues)
First occurred: December 22, 2024 at 17:53:54 (9 occurrences)
Last logged: 09:45:20

Error decrypting image from file /config/custom_components/petkit/images/d4sh_300005185_5_event_preview1734898803.jpg.enc: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_5_event_preview1734898803.jpg.enc'
Error decrypting image from file /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734899318.jpg.enc: Zero-length input cannot be unpadded
Error decrypting image from file /config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734901018.jpg.enc: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_8_event_preview1734901018.jpg.enc'
Error decrypting image from file /config/custom_components/petkit/images/d4sh_300005185_5_event_preview1734940862.jpg.enc: Zero-length input cannot be unpadded
Error decrypting image from file /config/custom_components/petkit/images/d4sh_300005185_5_event_preview1734940862.jpg.enc: [Errno 2] No such file or directory: '/config/custom_components/petkit/images/d4sh_300005185_5_event_preview1734940862.jpg.enc'

@ShagoY
Copy link
Author

ShagoY commented Dec 23, 2024

I don't have any record of use of my Yumshare :(

...

EDIT : You told me that the binary_sensor was broken yesterday, so that's probably it.

@ShagoY
Copy link
Author

ShagoY commented Dec 23, 2024

Where a simple page refresh on a browser restores the images, on the application I have to kill it and then relaunch it.

[EDITED]

When I press the image "Last eat event" :

[EDITED]

Here the State attributes for image.pet_feeder_last_eat_event :

access_token: [EDITED]
entity_picture: >-
  /api/image_proxy/image.pet_feeder_last_eat_event?token=[EDITED]
friendly_name: Pet Feeder Last eat event

@Jezza34000 Jezza34000 self-assigned this Dec 24, 2024
@ShagoY
Copy link
Author

ShagoY commented Dec 24, 2024

Hi Jezza,
Since 1.3.5, my images display correctly and all my sensors update properly :)
{48EB3EC7-8C68-4722-BAE9-EA18D1257089}

Now my only problem is the binary_sensor.pet_feeder_care_subscription which doesn't display the correct status of my subscription.
Now it's not really a problem!

{A35063DB-DB4C-4624-8D7C-2B072A926D33}

Thanks again for your integration and I wish you happy holidays :)

@Jezza34000
Copy link
Owner

I sent you message on Discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants