From b54dde10ca33b074cd5e6627dd595a5bf1331ef8 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Sat, 24 Oct 2020 12:13:40 -0700 Subject: [PATCH] Fix Tesla attribute refreshing (#42257) * Fix Tesla attribute refreshing * Remove extraneous copy --- homeassistant/components/tesla/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/tesla/__init__.py b/homeassistant/components/tesla/__init__.py index a04c5975881..51090d34271 100644 --- a/homeassistant/components/tesla/__init__.py +++ b/homeassistant/components/tesla/__init__.py @@ -282,7 +282,7 @@ class TeslaDevice(CoordinatorEntity): @property def device_state_attributes(self): """Return the state attributes of the device.""" - attr = self._attributes.copy() + attr = self._attributes if self.tesla_device.has_battery(): attr[ATTR_BATTERY_LEVEL] = self.tesla_device.battery_level() attr[ATTR_BATTERY_CHARGING] = self.tesla_device.battery_charging() @@ -310,4 +310,5 @@ class TeslaDevice(CoordinatorEntity): This assumes the coordinator has updated the controller. """ self.tesla_device.refresh() + self._attributes = self.tesla_device.attrs.copy() self.async_write_ha_state()