mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Correct synology_dsm CPU sensor's naming and measurement unit (#45500)
This commit is contained in:
parent
285bd3aa91
commit
c90588d35d
@ -37,6 +37,7 @@ DEFAULT_PORT_SSL = 5001
|
|||||||
DEFAULT_SCAN_INTERVAL = 15 # min
|
DEFAULT_SCAN_INTERVAL = 15 # min
|
||||||
DEFAULT_TIMEOUT = 10 # sec
|
DEFAULT_TIMEOUT = 10 # sec
|
||||||
|
|
||||||
|
ENTITY_UNIT_LOAD = "load"
|
||||||
|
|
||||||
ENTITY_NAME = "name"
|
ENTITY_NAME = "name"
|
||||||
ENTITY_UNIT = "unit"
|
ENTITY_UNIT = "unit"
|
||||||
@ -95,50 +96,50 @@ STORAGE_DISK_BINARY_SENSORS = {
|
|||||||
# Sensors
|
# Sensors
|
||||||
UTILISATION_SENSORS = {
|
UTILISATION_SENSORS = {
|
||||||
f"{SynoCoreUtilization.API_KEY}:cpu_other_load": {
|
f"{SynoCoreUtilization.API_KEY}:cpu_other_load": {
|
||||||
ENTITY_NAME: "CPU Load (Other)",
|
ENTITY_NAME: "CPU Utilization (Other)",
|
||||||
ENTITY_UNIT: PERCENTAGE,
|
ENTITY_UNIT: PERCENTAGE,
|
||||||
ENTITY_ICON: "mdi:chip",
|
ENTITY_ICON: "mdi:chip",
|
||||||
ENTITY_CLASS: None,
|
ENTITY_CLASS: None,
|
||||||
ENTITY_ENABLE: False,
|
ENTITY_ENABLE: False,
|
||||||
},
|
},
|
||||||
f"{SynoCoreUtilization.API_KEY}:cpu_user_load": {
|
f"{SynoCoreUtilization.API_KEY}:cpu_user_load": {
|
||||||
ENTITY_NAME: "CPU Load (User)",
|
ENTITY_NAME: "CPU Utilization (User)",
|
||||||
ENTITY_UNIT: PERCENTAGE,
|
ENTITY_UNIT: PERCENTAGE,
|
||||||
ENTITY_ICON: "mdi:chip",
|
ENTITY_ICON: "mdi:chip",
|
||||||
ENTITY_CLASS: None,
|
ENTITY_CLASS: None,
|
||||||
ENTITY_ENABLE: True,
|
ENTITY_ENABLE: True,
|
||||||
},
|
},
|
||||||
f"{SynoCoreUtilization.API_KEY}:cpu_system_load": {
|
f"{SynoCoreUtilization.API_KEY}:cpu_system_load": {
|
||||||
ENTITY_NAME: "CPU Load (System)",
|
ENTITY_NAME: "CPU Utilization (System)",
|
||||||
ENTITY_UNIT: PERCENTAGE,
|
ENTITY_UNIT: PERCENTAGE,
|
||||||
ENTITY_ICON: "mdi:chip",
|
ENTITY_ICON: "mdi:chip",
|
||||||
ENTITY_CLASS: None,
|
ENTITY_CLASS: None,
|
||||||
ENTITY_ENABLE: False,
|
ENTITY_ENABLE: False,
|
||||||
},
|
},
|
||||||
f"{SynoCoreUtilization.API_KEY}:cpu_total_load": {
|
f"{SynoCoreUtilization.API_KEY}:cpu_total_load": {
|
||||||
ENTITY_NAME: "CPU Load (Total)",
|
ENTITY_NAME: "CPU Utilization (Total)",
|
||||||
ENTITY_UNIT: PERCENTAGE,
|
ENTITY_UNIT: PERCENTAGE,
|
||||||
ENTITY_ICON: "mdi:chip",
|
ENTITY_ICON: "mdi:chip",
|
||||||
ENTITY_CLASS: None,
|
ENTITY_CLASS: None,
|
||||||
ENTITY_ENABLE: True,
|
ENTITY_ENABLE: True,
|
||||||
},
|
},
|
||||||
f"{SynoCoreUtilization.API_KEY}:cpu_1min_load": {
|
f"{SynoCoreUtilization.API_KEY}:cpu_1min_load": {
|
||||||
ENTITY_NAME: "CPU Load (1 min)",
|
ENTITY_NAME: "CPU Load Averarge (1 min)",
|
||||||
ENTITY_UNIT: PERCENTAGE,
|
ENTITY_UNIT: ENTITY_UNIT_LOAD,
|
||||||
ENTITY_ICON: "mdi:chip",
|
ENTITY_ICON: "mdi:chip",
|
||||||
ENTITY_CLASS: None,
|
ENTITY_CLASS: None,
|
||||||
ENTITY_ENABLE: False,
|
ENTITY_ENABLE: False,
|
||||||
},
|
},
|
||||||
f"{SynoCoreUtilization.API_KEY}:cpu_5min_load": {
|
f"{SynoCoreUtilization.API_KEY}:cpu_5min_load": {
|
||||||
ENTITY_NAME: "CPU Load (5 min)",
|
ENTITY_NAME: "CPU Load Averarge (5 min)",
|
||||||
ENTITY_UNIT: PERCENTAGE,
|
ENTITY_UNIT: ENTITY_UNIT_LOAD,
|
||||||
ENTITY_ICON: "mdi:chip",
|
ENTITY_ICON: "mdi:chip",
|
||||||
ENTITY_CLASS: None,
|
ENTITY_CLASS: None,
|
||||||
ENTITY_ENABLE: True,
|
ENTITY_ENABLE: True,
|
||||||
},
|
},
|
||||||
f"{SynoCoreUtilization.API_KEY}:cpu_15min_load": {
|
f"{SynoCoreUtilization.API_KEY}:cpu_15min_load": {
|
||||||
ENTITY_NAME: "CPU Load (15 min)",
|
ENTITY_NAME: "CPU Load Averarge (15 min)",
|
||||||
ENTITY_UNIT: PERCENTAGE,
|
ENTITY_UNIT: ENTITY_UNIT_LOAD,
|
||||||
ENTITY_ICON: "mdi:chip",
|
ENTITY_ICON: "mdi:chip",
|
||||||
ENTITY_CLASS: None,
|
ENTITY_CLASS: None,
|
||||||
ENTITY_ENABLE: True,
|
ENTITY_ENABLE: True,
|
||||||
|
@ -19,6 +19,7 @@ from . import SynoApi, SynologyDSMDeviceEntity, SynologyDSMDispatcherEntity
|
|||||||
from .const import (
|
from .const import (
|
||||||
CONF_VOLUMES,
|
CONF_VOLUMES,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
ENTITY_UNIT_LOAD,
|
||||||
INFORMATION_SENSORS,
|
INFORMATION_SENSORS,
|
||||||
STORAGE_DISK_SENSORS,
|
STORAGE_DISK_SENSORS,
|
||||||
STORAGE_VOL_SENSORS,
|
STORAGE_VOL_SENSORS,
|
||||||
@ -88,6 +89,10 @@ class SynoDSMUtilSensor(SynologyDSMDispatcherEntity):
|
|||||||
if self._unit == DATA_RATE_KILOBYTES_PER_SECOND:
|
if self._unit == DATA_RATE_KILOBYTES_PER_SECOND:
|
||||||
return round(attr / 1024.0, 1)
|
return round(attr / 1024.0, 1)
|
||||||
|
|
||||||
|
# CPU load average
|
||||||
|
if self._unit == ENTITY_UNIT_LOAD:
|
||||||
|
return round(attr / 100, 2)
|
||||||
|
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user