Skip to content

Commit

Permalink
Fix rounding error preventing maximum charge/discharge rates being set (
Browse files Browse the repository at this point in the history
  • Loading branch information
cdpuk authored Mar 17, 2023
1 parent 1a72775 commit 55bd40b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/givenergy_local/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ def watts_to_api_value(self, watts: int) -> int:
There is added complexity here because the API values depend on the battery &
inverter capabilities.
"""
target_value = int(watts / self.battery_power_step)
target_value = watts / self.battery_power_step
max_step = int(self.inverter_max_battery_power / self.battery_power_step)

# The API always jumps to 50 to represent the maximum possible value
return 50 if target_value > max_step else target_value
return 50 if target_value > max_step else int(target_value)


class InverterBatteryChargeLimitNumber(InverterBatteryPowerLimitNumber):
Expand Down

0 comments on commit 55bd40b

Please sign in to comment.