Skip to content

Commit

Permalink
Fix QNAP Sensor Entity Descriptions (home-assistant#94749)
Browse files Browse the repository at this point in the history
  • Loading branch information
disforw authored Jun 17, 2023
1 parent c4284c0 commit 71e8ee5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions homeassistant/components/qnap/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import (
ATTR_NAME,
Expand Down Expand Up @@ -70,6 +71,8 @@
name="System Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
icon="mdi:thermometer",
state_class=SensorStateClass.MEASUREMENT,
),
)
_CPU_MON_COND: tuple[SensorEntityDescription, ...] = (
Expand All @@ -78,12 +81,16 @@
name="CPU Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
icon="mdi:checkbox-marked-circle-outline",
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="cpu_usage",
name="CPU Usage",
native_unit_of_measurement=PERCENTAGE,
icon="mdi:chip",
state_class=SensorStateClass.MEASUREMENT,
),
)
_MEMORY_MON_COND: tuple[SensorEntityDescription, ...] = (
Expand All @@ -93,19 +100,24 @@
native_unit_of_measurement=UnitOfInformation.GIBIBYTES,
device_class=SensorDeviceClass.DATA_SIZE,
icon="mdi:memory",
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="memory_used",
name="Memory Used",
native_unit_of_measurement=UnitOfInformation.GIBIBYTES,
device_class=SensorDeviceClass.DATA_SIZE,
icon="mdi:memory",
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="memory_percent_used",
name="Memory Usage",
native_unit_of_measurement=PERCENTAGE,
icon="mdi:memory",
state_class=SensorStateClass.MEASUREMENT,
),
)
_NETWORK_MON_COND: tuple[SensorEntityDescription, ...] = (
Expand All @@ -120,26 +132,34 @@
native_unit_of_measurement=UnitOfDataRate.MEBIBYTES_PER_SECOND,
device_class=SensorDeviceClass.DATA_RATE,
icon="mdi:upload",
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="network_rx",
name="Network Down",
native_unit_of_measurement=UnitOfDataRate.MEBIBYTES_PER_SECOND,
device_class=SensorDeviceClass.DATA_RATE,
icon="mdi:download",
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
),
)
_DRIVE_MON_COND: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key="drive_smart_status",
name="SMART Status",
icon="mdi:checkbox-marked-circle-outline",
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="drive_temp",
name="Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
icon="mdi:thermometer",
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
),
)
_VOLUME_MON_COND: tuple[SensorEntityDescription, ...] = (
Expand All @@ -149,19 +169,24 @@
native_unit_of_measurement=UnitOfInformation.GIBIBYTES,
device_class=SensorDeviceClass.DATA_SIZE,
icon="mdi:chart-pie",
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="volume_size_free",
name="Free Space",
native_unit_of_measurement=UnitOfInformation.GIBIBYTES,
device_class=SensorDeviceClass.DATA_SIZE,
icon="mdi:chart-pie",
entity_registry_enabled_default=False,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="volume_percentage_used",
name="Volume Used",
native_unit_of_measurement=PERCENTAGE,
icon="mdi:chart-pie",
state_class=SensorStateClass.MEASUREMENT,
),
)

Expand Down

0 comments on commit 71e8ee5

Please sign in to comment.