From 110ae2eca70b8412eb8edb13f0d55ae3f88a4bef Mon Sep 17 00:00:00 2001 From: Josef Zweck Date: Wed, 12 Feb 2025 18:57:39 +0100 Subject: [PATCH] Add documentation for onedrive sensor platform. (#37393) * Update onedrive.markdown * Update OneDrive alert description for clarity * Remove empty metadata field in OneDrive integration * Fix typo in OneDrive integration documentation * implement feedback from rabbit Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * update ids --------- Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- source/_integrations/onedrive.markdown | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/source/_integrations/onedrive.markdown b/source/_integrations/onedrive.markdown index 955ebd677e9..b8faac2151f 100644 --- a/source/_integrations/onedrive.markdown +++ b/source/_integrations/onedrive.markdown @@ -61,6 +61,59 @@ If you set the integration up with the default credentials and switch to custom You will need an Azure tenant with an active Azure subscription to create your own client credentials. {% endtip %} +## Sensors + +The integration provides the following sensors, which are updated every 5 minutes: + +- **Total available storage**: The total size of your drive (disabled by default) +- **Used storage**: The amount of storage you have used up +- **Remaining storage**: The amount of storage that is left in your drive +- **Drive state**: Calculated state of your drive, based on the storage left. Possible values: `Normal`, `Nearing limit`, `Critical`, `Exceeded` + +{% note %} +A drive that is in **Drive state** `Exceeded` will be automatically frozen (meaning you can't upload any more backups & files), until you clear up enough storage. +{% endnote %} + +## Automations + +Get started with these automation examples. + +### Send alert when drive is near storage limit + +Send an alert when the drive usage is close to the storage limit and needs cleanup. + +{% details "Example YAML configuration" %} + +{% raw %} + +```yaml +alias: Alert when OneDrive is close to storage limit +description: Send notification to phone when drive needs cleanup. +triggers: + - trigger: state + entity_id: + - sensor.my_drive_drive_state + from: "normal" + to: "nearing" + - trigger: state + entity_id: + - sensor.my_drive_drive_state + from: "nearing" + to: "critical" +actions: + - action: notify.mobile_app_iphone + data: + title: OneDrive is almost full! + message: > + OneDrive has used up {{ states('sensor.my_drive_used_storage') }} of {{ + states('sensor.my_drive_total_available') }}GB. Only {{ states('sensor.my_drive_remaining_storage') }}GB remaining. +mode: single +``` + +{% endraw %} +{% enddetails %} + + ## Known limitations - Only personal OneDrives are supported at the moment.