mlamberts78 / weather-chart-card

Custom weather card with charts.
MIT License
294 stars 35 forks source link

Showing weekday instead of hours in hourly forecast between 00:00 and 01:00 #169

Closed hg1337 closed 3 months ago

hg1337 commented 5 months ago

Describe the bug In the hourly chart, it shows the (same) weekday instead of the hour for each hour, but only between 00:00 and 01:00. Happens with multiple weather providers, e.g. the default met.no. Seems that the chart headers somehow think that it's a daily chart when the current (local) hour is 00.

To Reproduce Steps to reproduce the behavior:

  1. Add this chart to your dashbord:
    type: custom:weather-chart-card
    icons: /local/custom-lovelace/weather-chart-card/icons2/
    entity: weather.home
    show_main: false
    show_temperature: false
    show_current_condition: false
    show_attributes: false
    show_time: false
    show_time_seconds: false
    show_day: false
    show_date: false
    show_humidity: false
    show_pressure: false
    show_wind_direction: false
    show_wind_speed: false
    show_sun: false
    show_feels_like: false
    show_dew_point: false
    show_wind_gust_speed: false
    show_visibility: false
    show_last_changed: false
    use_12hour_format: false
    icons_size: '32'
    animated_icons: false
    icon_style: style1
    forecast:
    precipitation_type: rainfall
    show_probability: true
    labels_font_size: '11'
    precip_bar_size: '100'
    style: style1
    show_wind_forecast: true
    condition_icons: true
    round_temp: false
    type: hourly
    number_of_forecasts: '0'
    disable_animation: true
    chart_height: '150'
    units:
    pressure: ''
    speed: ''
  2. If it's between 01:00 and 23:59, everything looks normal.
  3. Wait till after midnight. (Depending on when the data is updated might take a few minutes.)
  4. Look at the chart, it shows weekdays instead of hours.

Expected behavior Shows hours like the other 23 hours of the day.

Screenshots image image Response from weather.get_forecasts service (my local timezone is CEST/+02:00, that's why 22:00:00+00:00 is midnight here):

weather.home:
  forecast:
    - condition: partlycloudy
      datetime: "2024-04-22T22:00:00+00:00"
      wind_bearing: 4
      cloud_coverage: 70.3
      temperature: 0.4
      wind_speed: 8.3
      precipitation: 0
      humidity: 82
    - condition: partlycloudy
      datetime: "2024-04-22T23:00:00+00:00"
      wind_bearing: 349.2
      cloud_coverage: 56.2
      temperature: 0.1
      wind_speed: 8.3
      precipitation: 0
      humidity: 82
    - condition: partlycloudy
      datetime: "2024-04-23T00:00:00+00:00"
      wind_bearing: 346.6
      cloud_coverage: 78.9
      temperature: 0.2
      wind_speed: 9.7
      precipitation: 0
      humidity: 81
    - condition: partlycloudy
      datetime: "2024-04-23T01:00:00+00:00"
      wind_bearing: 350.4
      cloud_coverage: 26.6
      temperature: -0.3
      wind_speed: 9.7
      precipitation: 0
      humidity: 83
    - condition: partlycloudy
      datetime: "2024-04-23T02:00:00+00:00"
      wind_bearing: 356.7
      cloud_coverage: 14.1
      temperature: -0.8
      wind_speed: 9.7
      precipitation: 0
      humidity: 84
    - condition: partlycloudy
      datetime: "2024-04-23T03:00:00+00:00"
      wind_bearing: 359.1
      cloud_coverage: 31.2
      temperature: -1.2
      wind_speed: 8.6
      precipitation: 0
      humidity: 85
    - condition: partlycloudy
      datetime: "2024-04-23T04:00:00+00:00"
      wind_bearing: 355.8
      cloud_coverage: 18
      temperature: -1.4
      wind_speed: 9
      precipitation: 0
      humidity: 86
    - condition: partlycloudy
      datetime: "2024-04-23T05:00:00+00:00"
      wind_bearing: 0
      cloud_coverage: 14.8
      temperature: -1.2
      wind_speed: 10.1
      precipitation: 0
      humidity: 86
    - condition: partlycloudy
      datetime: "2024-04-23T06:00:00+00:00"
      wind_bearing: 9.9
      cloud_coverage: 36.7
      temperature: 0.7
      wind_speed: 9.4
      precipitation: 0
      humidity: 80
    - condition: partlycloudy
      datetime: "2024-04-23T07:00:00+00:00"
      wind_bearing: 28.8
      cloud_coverage: 78.9
      temperature: 2.2
      wind_speed: 10.1
      precipitation: 0
      humidity: 71
    - condition: partlycloudy
      datetime: "2024-04-23T08:00:00+00:00"
      wind_bearing: 23.3
      cloud_coverage: 68
      temperature: 3.9
      wind_speed: 10.8
      precipitation: 0
      humidity: 68
    - condition: partlycloudy
      datetime: "2024-04-23T09:00:00+00:00"
      wind_bearing: 25
      cloud_coverage: 14.8
      temperature: 5.9
      wind_speed: 13
      precipitation: 0
      humidity: 63
    - condition: cloudy
      datetime: "2024-04-23T10:00:00+00:00"
      wind_bearing: 49.6
      cloud_coverage: 95.3
      temperature: 7.6
      wind_speed: 18
      precipitation: 0
      humidity: 50
    - condition: cloudy
      datetime: "2024-04-23T11:00:00+00:00"
      wind_bearing: 44.4
      cloud_coverage: 93.7
      temperature: 7.6
      wind_speed: 16.9
      precipitation: 0
      humidity: 47
    - condition: cloudy
      datetime: "2024-04-23T12:00:00+00:00"
      wind_bearing: 35
      cloud_coverage: 100
      temperature: 8.1
      wind_speed: 15.5
      precipitation: 0
      humidity: 45
    - condition: cloudy
      datetime: "2024-04-23T13:00:00+00:00"
      wind_bearing: 23.9
      cloud_coverage: 100
      temperature: 8.5
      wind_speed: 15.8
      precipitation: 0
      humidity: 44
    - condition: cloudy
      datetime: "2024-04-23T14:00:00+00:00"
      wind_bearing: 18.9
      cloud_coverage: 100
      temperature: 8.5
      wind_speed: 14.8
      precipitation: 0
      humidity: 44
    - condition: cloudy
      datetime: "2024-04-23T15:00:00+00:00"
      wind_bearing: 15.7
      cloud_coverage: 98.4
      temperature: 8.3
      wind_speed: 13.7
      precipitation: 0
      humidity: 44
    - condition: cloudy
      datetime: "2024-04-23T16:00:00+00:00"
      wind_bearing: 16
      cloud_coverage: 100
      temperature: 8.1
      wind_speed: 12.2
      precipitation: 0
      humidity: 42
    - condition: cloudy
      datetime: "2024-04-23T17:00:00+00:00"
      wind_bearing: 17.3
      cloud_coverage: 99.2
      temperature: 7.8
      wind_speed: 7.2
      precipitation: 0
      humidity: 48
    - condition: cloudy
      datetime: "2024-04-23T18:00:00+00:00"
      wind_bearing: 342.8
      cloud_coverage: 95.3
      temperature: 6.6
      wind_speed: 6.8
      precipitation: 0
      humidity: 63
    - condition: partlycloudy
      datetime: "2024-04-23T19:00:00+00:00"
      wind_bearing: 308.5
      cloud_coverage: 82.8
      temperature: 5.9
      wind_speed: 12.2
      precipitation: 0
      humidity: 54
    - condition: partlycloudy
      datetime: "2024-04-23T20:00:00+00:00"
      wind_bearing: 321.7
      cloud_coverage: 27.3
      temperature: 4.8
      wind_speed: 14.4
      precipitation: 0
      humidity: 56
    - condition: clear-night
      datetime: "2024-04-23T21:00:00+00:00"
      wind_bearing: 323.1
      cloud_coverage: 7.8
      temperature: 3.4
      wind_speed: 12.2
      precipitation: 0
      humidity: 61

Desktop (please complete the following information):

Additional context