Use new SwitchDeviceClass enum in home-plus-control (#61760)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-14 09:56:52 +01:00 committed by GitHub
parent de45144750
commit 8fc69b7242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,7 @@
"""Legrand Home+ Control Switch Entity Module that uses the HomeAssistant DataUpdateCoordinator."""
from functools import partial
from homeassistant.components.switch import (
DEVICE_CLASS_OUTLET,
DEVICE_CLASS_SWITCH,
SwitchEntity,
)
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.core import callback
from homeassistant.helpers import dispatcher
from homeassistant.helpers.entity import DeviceInfo
@ -97,8 +93,8 @@ class HomeControlSwitchEntity(CoordinatorEntity, SwitchEntity):
def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
if self.module.device == "plug":
return DEVICE_CLASS_OUTLET
return DEVICE_CLASS_SWITCH
return SwitchDeviceClass.OUTLET
return SwitchDeviceClass.SWITCH
@property
def available(self) -> bool: