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

@ -34,8 +34,6 @@ DEFAULT_SEED = 999
DEFAULT_UNIT = "value"
DEFAULT_RELATIVE_TO_EPOCH = True
ICON = "mdi:chart-line"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Optional(CONF_AMP, default=DEFAULT_AMP): vol.Coerce(float),
@ -79,6 +77,8 @@ def setup_platform(
class SimulatedSensor(SensorEntity):
"""Class for simulated sensor."""
_attr_icon = "mdi:chart-line"
def __init__(
self, name, unit, amp, mean, period, phase, fwhm, seed, relative_to_epoch
):
@ -135,11 +135,6 @@ class SimulatedSensor(SensorEntity):
"""Return the state of the sensor."""
return self._state
@property
def icon(self):
"""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."""