Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Resch <robert@resch.dev>
  • Loading branch information
CFenner and edenhaus committed Nov 28, 2023
1 parent e8a3cc1 commit e0a6c0e
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions homeassistant/components/vicare/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,9 @@ def update(self) -> None:
self._attr_native_value = self.entity_description.value_getter(
self._api
)
if (min_fn := self.entity_description.min_value_getter) and (
min_value := min_fn(self._api)
):
self._attr_native_min_value = min_value

if (max_fn := self.entity_description.max_value_getter) and (
max_value := max_fn(self._api)
):
self._attr_native_max_value = max_value

if (stepping_fn := self.entity_description.stepping_getter) and (
stepping_value := stepping_fn(self._api)
):
self._attr_native_step = stepping_value
self._attr_native_min_value = get_value(self.entity_description.min_value_getter, self._api)
self._attr_native_max_value = get_value(self.entity_description.max_value_getter, self._api)
self._attr_native_step = get_value(self.entity_description.stepping_getter, self._api)
except RequestConnectionError:
_LOGGER.error("Unable to retrieve data from ViCare server")
except ValueError:
Expand Down

0 comments on commit e0a6c0e

Please sign in to comment.