Skip to content

Commit

Permalink
Change default icons for Tesla components (#30288)
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse authored and fabaff committed Dec 30, 2019
1 parent d0c9a42 commit 40e3d6f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion homeassistant/components/tesla/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
configured_instances,
validate_input,
)
from .const import DATA_LISTENER, DOMAIN, TESLA_COMPONENTS
from .const import DATA_LISTENER, DOMAIN, SENSOR_ICONS, TESLA_COMPONENTS

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -186,6 +186,11 @@ def __init__(self, tesla_device, controller, config_entry):
self._name = self.tesla_device.name
self.tesla_id = slugify(self.tesla_device.uniq_name)
self._attributes = {}
self._icon = (
SENSOR_ICONS[self.tesla_device.type]
if self.tesla_device.type and self.tesla_device.type in SENSOR_ICONS.keys()
else None
)

@property
def name(self):
Expand All @@ -197,6 +202,11 @@ def unique_id(self) -> str:
"""Return a unique ID."""
return self.tesla_id

@property
def icon(self):
"""Return the icon of the sensor."""
return self._icon

@property
def should_poll(self):
"""Return the polling state."""
Expand Down

0 comments on commit 40e3d6f

Please sign in to comment.