Use gibibytes for onedrive (#138637)

* Use gibibytes for onedrive

* also to strings
This commit is contained in:
Josef Zweck authored and GitHub committed 2025-02-16 14:08:01 +02:00
1 parent 3ce8e1683a
commit 95b1cf465b
4 files changed
+17 -17

No files matched your search

+3 -3
View File
@@ -36,7 +36,7 @@ DRIVE_STATE_ENTITIES: tuple[OneDriveSensorEntityDescription, ...] = (
key="total_size",
value_fn=lambda quota: quota.total,
native_unit_of_measurement=UnitOfInformation.BYTES,
suggested_unit_of_measurement=UnitOfInformation.GIGABYTES,
suggested_unit_of_measurement=UnitOfInformation.GIBIBYTES,
suggested_display_precision=0,
device_class=SensorDeviceClass.DATA_SIZE,
entity_category=EntityCategory.DIAGNOSTIC,
@@ -46,7 +46,7 @@ DRIVE_STATE_ENTITIES: tuple[OneDriveSensorEntityDescription, ...] = (
key="used_size",
value_fn=lambda quota: quota.used,
native_unit_of_measurement=UnitOfInformation.BYTES,
suggested_unit_of_measurement=UnitOfInformation.GIGABYTES,
suggested_unit_of_measurement=UnitOfInformation.GIBIBYTES,
suggested_display_precision=2,
device_class=SensorDeviceClass.DATA_SIZE,
entity_category=EntityCategory.DIAGNOSTIC,
@@ -55,7 +55,7 @@ DRIVE_STATE_ENTITIES: tuple[OneDriveSensorEntityDescription, ...] = (
key="remaining_size",
value_fn=lambda quota: quota.remaining,
native_unit_of_measurement=UnitOfInformation.BYTES,
suggested_unit_of_measurement=UnitOfInformation.GIGABYTES,
suggested_unit_of_measurement=UnitOfInformation.GIBIBYTES,
suggested_display_precision=2,
device_class=SensorDeviceClass.DATA_SIZE,
entity_category=EntityCategory.DIAGNOSTIC,
@@ -32,11 +32,11 @@
"issues": {
"drive_full": {
"title": "OneDrive data cap exceeded",
"description": "Your OneDrive has exceeded your quota limit. This means your next backup will fail. Please free up some space or upgrade your OneDrive plan. Currently using {used} GB of {total} GB."
"description": "Your OneDrive has exceeded your quota limit. This means your next backup will fail. Please free up some space or upgrade your OneDrive plan. Currently using {used} GiB of {total} GiB."
},
"drive_almost_full": {
"title": "OneDrive near data cap",
"description": "Your OneDrive is near your quota limit. If you go over this limit your drive will be temporarily frozen and your backups will start failing. Please free up some space or upgrade your OneDrive plan. Currently using {used} GB of {total} GB."
"description": "Your OneDrive is near your quota limit. If you go over this limit your drive will be temporarily frozen and your backups will start failing. Please free up some space or upgrade your OneDrive plan. Currently using {used} GiB of {total} GiB."
}
},
"exceptions": {
+2 -2
View File
@@ -110,9 +110,9 @@ MOCK_DRIVE = Drive(
owner=IDENTITY_SET,
quota=DriveQuota(
deleted=5,
remaining=750000000,
remaining=805306368,
state=DriveState.NEARING,
total=5000000000,
total=5368709120,
used=4250000000,
),
)
@@ -86,7 +86,7 @@
'suggested_display_precision': 2,
}),
'sensor.private': dict({
'suggested_unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
'suggested_unit_of_measurement': <UnitOfInformation.GIBIBYTES: 'GiB'>,
}),
}),
'original_device_class': <SensorDeviceClass.DATA_SIZE: 'data_size'>,
@@ -97,7 +97,7 @@
'supported_features': 0,
'translation_key': 'remaining_size',
'unique_id': 'mock_drive_id_remaining_size',
'unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
'unit_of_measurement': <UnitOfInformation.GIBIBYTES: 'GiB'>,
})
# ---
# name: test_sensors[sensor.my_drive_remaining_storage-state]
@@ -105,7 +105,7 @@
'attributes': ReadOnlyDict({
'device_class': 'data_size',
'friendly_name': 'My Drive Remaining storage',
'unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
'unit_of_measurement': <UnitOfInformation.GIBIBYTES: 'GiB'>,
}),
'context': <ANY>,
'entity_id': 'sensor.my_drive_remaining_storage',
@@ -141,7 +141,7 @@
'suggested_display_precision': 0,
}),
'sensor.private': dict({
'suggested_unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
'suggested_unit_of_measurement': <UnitOfInformation.GIBIBYTES: 'GiB'>,
}),
}),
'original_device_class': <SensorDeviceClass.DATA_SIZE: 'data_size'>,
@@ -152,7 +152,7 @@
'supported_features': 0,
'translation_key': 'total_size',
'unique_id': 'mock_drive_id_total_size',
'unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
'unit_of_measurement': <UnitOfInformation.GIBIBYTES: 'GiB'>,
})
# ---
# name: test_sensors[sensor.my_drive_total_available_storage-state]
@@ -160,7 +160,7 @@
'attributes': ReadOnlyDict({
'device_class': 'data_size',
'friendly_name': 'My Drive Total available storage',
'unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
'unit_of_measurement': <UnitOfInformation.GIBIBYTES: 'GiB'>,
}),
'context': <ANY>,
'entity_id': 'sensor.my_drive_total_available_storage',
@@ -196,7 +196,7 @@
'suggested_display_precision': 2,
}),
'sensor.private': dict({
'suggested_unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
'suggested_unit_of_measurement': <UnitOfInformation.GIBIBYTES: 'GiB'>,
}),
}),
'original_device_class': <SensorDeviceClass.DATA_SIZE: 'data_size'>,
@@ -207,7 +207,7 @@
'supported_features': 0,
'translation_key': 'used_size',
'unique_id': 'mock_drive_id_used_size',
'unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
'unit_of_measurement': <UnitOfInformation.GIBIBYTES: 'GiB'>,
})
# ---
# name: test_sensors[sensor.my_drive_used_storage-state]
@@ -215,13 +215,13 @@
'attributes': ReadOnlyDict({
'device_class': 'data_size',
'friendly_name': 'My Drive Used storage',
'unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
'unit_of_measurement': <UnitOfInformation.GIBIBYTES: 'GiB'>,
}),
'context': <ANY>,
'entity_id': 'sensor.my_drive_used_storage',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '4.25',
'state': '3.95812094211578',
})
# ---