Add additional sensors to pyLoad integration (#120309)

This commit is contained in:
Mr. Bubbles 2024-06-24 18:56:33 +02:00 committed by GitHub
parent 31157828e1
commit 1e5f4c2d75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 998 additions and 0 deletions

View file

@ -22,6 +22,7 @@ from homeassistant.const import (
CONF_SSL,
CONF_USERNAME,
UnitOfDataRate,
UnitOfInformation,
)
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
@ -40,7 +41,11 @@ from .coordinator import PyLoadCoordinator
class PyLoadSensorEntity(StrEnum):
"""pyLoad Sensor Entities."""
ACTIVE = "active"
FREE_SPACE = "free_space"
QUEUE = "queue"
SPEED = "speed"
TOTAL = "total"
SENSOR_DESCRIPTIONS: tuple[SensorEntityDescription, ...] = (
@ -52,6 +57,26 @@ SENSOR_DESCRIPTIONS: tuple[SensorEntityDescription, ...] = (
suggested_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND,
suggested_display_precision=1,
),
SensorEntityDescription(
key=PyLoadSensorEntity.ACTIVE,
translation_key=PyLoadSensorEntity.ACTIVE,
),
SensorEntityDescription(
key=PyLoadSensorEntity.QUEUE,
translation_key=PyLoadSensorEntity.QUEUE,
),
SensorEntityDescription(
key=PyLoadSensorEntity.TOTAL,
translation_key=PyLoadSensorEntity.TOTAL,
),
SensorEntityDescription(
key=PyLoadSensorEntity.FREE_SPACE,
translation_key=PyLoadSensorEntity.FREE_SPACE,
device_class=SensorDeviceClass.DATA_SIZE,
native_unit_of_measurement=UnitOfInformation.BYTES,
suggested_unit_of_measurement=UnitOfInformation.GIBIBYTES,
suggested_display_precision=1,
),
)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(