Makin-Things / platinum-weather-card

This is a fully customisable weather card for Home Assistant with a graphical configuration.
MIT License
138 stars 33 forks source link

Card with NWS integration doesn't display forecasted minimum #76

Closed anonymous64356 closed 1 year ago

anonymous64356 commented 1 year ago

Checklist:

Release with the issue: 1.0.4 Last working release (if known): n/a Browser and Operating System: Google Chrome Version 108.0.5359.125 (Official Build) (64-bit) Windows 11

Description of problem: When using the National Weather Service integration, the card is able to provide the forecasted maximum temperature, but not the minimum. The minimum and maximum of the next 5 days appear correctly. Screenshot 2023-01-04 163750

Javascript errors shown in the web inspector (if applicable):

Additional information: Weather card configuration:

type: custom:platinum-weather-card
card_config_version: 8
entity_apparent_temp: sensor.kmli_feels_like
entity_forecast_icon: weather.kmli_daynight
entity_forecast_icon_1: weather.kmli_daynight
entity_forecast_max: weather.kmli_daynight
entity_forecast_max_1: weather.kmli_daynight
entity_forecast_min: weather.kmli_daynight
entity_forecast_min_1: weather.kmli_daynight
entity_pop: weather.kmli_daynight
entity_pop_1: weather.kmli_daynight
entity_summary_1: weather.kmli_daynight
entity_temperature: weather.kmli_daynight
entity_wind_bearing: weather.kmli_daynight
entity_wind_speed: weather.kmli_daynight
section_order:
  - overview
  - extended
  - slots
  - daily_forecast
show_section_extended: false
slot_l1: forecast_max
slot_l2: wind
slot_l3: remove
slot_l4: remove
slot_l5: remove
slot_l6: remove
slot_l7: remove
slot_l8: remove
slot_r1: forecast_min
slot_r2: pop
slot_r3: remove
slot_r4: remove
slot_r5: remove
slot_r6: remove
slot_r7: remove
slot_r8: remove

weather.kmli_daynight attributes:

temperature: 34
temperature_unit: °F
humidity: 79
pressure: 29.76
pressure_unit: inHg
wind_bearing: 240
wind_speed: 10.29
wind_speed_unit: mph
visibility: 10
visibility_unit: mi
precipitation_unit: in
forecast: 
- detailed_description: >-
    A chance of snow. Cloudy. High near 35, with temperatures falling to around
    32 in the afternoon. Southwest wind around 10 mph. Chance of precipitation
    is 30%. Little or no snow accumulation expected.
  datetime: '2023-01-04T16:00:00-06:00'
  daytime: true
  condition: snowy
  precipitation_probability: 30
  wind_bearing: 225
  temperature: 35
  wind_speed: 10
- detailed_description: >-
    A chance of snow. Cloudy, with a low around 28. Southwest wind around 10
    mph. Chance of precipitation is 30%. New snow accumulation of less than half
    an inch possible.
  datetime: '2023-01-04T18:00:00-06:00'
  daytime: false
  condition: snowy
  precipitation_probability: 30
  wind_bearing: 225
  temperature: 28
  wind_speed: 10
- detailed_description: >-
    A chance of snow. Cloudy, with a high near 35. West wind 10 to 15 mph.
    Chance of precipitation is 30%. Little or no snow accumulation expected.
  datetime: '2023-01-05T06:00:00-06:00'
  daytime: true
  condition: snowy
  precipitation_probability: 30
  wind_bearing: 270
  temperature: 35
  wind_speed: 12.5
- detailed_description: >-
    Mostly cloudy, with a low around 22. West wind 5 to 10 mph, with gusts as
    high as 20 mph.
  datetime: '2023-01-05T18:00:00-06:00'
  daytime: false
  condition: cloudy
  precipitation_probability: 0
  wind_bearing: 270
  temperature: 22
  wind_speed: 7.5
- detailed_description: Mostly sunny, with a high near 34.
  datetime: '2023-01-06T06:00:00-06:00'
  daytime: true
  condition: partlycloudy
  precipitation_probability: 0
  wind_bearing: 270
  temperature: 34
  wind_speed: 5
- detailed_description: Partly cloudy, with a low around 24.
  datetime: '2023-01-06T18:00:00-06:00'
  daytime: false
  condition: partlycloudy
  precipitation_probability: 0
  wind_bearing: 45
  temperature: 24
  wind_speed: 2.5
- detailed_description: >-
    A chance of snow after noon. Mostly sunny, with a high near 37. Chance of
    precipitation is 30%. New snow accumulation of less than half an inch
    possible.
  datetime: '2023-01-07T06:00:00-06:00'
  daytime: true
  condition: snowy
  precipitation_probability: 30
  wind_bearing: 45
  temperature: 37
  wind_speed: 7.5
- detailed_description: >-
    A chance of snow. Mostly cloudy, with a low around 28. Chance of
    precipitation is 40%.
  datetime: '2023-01-07T18:00:00-06:00'
  daytime: false
  condition: snowy
  precipitation_probability: 40
  wind_bearing: 45
  temperature: 28
  wind_speed: 7.5
- detailed_description: Partly sunny, with a high near 36.
  datetime: '2023-01-08T06:00:00-06:00'
  daytime: true
  condition: cloudy
  precipitation_probability: 0
  wind_bearing: 0
  temperature: 36
  wind_speed: 5
- detailed_description: Partly cloudy, with a low around 23.
  datetime: '2023-01-08T18:00:00-06:00'
  daytime: false
  condition: partlycloudy
  precipitation_probability: 0
  wind_bearing: 270
  temperature: 23
  wind_speed: 5
- detailed_description: Mostly sunny, with a high near 40.
  datetime: '2023-01-09T06:00:00-06:00'
  daytime: true
  condition: partlycloudy
  precipitation_probability: 0
  wind_bearing: 225
  temperature: 40
  wind_speed: 7.5
- detailed_description: Mostly cloudy, with a low around 28.
  datetime: '2023-01-09T18:00:00-06:00'
  daytime: false
  condition: cloudy
  precipitation_probability: 0
  wind_bearing: 225
  temperature: 28
  wind_speed: 5
- detailed_description: Partly sunny, with a high near 38.
  datetime: '2023-01-10T06:00:00-06:00'
  daytime: true
  condition: cloudy
  precipitation_probability: 0
  wind_bearing: 315
  temperature: 38
  wind_speed: 7.5
- detailed_description: Mostly cloudy, with a low around 24.
  datetime: '2023-01-10T18:00:00-06:00'
  daytime: false
  condition: cloudy
  precipitation_probability: 0
  wind_bearing: 0
  temperature: 24
  wind_speed: 5

attribution: Data from National Weather Service/NOAA
friendly_name: Weather

Forecasted minimum should be 28 degrees (temperature in second forecast)

Makin-Things commented 1 year ago

Can you please ask about this in https://community.home-assistant.io/t/platinum-weather-card-support/449166/99 NWS can be a little special, but I'll try and tag someone in there that is all over it.

anonymous64356 commented 1 year ago

Thanks for responding! I ended up creating some template sensors that update at midnight. The YAML is below if others have this problem. Looking through your code, I wonder if you could the this._getForecastPropFromWeather function if templow is not given by the entity, but I'm not that knowledgable with TypeScript so I don't know. I'll close this issue anyway.

NWS template sensors:

template:
  - trigger:
      - platform: time_pattern
        hours: 0
        minutes: 0
    sensor:
      - name: "KMLI High Today"
        unit_of_measurement: "°F"
        state_class: 'measurement'
        state: "{{ state_attr('weather.kmli_daynight', 'forecast')[1]['temperature'] }}"
      - name: "KMLI Low Today"
        unit_of_measurement: "°F"
        state_class: 'measurement'
        state: "{{ state_attr('weather.kmli_daynight', 'forecast')[2]['temperature'] }}"