From 6fd8a7a34e8a750d2871f289416d509d570dd8fd Mon Sep 17 00:00:00 2001 From: Chris Talkington <chris@talkingtontech.com> Date: Sat, 4 Jul 2020 01:10:04 -0500 Subject: [PATCH] Use device class to isolate tesla battery icon (#37446) --- homeassistant/components/tesla/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/tesla/__init__.py b/homeassistant/components/tesla/__init__.py index 5cf5eb4fc5d..0b5f366817a 100644 --- a/homeassistant/components/tesla/__init__.py +++ b/homeassistant/components/tesla/__init__.py @@ -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(), -- GitLab