Split Owncloud CPU load in separate sensors (#99141)

* split cpu load values into own sensors

* apply suggestion
This commit is contained in:
Michael 2023-08-27 19:34:58 +02:00 committed by GitHub
parent d17ffff3e3
commit cc103ddbaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 5 deletions

View File

@ -54,6 +54,11 @@ class NextcloudDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
key_path += f"{key}_"
leaf = True
result.update(self._get_data_points(value, key_path, leaf))
elif key == "cpuload" and isinstance(value, list):
result[f"{key_path}{key}_1"] = value[0]
result[f"{key_path}{key}_5"] = value[1]
result[f"{key_path}{key}_15"] = value[2]
leaf = False
else:
result[f"{key_path}{key}"] = value
leaf = False

View File

@ -171,10 +171,26 @@ SENSORS: Final[dict[str, SensorEntityDescription]] = {
translation_key="nextcloud_system_apps_num_updates_available",
icon="mdi:update",
),
"system_cpuload": SensorEntityDescription(
key="system_cpuload",
translation_key="nextcloud_system_cpuload",
"system_cpuload_1": SensorEntityDescription(
key="system_cpuload_1",
translation_key="nextcloud_system_cpuload_1",
native_unit_of_measurement=UNIT_OF_LOAD,
icon="mdi:chip",
suggested_display_precision=2,
),
"system_cpuload_5": SensorEntityDescription(
key="system_cpuload_5",
translation_key="nextcloud_system_cpuload_5",
native_unit_of_measurement=UNIT_OF_LOAD,
icon="mdi:chip",
suggested_display_precision=2,
),
"system_cpuload_15": SensorEntityDescription(
key="system_cpuload_15",
translation_key="nextcloud_system_cpuload_15",
native_unit_of_measurement=UNIT_OF_LOAD,
icon="mdi:chip",
suggested_display_precision=2,
),
"system_freespace": SensorEntityDescription(
key="system_freespace",

View File

@ -63,8 +63,14 @@
"nextcloud_system_freespace": {
"name": "Free space"
},
"nextcloud_system_cpuload": {
"name": "CPU Load"
"nextcloud_system_cpuload_1": {
"name": "CPU Load last minute"
},
"nextcloud_system_cpuload_15": {
"name": "CPU Load last 15 minutes"
},
"nextcloud_system_cpuload_5": {
"name": "CPU Load last 5 minutes"
},
"nextcloud_system_mem_total": {
"name": "Total memory"