Move icon constants to entity attributes (#90518)
* Move icon constants to attribute * Adjust test
This commit is contained in:
parent
2e0ecf9bd9
commit
d0c38c1e12
29 changed files with 46 additions and 177 deletions
|
@ -24,7 +24,6 @@ DEFAULT_NAME = "Random Sensor"
|
|||
DEFAULT_MIN = 0
|
||||
DEFAULT_MAX = 20
|
||||
|
||||
ICON = "mdi:hanger"
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
{
|
||||
|
@ -54,6 +53,8 @@ async def async_setup_platform(
|
|||
class RandomSensor(SensorEntity):
|
||||
"""Representation of a Random number sensor."""
|
||||
|
||||
_attr_icon = "mdi:hanger"
|
||||
|
||||
def __init__(self, name, minimum, maximum, unit_of_measurement):
|
||||
"""Initialize the Random sensor."""
|
||||
self._name = name
|
||||
|
@ -72,11 +73,6 @@ class RandomSensor(SensorEntity):
|
|||
"""Return the state of the device."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon to use in the frontend, if any."""
|
||||
return ICON
|
||||
|
||||
@property
|
||||
def native_unit_of_measurement(self):
|
||||
"""Return the unit this state is expressed in."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue