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,9 +17,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .const import (
ATTRIBUTION,
DEFAULT_NAME,
ICON,
MIN_TIME_BETWEEN_UPDATES,
SENSOR_NAME,
SENSOR_TYPE,
@ -83,7 +81,8 @@ async def async_setup_entry(
class SrpEntity(SensorEntity):
"""Implementation of a Srp Energy Usage sensor."""
_attr_attribution = ATTRIBUTION
_attr_attribution = "Powered by SRP Energy"
_attr_icon = "mdi:flash"
_attr_should_poll = False
def __init__(self, coordinator):
@ -116,11 +115,6 @@ class SrpEntity(SensorEntity):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement
@property
def icon(self):
"""Return icon."""
return ICON
@property
def usage(self):
"""Return entity state."""