Skip to content
This repository was archived by the owner on Dec 21, 2022. It is now read-only.

Commit 40e3d6f

Browse files
alandtsefabaff
authored andcommitted
Change default icons for Tesla components (home-assistant#30288)
1 parent d0c9a42 commit 40e3d6f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

homeassistant/components/tesla/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
configured_instances,
2727
validate_input,
2828
)
29-
from .const import DATA_LISTENER, DOMAIN, TESLA_COMPONENTS
29+
from .const import DATA_LISTENER, DOMAIN, SENSOR_ICONS, TESLA_COMPONENTS
3030

3131
_LOGGER = logging.getLogger(__name__)
3232

@@ -186,6 +186,11 @@ def __init__(self, tesla_device, controller, config_entry):
186186
self._name = self.tesla_device.name
187187
self.tesla_id = slugify(self.tesla_device.uniq_name)
188188
self._attributes = {}
189+
self._icon = (
190+
SENSOR_ICONS[self.tesla_device.type]
191+
if self.tesla_device.type and self.tesla_device.type in SENSOR_ICONS.keys()
192+
else None
193+
)
189194

190195
@property
191196
def name(self):
@@ -197,6 +202,11 @@ def unique_id(self) -> str:
197202
"""Return a unique ID."""
198203
return self.tesla_id
199204

205+
@property
206+
def icon(self):
207+
"""Return the icon of the sensor."""
208+
return self._icon
209+
200210
@property
201211
def should_poll(self):
202212
"""Return the polling state."""

0 commit comments

Comments
 (0)