Move icon constants to entity attributes (#90518)

* Move icon constants to attribute

* Adjust test
This commit is contained in:
epenet 2023-03-31 09:34:17 +02:00 committed by GitHub
parent 2e0ecf9bd9
commit d0c38c1e12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 46 additions and 177 deletions

View file

@ -10,7 +10,6 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN
SWITCH_PREFIX = "Switch"
ICON = "mdi:toggle-switch"
async def async_setup_entry(
@ -55,6 +54,8 @@ async def async_setup_entry(
class SmappeeActuator(SwitchEntity):
"""Representation of a Smappee Comport Plug."""
_attr_icon = "mdi:toggle-switch"
def __init__(
self,
smappee_base,
@ -105,11 +106,6 @@ class SmappeeActuator(SwitchEntity):
# Switch or comfort plug
return self._state == "ON_ON"
@property
def icon(self):
"""Icon to use in the frontend."""
return ICON
def turn_on(self, **kwargs: Any) -> None:
"""Turn on Comport Plug."""
if self._actuator_type in ("SWITCH", "COMFORT_PLUG"):