mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Simplify Tesla icon get code (#30301)
* Simplify icon get code * Remove extraneous None
This commit is contained in:
parent
4031596aa7
commit
5ed44297e6
@ -26,7 +26,7 @@ from .config_flow import (
|
||||
configured_instances,
|
||||
validate_input,
|
||||
)
|
||||
from .const import DATA_LISTENER, DOMAIN, SENSOR_ICONS, TESLA_COMPONENTS
|
||||
from .const import DATA_LISTENER, DOMAIN, ICONS, TESLA_COMPONENTS
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -186,11 +186,7 @@ class TeslaDevice(Entity):
|
||||
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
|
||||
)
|
||||
self._icon = ICONS.get(self.tesla_device.type)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -9,7 +9,7 @@ TESLA_COMPONENTS = [
|
||||
"device_tracker",
|
||||
"switch",
|
||||
]
|
||||
SENSOR_ICONS = {
|
||||
ICONS = {
|
||||
"battery sensor": "mdi:battery",
|
||||
"range sensor": "mdi:gauge",
|
||||
"mileage sensor": "mdi:counter",
|
||||
|
Loading…
x
Reference in New Issue
Block a user