Cloudflare R2
Cloudflare R2 集成允许您将 Cloudflare R2 存储桶与 Home Assistant 备份一起使用。
先决条件
此集成需要一个现有的 R2 存储桶,以及对该存储桶的管理员访问权限,以便您可以创建 Secret Access Key。
创建新的 Cloudflare R2 存储桶
- 登录您的 Cloudflare Dashboard。
- 在侧边栏中,进入 Storage & databases,点击 R2 object storage,然后点击 Overview。
- 选择 + Create bucket。
- 选择一个唯一的 Bucket name,例如
home-assistant-backups-123456。 - 选择您首选的位置。
- 选择您偏好的存储类别;使用 Standard 即可,因为 Infrequent Access 仍处于测试阶段。
- 选择 Create bucket。
记下存储桶名称,稍后您会用到它。
创建 API Token/Secret Key
要创建可访问 R2 存储桶的新 Secret Key:
- 返回 R2 object storage > Overview 页面。
- 点击 Manage API Tokens。
- 点击 Create User API token。
- 为它命名,例如
Home Assistant Backup。 - 勾选 Object Read & Write。
- 点击 Apply to specific buckets only 并选择您之前创建的存储桶(例如
home-assistant-backups-123456)。 - 不要修改其他选项,点击 Create User API Token。
- 保存 Access Key ID、Secret Access Key 和 S3 endpoint。在 Home Assistant 中设置 Cloudflare R2 集成时需要这些信息。
Note
- 避免使用权限超出实际需要的凭据和 API Key。
- 通过将凭据限制为特定存储桶,您可以降低风险并帮助保护您的 Cloudflare 账户安全。
::: :::note 配置 此集成可通过 UI 配置。前往 设置 > 设备与服务 添加。
删除集成
To remove an integration instance from Home Assistant
- Go to Settings > Devices & services and select the integration card.
- From the list of devices, select the integration instance you want to remove.
- Next to the entry, select the three-dot
menu. Then, select Delete.

