Use new enums in switcher_kis (#62400)
Co-authored-by: epenet <epenet@users.noreply.github.com>pull/62393/head^2
parent
e5cf9b78bd
commit
75000c317b
|
@ -6,10 +6,9 @@ from dataclasses import dataclass
|
|||
from aioswitcher.device import DeviceCategory
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
DEVICE_CLASS_CURRENT,
|
||||
DEVICE_CLASS_POWER,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ELECTRIC_CURRENT_AMPERE, POWER_WATT
|
||||
|
@ -40,14 +39,14 @@ POWER_SENSORS = {
|
|||
"power_consumption": AttributeDescription(
|
||||
name="Power Consumption",
|
||||
unit=POWER_WATT,
|
||||
device_class=DEVICE_CLASS_POWER,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
"electric_current": AttributeDescription(
|
||||
name="Electric Current",
|
||||
unit=ELECTRIC_CURRENT_AMPERE,
|
||||
device_class=DEVICE_CLASS_CURRENT,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
}
|
||||
|
||||
|
|
|
@ -10,11 +10,7 @@ from aioswitcher.api import Command, SwitcherApi, SwitcherBaseResponse
|
|||
from aioswitcher.device import DeviceCategory, DeviceState
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import (
|
||||
DEVICE_CLASS_OUTLET,
|
||||
DEVICE_CLASS_SWITCH,
|
||||
SwitchEntity,
|
||||
)
|
||||
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import (
|
||||
|
@ -169,13 +165,13 @@ class SwitcherBaseSwitchEntity(CoordinatorEntity, SwitchEntity):
|
|||
class SwitcherPowerPlugSwitchEntity(SwitcherBaseSwitchEntity):
|
||||
"""Representation of a Switcher power plug switch entity."""
|
||||
|
||||
_attr_device_class = DEVICE_CLASS_OUTLET
|
||||
_attr_device_class = SwitchDeviceClass.OUTLET
|
||||
|
||||
|
||||
class SwitcherWaterHeaterSwitchEntity(SwitcherBaseSwitchEntity):
|
||||
"""Representation of a Switcher water heater switch entity."""
|
||||
|
||||
_attr_device_class = DEVICE_CLASS_SWITCH
|
||||
_attr_device_class = SwitchDeviceClass.SWITCH
|
||||
|
||||
async def async_set_auto_off_service(self, auto_off: timedelta) -> None:
|
||||
"""Use for handling setting device auto-off service calls."""
|
||||
|
|
Loading…
Reference in New Issue