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
29 changed files with 46 additions and 177 deletions

View File

@@ -20,7 +20,6 @@ _RESOURCE = "http://apilayer.net/api/live"
DEFAULT_BASE = "USD"
DEFAULT_NAME = "CurrencyLayer Sensor"
ICON = "mdi:currency"
SCAN_INTERVAL = timedelta(hours=4)
@@ -60,6 +59,7 @@ class CurrencylayerSensor(SensorEntity):
"""Implementing the Currencylayer sensor."""
_attr_attribution = "Data provided by currencylayer.com"
_attr_icon = "mdi:currency"
def __init__(self, rest, base, quote):
"""Initialize the sensor."""
@@ -78,11 +78,6 @@ class CurrencylayerSensor(SensorEntity):
"""Return the name of the sensor."""
return self._base
@property
def icon(self):
"""Return the icon to use in the frontend, if any."""
return ICON
@property
def native_value(self):
"""Return the state of the sensor."""