Use new enums in devolo_home_network (#61348)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-09 12:05:09 +01:00 committed by GitHub
parent c5815ef936
commit 50940844b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,13 +8,13 @@ from typing import Any
from devolo_plc_api.device import Device
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
@ -44,7 +44,7 @@ class DevoloSensorEntityDescription(
SENSOR_TYPES: dict[str, DevoloSensorEntityDescription] = {
CONNECTED_PLC_DEVICES: DevoloSensorEntityDescription(
key=CONNECTED_PLC_DEVICES,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
icon="mdi:lan",
name="Connected PLC devices",
@ -57,12 +57,12 @@ SENSOR_TYPES: dict[str, DevoloSensorEntityDescription] = {
entity_registry_enabled_default=True,
icon="mdi:wifi",
name="Connected Wifi clients",
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
value_func=lambda data: len(data["connected_stations"]),
),
NEIGHBORING_WIFI_NETWORKS: DevoloSensorEntityDescription(
key=NEIGHBORING_WIFI_NETWORKS,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
icon="mdi:wifi-marker",
name="Neighboring Wifi networks",