mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Improve Glances entity descriptions, add long term statistics (#73049)
This commit is contained in:
parent
d19fc0622b
commit
8865a58f74
@ -4,7 +4,11 @@ from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
import sys
|
||||
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntityDescription,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.const import DATA_GIBIBYTES, DATA_MEBIBYTES, PERCENTAGE, TEMP_CELSIUS
|
||||
|
||||
DOMAIN = "glances"
|
||||
@ -40,6 +44,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="used percent",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:harddisk",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="disk_use",
|
||||
@ -47,6 +52,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="used",
|
||||
native_unit_of_measurement=DATA_GIBIBYTES,
|
||||
icon="mdi:harddisk",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="disk_free",
|
||||
@ -54,6 +60,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="free",
|
||||
native_unit_of_measurement=DATA_GIBIBYTES,
|
||||
icon="mdi:harddisk",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="memory_use_percent",
|
||||
@ -61,6 +68,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="RAM used percent",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:memory",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="memory_use",
|
||||
@ -68,6 +76,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="RAM used",
|
||||
native_unit_of_measurement=DATA_MEBIBYTES,
|
||||
icon="mdi:memory",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="memory_free",
|
||||
@ -75,6 +84,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="RAM free",
|
||||
native_unit_of_measurement=DATA_MEBIBYTES,
|
||||
icon="mdi:memory",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="swap_use_percent",
|
||||
@ -82,6 +92,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="Swap used percent",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:memory",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="swap_use",
|
||||
@ -89,6 +100,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="Swap used",
|
||||
native_unit_of_measurement=DATA_GIBIBYTES,
|
||||
icon="mdi:memory",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="swap_free",
|
||||
@ -96,41 +108,43 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="Swap free",
|
||||
native_unit_of_measurement=DATA_GIBIBYTES,
|
||||
icon="mdi:memory",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="processor_load",
|
||||
type="load",
|
||||
name_suffix="CPU load",
|
||||
native_unit_of_measurement="15 min",
|
||||
icon=CPU_ICON,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="process_running",
|
||||
type="processcount",
|
||||
name_suffix="Running",
|
||||
native_unit_of_measurement="Count",
|
||||
icon=CPU_ICON,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="process_total",
|
||||
type="processcount",
|
||||
name_suffix="Total",
|
||||
native_unit_of_measurement="Count",
|
||||
icon=CPU_ICON,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="process_thread",
|
||||
type="processcount",
|
||||
name_suffix="Thread",
|
||||
native_unit_of_measurement="Count",
|
||||
icon=CPU_ICON,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="process_sleeping",
|
||||
type="processcount",
|
||||
name_suffix="Sleeping",
|
||||
native_unit_of_measurement="Count",
|
||||
native_unit_of_measurement="",
|
||||
icon=CPU_ICON,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="cpu_use_percent",
|
||||
@ -138,6 +152,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="CPU used",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon=CPU_ICON,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="temperature_core",
|
||||
@ -145,6 +160,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="Temperature",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="temperature_hdd",
|
||||
@ -152,6 +168,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="Temperature",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="fan_speed",
|
||||
@ -159,6 +176,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="Fan speed",
|
||||
native_unit_of_measurement="RPM",
|
||||
icon="mdi:fan",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="battery",
|
||||
@ -166,13 +184,14 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="Charge",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:battery",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="docker_active",
|
||||
type="docker",
|
||||
name_suffix="Containers active",
|
||||
native_unit_of_measurement="",
|
||||
icon="mdi:docker",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="docker_cpu_use",
|
||||
@ -180,6 +199,7 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="Containers CPU used",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:docker",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="docker_memory_use",
|
||||
@ -187,17 +207,20 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||
name_suffix="Containers RAM used",
|
||||
native_unit_of_measurement=DATA_MEBIBYTES,
|
||||
icon="mdi:docker",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="used",
|
||||
type="raid",
|
||||
name_suffix="Raid used",
|
||||
icon="mdi:harddisk",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
GlancesSensorEntityDescription(
|
||||
key="available",
|
||||
type="raid",
|
||||
name_suffix="Raid available",
|
||||
icon="mdi:harddisk",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user