Add option in OneDrive-integration to permanently delete older backup Items

Looking at the docs for the Graph API, I noticed there is a new method for permanently deleting a file, bypassing the recycle bin:
https://learn.microsoft.com/en-us/graph/api/driveitem-permanentdelete?view=graph-rest-1.0

I use the new Backup-feature of HA with the Cloudspace of “onedrive”.
It would be nice to include an option to not only move the older backups on onedrive to the trashfolder but permanently delete them directly as all deleted backups else first go into the Trash-Folder for at least 30 more days and “eat up” my disc-quota and brings the cloudspace very soon to the limit.

HA-core: 2025.2.4

Voted. Did not have any backups deleted yet from Onedrive, but I soon will find out. As I only have 5.5 Gb, and my backups are 1.5 Gb, the thought to always have 3 backups in Onedrive will be fake if the trash blocks the upload.

In fact you will end up having only one very old backup in onedrive as it refuses to store any newer one, once disc quota is reached

The irony is, I got 1 Tb that is hardly used, but it does not work because it is a business account.

This will be configurable in 2025.3

3 Likes

The behaviour is completely buggy right now on 2025.3.3. I have configured to keep 2 backups, but home assistant fails to delete them consistently. Just today there were 4 backups on OneDrive. Due to this it constantly also complains:

Error during backup in async_upload_backup:, message {“error”:{“code”:“quotaLimitReached”,“message”:“Quota limit reached”,“innerError”:{“date”:“2025-03-15T03:22:44”,“request-id”:“e33d1cde-f4f9-41ee-9a34-7d12a96d2030”,“client-request-id”:“e33d1cde-f4f9-41ee-9a34-7d12a96d2030”}}}

After 30 days of deleting old backups (with letting it be moved to the onedrive-trash) I’m convinced now, that this does not harm my onedrive disc-quota at all. Which is really nice, as I have much more backups available now. :wink: If needed I even can fetch deleted ones back out of the trash.

@tackin

You should not have marked this as solved. It has not been properly fixed or made configurable. It may work for you, but as you can see from my post just before you it’s still really buggy in 2025.3.3. I now have to manually delete OneDrive backups in order for Home Assistant to be able to write new ones if quota is reached. It has no way of organizing itself around quota limits. Just warns and gives up.

where can i configure this? i have installed 2025.3.3.

edit: i found it. go to services → integrations → onedrive → click on configure