Skip to content

Commit

Permalink
Update sensor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinebou12 committed Mar 1, 2024
1 parent 674d3e8 commit d6972da
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions custom_components/renpho/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ async def async_update(self) -> None:
)

if metric_value is not None:
converted_value = metric_value * KG_TO_LBS if self._unit_of_measurement == MASS_POUNDS else metric_value
self._state = converted_value
self._state = round(metric_value * KG_TO_LBS, 2) if self._unit_of_measurement == MASS_POUNDS else round(metric_value, 2)
self._timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
_LOGGER.info(f"Successfully updated {self._name} for metric type {self._metric}")
else:
Expand Down

0 comments on commit d6972da

Please sign in to comment.