Simplify Tesla icon get code (#30301)
* Simplify icon get code * Remove extraneous None
This commit is contained in:
1 parent
4031596aa7
commit
5ed44297e6
2 files changed
+3
-7
No files matched your search
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user