fix: handle float values in userhorizon configuration (#657)

Replace int() with round() when converting userhorizon values to properly
handle float values in the configuration. This prevents validation errors
when users provide horizon angles with decimal precision.

The Akkudoktor API expects integer values, so rounding to the nearest
integer maintains compatibility while accepting float inputs.

Fixes #647

Co-authored-by: Tobias Welz <tobias-wizneteu@gmail.com>
This commit is contained in:
7tobias 2025-08-22 16:41:40 +02:00 committed by GitHub
parent cacb21529b
commit decae10434
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -254,7 +254,7 @@ class PVForecastAkkudoktor(PVForecastProvider):
f"powerInverter={int(self.config.pvforecast.planes_inverter_paco[i])}" f"powerInverter={int(self.config.pvforecast.planes_inverter_paco[i])}"
) )
horizon_values = ",".join( horizon_values = ",".join(
str(int(h)) for h in self.config.pvforecast.planes_userhorizon[i] str(round(h)) for h in self.config.pvforecast.planes_userhorizon[i]
) )
query_params.append(f"horizont={horizon_values}") query_params.append(f"horizont={horizon_values}")