FL550 / dwd_weather

Deutscher Wetterdienst integration for Home-Assistant
MIT License
157 stars 11 forks source link

AttributeError: 'int' object has no attribute 'year' #105

Closed holger-dunst closed 8 months ago

holger-dunst commented 8 months ago

After updating to the latest version there is a new error in the log files: AttributeError: 'int' object has no attribute 'year'

Version of home_assistant

Home Assistant 2023.10.5 Supervisor 2023.10.1 Operating System 11.1 Frontend 20231005.0 - latest

Version of the custom_component

v2.0.10

Describe the bug

Error message in the logfile during using the forecast service.

Debug log


2023-11-01 07:00:00.260 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Unexpected error for call_service at pos 1: 'int' object has no attribute 'year'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2049, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 1076, in async_get_forecast_service
    native_forecast_list = await weather.async_forecast_hourly()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dwd_weather/weather.py", line 59, in async_forecast_hourly
    return self._connector.get_forecast(WeatherEntityFeature.FORECAST_HOURLY)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dwd_weather/connector.py", line 148, in get_forecast
    timestep.hour < self.sun.riseutc(timestep.day).hour
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/suntimes/suntimes.py", line 241, in riseutc
    j_greg = self.J_rise_set_greg(date)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/suntimes/suntimes.py", line 223, in J_rise_set_greg
    J_transit = self.solar_transit(date)
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/suntimes/suntimes.py", line 192, in solar_transit
    JJ = self.mean_solar_noon(date)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/suntimes/suntimes.py", line 169, in mean_solar_noon
    Jdate = gcal2jd(date.year, date.month, date.day)
                    ^^^^^^^^^
AttributeError: 'int' object has no attribute 'year'