Use device class to isolate tesla battery icon (#37446)
parent
4b2ebf5487
commit
6fd8a7a34e
|
@ -15,6 +15,7 @@ from homeassistant.const import (
|
|||
CONF_SCAN_INTERVAL,
|
||||
CONF_TOKEN,
|
||||
CONF_USERNAME,
|
||||
DEVICE_CLASS_BATTERY,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
||||
|
@ -222,7 +223,10 @@ class TeslaDevice(Entity):
|
|||
@property
|
||||
def icon(self):
|
||||
"""Return the icon of the sensor."""
|
||||
if self.tesla_device.has_battery():
|
||||
if (
|
||||
self.device_class == DEVICE_CLASS_BATTERY
|
||||
and self.tesla_device.has_battery()
|
||||
):
|
||||
return icon_for_battery_level(
|
||||
battery_level=self.tesla_device.battery_level(),
|
||||
charging=self.tesla_device.battery_charging(),
|
||||
|
|
Loading…
Reference in New Issue