Platinum Weather Card support

@wmaker - Thank you very much for that explanation - I finally understand what needs to be implemented now, after reading various other threads and still being left a little confused. I’m going to go with option 1. I was on the right lines and created a trigger based sensor already which works, but my attributes: forecast section is simply:

attributes:
  forecast: "{{ daily['weather.openweathermap'].forecast }}"

This gives the trigger based sensor attributes in the exact same format as the response when the weather.get_forecasts service is called manually against the Openweathermap entity:

Will this work OK for creating my various daily template sensors as per 1.b above? Or should I change my attributes section to match the example that you linked to, i.e

attributes:
  forecast: >
    {% set ns = namespace(forecast=[]) %}
    {% for d in daily[entity_id]['forecast'] %}
    {% set ns.forecast = ns.forecast +
    [{
      "condition": d.condition,
      "datetime": d.datetime,
      "wind_bearing": d.wind_bearing,
      "temperature": d.temperature | round(0, default=-99),
      "templow": d.templow | round(0, default=-99),
      "wind_speed": d.wind_speed | round(0, default=-99),
      "precipitation": d.precipitation,
      "humidity": d.humidity
    }] %}
    {% endfor %}
    {{ ns.forecast }}

It looks like the above was mainly suggested for the rounding of certain values (which you mentioned to disregard). If it makes any difference, I will be looking to create template weather for condition, high temp and low temp, just for the purpose of this PWC, for the next 5 days.

[EDIT] For step 1b), when using sensors in a PWC configuration, PWC primarily uses the sensor’s state and not its attribute, so it won’t use the sensor’s forecast as an attribute.

See if this post above helps explain things.

Thanks a ton for forking and fixing this card! I finally have my weather card back to how I had/wanted it months ago; I’d just about given up on using it.

Have you reached out to the original author to look at rolling your fixes/updates into the original or considered actively maintaining your fork? I’m just now seeing it hasn’t been updated for 2 years (I could have sworn it had a more recent update). It’d be a shame for this card to just die if there’s a future breaking-change.

1 Like

Hi.
Could you give an example of creating multiple template sensors described in point 1b?

In my case I don’t use template sensors anymore, but I think it would be something like the following (try it and see if it works for you):

Let’s say you created a template sensor using 1a) that shows in the developer’s tools as:

sensor.weather_forecast_daily
w. attributes:

friendly_name: Weather Forecast Daily
forecast: 
- detailed_description: >-
    We could see an early morning shower, otherwise look out for patchy fog this
    morning.  We'll be mostly cloudy for much of the day, but we could see some
    peeks of sun later this afternoon.  Highs in the upper 70s to lower 80s.For
    the night: Mostly cloudy and turning cooler. Our southern counties could see
    showers this evening.  Lows fall into the low 50s.
  wind_bearing: 0
  precipitation_probability: 20
  datetime: '2024-04-20T06:00:00-04:00'
  condition: cloudy
  temperature: 75
  templow: 52
  wind_speed: 9

  ... this is a list so it repeats for the forecasts for the next several days...

Then for 1b) you can create several sequential forecast sensors representing the next several days and you can add your own attributes to each sensor. Using configuration.yaml, it might look something like:

template:   
  - sensor:
     - name: "my forecast details1"
       unique_id: 2377501
       state: "{{ states.sensor.weather_forecast_daily.attributes.forecast[0]['condition'] }}"        
       attributes:
         text: >
           {{ states.sensor.weather_forecast_daily.attributes.forecast[0]['detailed_description'] }}
     - name: "my forecast details2"
       unique_id: 2377502
       state: "{{ states.sensor.weather_forecast_daily.attributes.forecast[1]['condition'] }}"        
       attributes:
         text: >
           {{ states.sensor.weather_forecast_daily.attributes.forecast[1]['detailed_description'] }}
     - name: "my forecast details3"
       unique_id: 2377503
       state: "{{ states.sensor.weather_forecast_daily.attributes.forecast[2]['condition'] }}"        
       attributes:
         text: >
           {{ states.sensor.weather_forecast_daily.attributes.forecast[2]['detailed_description'] }}  

        etc.etc.....

In the PWC Card editor, for a particular config, you simply select sensor.my_forecast_details1, and PWC will find the others.

I’ve downloaded the forked PWC, and also tried setting up 1b) so that I have template sensors for condition, temperature, and min temperature for the next 5 days. All this information is pulling through to the new template sensors from my trigger sensor fine:

I’m not able to utilise the attributes from these new sensors in the forked PWC, unless I’m doing something wrong? I can only use the states, so I am getting the condition for each day, but trying to use the attributes for min/max temp results in NaN displaying, as I can only specify the sensor and not the sensors attributes for each config field in the card.

image

Should attributes be able to be used in this card in this way, like in the examples template sensors above, or do I need to create a sensor with a state for each item I want to target, rather than attributes?

I think my answer to you above was misleading/incorrect. When using sensors in a PWC configuration, PWC almost always uses the state of the sensor. There are a couple of configs where you can configure PWC to use attributes of a sensor instead of state, but otherwise it only uses state, so sorry for being incorrect about that, so I will edit my answer above.

BTW, you don’t need the forked PWC to use sensors.

Ah I see, thanks for clarifying. In that case I’ll add to my new sensors and create more new ones, each with a state only, and no attributes, so that i can use each sensor for each piece of data. I will have a sensor for tomorrow’s condition, one for tomorrow’s low temp, and one for tomorrow’s high temp, and the repeat for each of the 5 days that i need. Seems like a lot of new sensors, but if that’s what is needed to continue to use this card then so be it!

OK. I’ve created all of the new template sensors, so that I have a sensor for the condition, min temp and max temp for each of the 5 days that I get data for in my weather forecast. These sensors are getting state values correctly.

    - name: "forecast condition 1"
      unique_id: 1234561
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[0]['condition'] }}"

    - name: "forecast temp high 1"
      unique_id: 1234562
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[0]['temperature'] }}"

    - name: "forecast temp low 1"
      unique_id: 1234563
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[0]['templow'] }}"

    - name: "forecast condition 2"
      unique_id: 1234564
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[1]['condition'] }}"

    - name: "forecast temp high 2"
      unique_id: 1234565
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[1]['temperature'] }}"

    - name: "forecast temp low 2"
      unique_id: 1234566
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[1]['templow'] }}"

    - name: "forecast condition 3"
      unique_id: 1234567
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[2]['condition'] }}"

    - name: "forecast temp high 3"
      unique_id: 1234568
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[2]['temperature'] }}"

    - name: "forecast temp low 3"
      unique_id: 1234569
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[2]['templow'] }}"

    - name: "forecast condition 4"
      unique_id: 12345610
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[3]['condition'] }}"

    - name: "forecast temp high 4"
      unique_id: 12345611
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[3]['temperature'] }}"

    - name: "forecast temp low 4"
      unique_id: 12345612
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[3]['templow'] }}"

    - name: "forecast condition 5"
      unique_id: 12345613
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[4]['condition'] }}"

    - name: "forecast temp high 5"
      unique_id: 12345614
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[4]['temperature'] }}"

    - name: "forecast temp low 5"
      unique_id: 12345615
      state: "{{ states.sensor.weather_daily_forecast.attributes.forecast[4]['templow'] }}"

I am using these new sensors in the config for the forked PWC, and my card config is :

card_config_version: 8
daily_forecast_days: 5
daily_forecast_layout: horizontal
entity_apparent_temp: sensor.openweathermap_feels_like_temperature
entity_forecast_icon: sensor.openweathermap_condition
entity_forecast_icon_1: sensor.forecast_condition_1
entity_forecast_max: sensor.forecast_temp_high_1
entity_forecast_max_1: sensor.forecast_temp_high_1
entity_forecast_min: sensor.forecast_templow_1
entity_forecast_min_1: sensor.forecast_templow_1
entity_humidity: sensor.openweathermap_humidity
entity_pop: sensor.openweathermap_forecast_precipitation_probability
entity_pos: sensor.openweathermap_forecast_precipitation
entity_sun: sun.sun
entity_temperature: weather.openweathermap
entity_uv_alert_summary: sensor.openweathermap_uv_index
entity_wind_speed: weather.openweathermap
forecast_type: daily
option_color_fire_danger: false
option_locale: london
option_time_format: 12hour
section_order:
  - overview
  - extended
  - slots
  - daily_forecast
show_section_extended: false
slot_l1: forecast_max
slot_l2: humidity
slot_l3: wind
slot_l4: sun_next
slot_l5: remove
slot_l6: remove
slot_l7: remove
slot_l8: remove
slot_r1: forecast_min
slot_r2: popforecast
slot_r3: uv_summary
slot_r4: sun_following
slot_r5: remove
slot_r6: remove
slot_r7: remove
slot_r8: remove
type: custom:platinum-weather-card
weather_entity: weather.openweathermap

however the card is not showing up:

If I uncheck the ‘Daily Forecast Section’ then this shows:

So I guess there are a couple of issues here, but what should I be using as the ‘weather entity with forecasts’ in the Daily Forecast Section configuration? I only have one weather entity, which is my weather.openweathermap entity, which is the one that gets called by my trigger, and this populates my sensor.weather_daily_forecast sensor:

Since you using my forked version…
it looks to me like openweathermap is a native HA integration, so it should be supporting the new subscribe methods for getting forecasts data. My forked PWC added these new subscribe methods so that a weather entity could still be used by PWC to get forecast data (these subscribe methods are kinda like the service call weather.get_forecasts). So you shouldn’t need all those sensors derived/created using the get_forecasts service call. I would say If you have time to play with this, then save away (copy/paste) your PWC yaml config for safe keeping, and then try configuring pretty much all PWC entities with weather.openweathermap and see if it works (start with just the slots section first to see if it works, then proceed on to the daily section. Make sure you at least have one yaml config: weather_entity: weather.openweathermap

Back to the sensors question …
It looks like the warning: entity_pop=sensor.openweathermap_forecast_precipitation_probability value needs to have a number is a bug introduced in my forked version. entity_pop shouldn’t require a number. The workaround is to add yet another template sensor with a number in it, or go back to the original PWC.

Thanks for the explanation @wmaker - I’ve created a new forked PWC on a test dashboard and configured using the weather.openweathermap entity for each of the slots, overview and daily forecast section fields, and that works! As straightforward as that - I’m not sure why I struggled so much, but reading through this topic and several others, I figured I needed to create a bunch of new weather sensors regardless of the card.

The entity_pop=sensor.openweathermap_forecast_precipitation_probability value needs to have a number
message confused me, as the state of that entity appears to already be a number, such as ‘70’ or ‘100’ for example - so this can’t be what the message is actually referring to

Love this card to setup but I have a problem with the forecast icons.
Started all over again and clean but no luck.

Should be other icons also but only the first 2 is showing.

image

any idea’s?

Yeah I can see why its confusing…what the warning means to say is “entity_pop”=value. Value here is a sensor with name sensor.xxxxx, so what it is really trying to say is that xxxx has to have a number in its name.

1 Like

I think I know why… PWC has a list of weather conditions it tries to match: “sunny”, “cloudy”, “raining”, etc. and then picks an icon. This list however doesn’t include “Partly cloudy, light rain”, so it doesn’t find a match and thus can’t pick an icon.

1 Like

I understand thanks for pointing in the right direction.
See where it is in the code now.
Also see there is no new code for 2 years to bad.
Not so platinum after all.

I went to Weather Chart Card now. Got also possibility to add some custom entry’s.

HI Andrew / All
I too am using BOM (Australia) Integration for Sensor data along with my Personal Weather Station for some sensors - all works well but for one thing. I just have NOT got the 5 day forecast ICONS to display. (screenshot below)
In the Platinum card Config I have:
‘entity_forecast_icon_1: sensor.bangalow_mdi_icon_1’

and the HA state sensor for the BOM Integration shows that sensor state as ‘mdi:weather-rainy’ ie to me that looks correct? but nothing shows.

would you mind sharing your Platinum Weather Card Yaml settings for the weather icons please - Im sure its something obvious my end that im missing. i had it working but somewhere along the way I or it busted.
Thanks.

for entity_forecast_icon_1, PWC actually wants the sensor state to be “sunny”, “rainy”, etc. and PWC will come up with the icon.

1 Like

These are from BOM integration…
entity_forecast_icon: sensor.turramurra_icon_descriptor_0
entity_forecast_icon_1: sensor.turramurra_icon_descriptor_1

1 Like

Thanks for your replies. I’ve checked and as I have the BOM setup I don’t have the necessary sensor states exposed to HA, I’ll delve back in to the integration and hopefully now that I know what the issue is can set it up to produce these states for the Icons. Appreciate the guidance. I actually have Two BOM services configured (was experimenting) one the full forecast and another with Hourly forecast. I’m not sure the latter is necessary now but I’ll leave it for now, unless anyone advises this is not a good idea or unnecessary? Cheers