mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Fix Tesla attribute refreshing (#42257)
* Fix Tesla attribute refreshing * Remove extraneous copy
This commit is contained in:
parent
2787a52ef7
commit
b54dde10ca
@ -282,7 +282,7 @@ class TeslaDevice(CoordinatorEntity):
|
|||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
attr = self._attributes.copy()
|
attr = self._attributes
|
||||||
if self.tesla_device.has_battery():
|
if self.tesla_device.has_battery():
|
||||||
attr[ATTR_BATTERY_LEVEL] = self.tesla_device.battery_level()
|
attr[ATTR_BATTERY_LEVEL] = self.tesla_device.battery_level()
|
||||||
attr[ATTR_BATTERY_CHARGING] = self.tesla_device.battery_charging()
|
attr[ATTR_BATTERY_CHARGING] = self.tesla_device.battery_charging()
|
||||||
@ -310,4 +310,5 @@ class TeslaDevice(CoordinatorEntity):
|
|||||||
This assumes the coordinator has updated the controller.
|
This assumes the coordinator has updated the controller.
|
||||||
"""
|
"""
|
||||||
self.tesla_device.refresh()
|
self.tesla_device.refresh()
|
||||||
|
self._attributes = self.tesla_device.attrs.copy()
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user