Support Nextcloud as a backup location (introduced in HA 2025.1

HA 2025.1 introduced the completely improved backup subsystem. It’d be fantastic if Nextcloud was supported as an additional backup location.

I am currently using GitHub - Sebclem/hassio-nextcloud-backup: Hass.io Add-on: Backup your snapshots to Nextcloud but the add-on doesn’t seem to be that actively developed any more. And given that we now have such a nice subsystem in core, it’d be a shame to not support it with Nextcloud. An equally popular tool.

Here’s the development documentation for the new Backup functionality in Home Assistant: Backup | Home Assistant Developer Docs

backup.py should be created within the Nextcloud integration folder and populated with the relevant code. I’m not 100% certain on how to request a user’s files & folders from Nextcloud’s API or WebDAV protocol programmatically, so I might have to sit this one out. I’m not a developer, just someone that’s used Python in very small areas to repeat manual efforts.

Of note: The Nextcloud integration currently cites requiring an admin user as it exposes system information as part of the integration. This unfortunately means that the user’s files in which you’re wanting to store your Home Assistant backups at must be configured as an admin user. This doesn’t follow the principle of least-privilege in my eyes, as a standard user for user data (i.e. file storage) should be separate from an admin user that administers the server. If this were to be developed, there may be some reconfiguration necessary to permit non-administrator users to authenticate to this integration and expose the non-administrator’s file storage to Home Assistant as a remote target for Home Assistant’s backup storage location.

I would not oppose learning a bit about integration and Home Assistant development, so if anyone is willing to implement this and be a bit verbose with explaining the moving pieces, that would be resourceful if nothing else.

Lastly, this user is listed as the contributor to the Nextcloud integration on the integration page. This person could likely be useful for implementing this feature.

The more I think about this, the more I wonder if the integrations should be reorganized? Existing Nextcloud integration renamed to Nextcloud Administration or something similar, and a new integration created for tasks with standard users, like backups, file storage, future expansion? Or can the existing integration utilize two authenticated users? This is where my lack of dev knowledge shows.

1 Like

Does nextcloud support samba/smb? Or nfs? If so, it is already supported.

Nope as none of them can be exposed on internet for security reasons ! I do backup of my HA on Nextcloud since ages using the rclone add-on (the Nextcloud add-on is buggy for large uploads). GitHub - jcwillox/hassio-rclone-backup: Home Assistant addon to automatically sync backups to remote locations using Rclone
It works great of course with NC but an insane large numbers of online storages too :wink:

This should probably be implemented as a generic WebDAV backup agent. WebDAV is a standardized protocol and supported by many different servers including Nextcloud, Owncloud or plain Apache servers using mod_dav.

5 Likes

Just FYI for others here: I have a directory on my Nextcloud storage used for backups for various systems. I configured an NFS share for this directory restricted to Home Assistant and mounted this directory locally in Home Assistant.

Settings > System > Storage > Add Network Storage

When you select “Backup” as the usage intent, this exposes the directory as a storage location for the automated backups.