HomeAssistant-Tapo-Control
HomeAssistant-Tapo-Control copied to clipboard
Issues with mediasync and folders on NFS share
Description
Hi I am not a coder or anything like it but i kept stumbling to an issue and "solved" it after checking the error and code.
Setup: HA 2024.2.3 Tapo Control latest version 4 TP-Link C100 cameras HA running in a VM in a NAS with Skyconnect
I enabled mediasync and mapped on HA storage a NFS shared folder on the nas. All the time (sorry i do not have the error i was getting errors about the addon routine about deleting existing recordings with the time defined on the media sync. The path in the error had always double // and after i made the change below the errors stopped and media sync is working.
Reproduction Steps
- Enable media sync
- Define cold storage path
- restart integration
- errors in logs
Expected behavior
No errors about media deletion and path to media files after configuration is done.
If applicable, add error logs.
Sorry cleared the logs
Device Firmware
1.3.9 Build 231019 Rel.40264n(4555)
Integration Version
5.4.14
Using stream component
Yes
Does camera work via official integrations?
Yes
Camera has all attributes filled out in developer tools
Yes
HASS Environment
Synology NAS
Search for similar issues
Yes
Additional information
async def deleteColdFilesOlderThanMaxSyncTime(hass, entry, extension, folder):
entry_id = entry.entry_id
mediaSyncHours = entry.data.get(MEDIA_SYNC_HOURS)
if mediaSyncHours != "":
coldDirPath = getColdDirPathForEntry(hass, entry_id)
tapoController: Tapo = hass.data[DOMAIN][entry_id]["controller"]
timeCorrection = await hass.async_add_executor_job(
tapoController.getTimeCorrection
)
mediaSyncTime = int(mediaSyncHours) * 60 * 60
entry_id = entry.entry_id
ts = datetime.datetime.utcnow().timestamp()
#if os.path.exists(coldDirPath + "/" + folder + "/"):
# for f in os.listdir(coldDirPath + "/" + folder + "/"):
# fileName = f.replace(extension, "")
# filePath = os.path.join(coldDirPath + "/" + folder + "/", f)
if os.path.exists(coldDirPath + folder + "/"):
for f in os.listdir(coldDirPath + folder + "/"):
fileName = f.replace(extension, "")
filePath = os.path.join(coldDirPath + folder + "/", f)