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 aioswitcher.device import DeviceCategory
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
DEVICE_CLASS_CURRENT,
|
SensorDeviceClass,
|
||||||
DEVICE_CLASS_POWER,
|
|
||||||
STATE_CLASS_MEASUREMENT,
|
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ELECTRIC_CURRENT_AMPERE, POWER_WATT
|
from homeassistant.const import ELECTRIC_CURRENT_AMPERE, POWER_WATT
|
||||||
|
@ -40,14 +39,14 @@ POWER_SENSORS = {
|
||||||
"power_consumption": AttributeDescription(
|
"power_consumption": AttributeDescription(
|
||||||
name="Power Consumption",
|
name="Power Consumption",
|
||||||
unit=POWER_WATT,
|
unit=POWER_WATT,
|
||||||
device_class=DEVICE_CLASS_POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
"electric_current": AttributeDescription(
|
"electric_current": AttributeDescription(
|
||||||
name="Electric Current",
|
name="Electric Current",
|
||||||
unit=ELECTRIC_CURRENT_AMPERE,
|
unit=ELECTRIC_CURRENT_AMPERE,
|
||||||
device_class=DEVICE_CLASS_CURRENT,
|
device_class=SensorDeviceClass.CURRENT,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,7 @@ from aioswitcher.api import Command, SwitcherApi, SwitcherBaseResponse
|
||||||
from aioswitcher.device import DeviceCategory, DeviceState
|
from aioswitcher.device import DeviceCategory, DeviceState
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import (
|
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
|
||||||
DEVICE_CLASS_OUTLET,
|
|
||||||
DEVICE_CLASS_SWITCH,
|
|
||||||
SwitchEntity,
|
|
||||||
)
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import (
|
from homeassistant.helpers import (
|
||||||
|
@ -169,13 +165,13 @@ class SwitcherBaseSwitchEntity(CoordinatorEntity, SwitchEntity):
|
||||||
class SwitcherPowerPlugSwitchEntity(SwitcherBaseSwitchEntity):
|
class SwitcherPowerPlugSwitchEntity(SwitcherBaseSwitchEntity):
|
||||||
"""Representation of a Switcher power plug switch entity."""
|
"""Representation of a Switcher power plug switch entity."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_OUTLET
|
_attr_device_class = SwitchDeviceClass.OUTLET
|
||||||
|
|
||||||
|
|
||||||
class SwitcherWaterHeaterSwitchEntity(SwitcherBaseSwitchEntity):
|
class SwitcherWaterHeaterSwitchEntity(SwitcherBaseSwitchEntity):
|
||||||
"""Representation of a Switcher water heater switch entity."""
|
"""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:
|
async def async_set_auto_off_service(self, auto_off: timedelta) -> None:
|
||||||
"""Use for handling setting device auto-off service calls."""
|
"""Use for handling setting device auto-off service calls."""
|
||||||
|
|
Loading…
Reference in New Issue