JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
953 stars 80 forks source link

Media Sync not working with network storage on HA #499

Closed arturolaz closed 5 months ago

arturolaz commented 5 months ago

Description

I created a network storage share in HA with the name "HomeAssistantTapoMedia" and I'm trying to get the TapoControl integration to save the synced media there but it doesn't seem to be working

image

I tried the "df -a -T -h" in the ssh terminal to be sure I was making reference to the correct mounted drive, there I can see "/media/HomeAssistantTapoMedia" which I'm making reference to in the cold storage field but I've had no luck with it.

image

Reproduction Steps

  1. Add a network storage drive to HA
  2. Reference your path in the cold storage field for the Tapo Control integration

Expected behavior

I expect to see files being transfered from the Tapo Camera to the selected network drive

If applicable, add error logs.

No response

Device Firmware

Firmware: 1.1.7 Build 231122 Rel.55299n

Integration Version

5.4.13

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

RPi4

Search for similar issues

Yes

Additional information

No response

JurajNyiri commented 5 months ago

Hi, i had the same setup and it was downloading properly. Check the logs and see if it is actually downloading and if there are any errors.

arturolaz commented 5 months ago

Yesterday I made more tests and it worked, the problem was that I have quite a large amount of videos in the camera and the initial media scan was taking too long for me to notice an immediate start of sync after a reset.

Now I noticed another issue. No more than 4 videos are synced at the network drive before getting deleted and transfering another different 4 files. I have set the "number of hours to keep syncronized" to 24 just in case but made no difference.

arturolaz commented 5 months ago

I have tried setting different levels of permission to the folder but that also is not helping. I tried formating the SD card from the camera to be sure videos were newer than the "number of hours to keep syncronized" but also didn't work

I just saw this in the log:

2024-01-19 23:14:03.308 WARNING (MainThread) [pytapo.media_stream.session] Received response with no or invalid session information (sequence None, session None), can't be delivered 2024-01-19 23:16:27.638 WARNING (MainThread) [pytapo.media_stream.session] Received response with no or invalid session information (sequence None, session None), can't be delivered 2024-01-19 23:17:49.188 ERROR (MainThread) [custom_components.tapo_control] Invalid authentication data 2024-01-19 23:20:50.269 ERROR (MainThread) [custom_components.tapo_control] Unexpected error fetching Tapo resource status data: [Errno 2] No such file or directory: '/media/HomeAssistantTapoMedia//videos/1705727527-1705727592.mp4' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/tapo_control/init.py", line 508, in async_update_data await mediaCleanup(hass, entry) File "/config/custom_components/tapo_control/utils.py", line 355, in mediaCleanup deleteFilesNoLongerPresentInCamera(hass, entry_id, ".mp4", "videos") File "/config/custom_components/tapo_control/utils.py", line 290, in deleteFilesNoLongerPresentInCamera os.remove(filePath) FileNotFoundError: [Errno 2] No such file or directory: '/media/HomeAssistantTapoMedia//videos/1705727527-1705727592.mp4'

Could you guide me on how to resolve this issue?

JurajNyiri commented 5 months ago

"Invalid authentication data" points to incorrect authentication data for cloud account. Remove the camera from tapo account, remove it from tapo integration, enable internet access for it if blocked, reset password on tapo, factory reset, add back to account, add back to tapo integration. And try again. If the issue persists open new issue.

Closing as the original issue isn't the issue anymore.