Skip to content

Commit

Permalink
sensor should also get exception on async update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuen Lee committed Dec 26, 2023
1 parent c4642db commit 3d35541
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions custom_components/polestar_api/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ def unit_of_measurement(self) -> str:

async def async_update(self) -> None:
"""Get the latest data and updates the states."""
await self._device.async_update()
self._attr_native_value = self._device.get_value(
self.description.query, self.description.field_name, self.get_skip_cache())
try:
await self._device.async_update()
self._attr_native_value = self._device.get_value(
self.description.query, self.description.field_name, self.get_skip_cache())
except Exception:
_LOGGER.warning("Failed to update sensor async update")

0 comments on commit 3d35541

Please sign in to comment.