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

@ -17,7 +17,6 @@ DEFAULT_NAME = "OTP Sensor"
TIME_STEP = 30 # Default time step assumed by Google Authenticator
ICON = "mdi:update"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
@ -44,6 +43,7 @@ async def async_setup_platform(
class TOTPSensor(SensorEntity):
"""Representation of a TOTP sensor."""
_attr_icon = "mdi:update"
_attr_should_poll = False
def __init__(self, name, token):
@ -76,8 +76,3 @@ class TOTPSensor(SensorEntity):
def native_value(self):
"""Return the state of the sensor."""
return self._state
@property
def icon(self):
"""Return the icon to use in the frontend."""
return ICON