Fix BrightSky date format. (#393)

BrightSky needs date format with 4 digits year and 2 digits month and day.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
Bobby Noelte 2025-01-20 19:14:35 +01:00 committed by GitHub
parent 89cd9ca11d
commit df2e3f7864
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,8 +96,8 @@ class WeatherBrightSky(WeatherProvider):
ValueError: If the API response does not include expected `weather` data. ValueError: If the API response does not include expected `weather` data.
""" """
source = "https://api.brightsky.dev" source = "https://api.brightsky.dev"
date = to_datetime(self.start_datetime, as_string="Y-M-D") date = to_datetime(self.start_datetime, as_string="YYYY-MM-DD")
last_date = to_datetime(self.end_datetime, as_string="Y-M-D") last_date = to_datetime(self.end_datetime, as_string="YYYY-MM-DD")
response = requests.get( response = requests.get(
f"{source}/weather?lat={self.config.latitude}&lon={self.config.longitude}&date={date}&last_date={last_date}&tz={self.config.timezone}" f"{source}/weather?lat={self.config.latitude}&lon={self.config.longitude}&date={date}&last_date={last_date}&tz={self.config.timezone}"
) )