Use new DeviceClass enum in geniushub (#61608)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-13 17:39:38 +01:00 committed by GitHub
parent 3098778001
commit 3cfc349e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -4,8 +4,8 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
from typing import Any from typing import Any
from homeassistant.components.sensor import SensorEntity from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE from homeassistant.const import PERCENTAGE
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@ -76,7 +76,7 @@ class GeniusBattery(GeniusDevice, SensorEntity):
@property @property
def device_class(self) -> str: def device_class(self) -> str:
"""Return the device class of the sensor.""" """Return the device class of the sensor."""
return DEVICE_CLASS_BATTERY return SensorDeviceClass.BATTERY
@property @property
def native_unit_of_measurement(self) -> str: def native_unit_of_measurement(self) -> str:

View File

@ -3,7 +3,7 @@ from datetime import timedelta
import voluptuous as vol import voluptuous as vol
from homeassistant.components.switch import DEVICE_CLASS_OUTLET, SwitchEntity from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv, entity_platform from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
@ -55,7 +55,7 @@ class GeniusSwitch(GeniusZone, SwitchEntity):
@property @property
def device_class(self): def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES.""" """Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_OUTLET return SwitchDeviceClass.OUTLET
@property @property
def is_on(self) -> bool: def is_on(self) -> bool: