Skip to content

Commit 4525932

Browse files
Fix rounding (#746)
1 parent dbc4ff7 commit 4525932

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

custom_components/battery_notes/binary_sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ async def async_state_changed_listener(
272272

273273
if isfloat(wrapped_battery_state.state):
274274
if self.round_battery:
275-
battery_level = int(wrapped_battery_state.state)
275+
battery_level = round(float(wrapped_battery_state.state), 0)
276276
else:
277277
battery_level = round(float(wrapped_battery_state.state), 1)
278278
else:

custom_components/battery_notes/sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def async_state_changed_listener(
321321
self._attr_available = True
322322

323323
if self.round_battery:
324-
self._attr_native_value = int(wrapped_battery_state.state)
324+
self._attr_native_value = round(float(wrapped_battery_state.state), 0)
325325
else:
326326
self._attr_native_value = round(float(wrapped_battery_state.state), 1)
327327

0 commit comments

Comments
 (0)