mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 05:35:11 +02:00
Use device class to isolate tesla battery icon (#37446)
This commit is contained in:
@@ -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(),
|
||||
|
Reference in New Issue
Block a user