What is the esiest way to get subsets of an attributte from a sensor split out into new entities?

I am trying to get wind speed forecast data from Open Meteo, that are attributes under the forecast key. But that key is a list of dictionaries with seven different key:val pairs. I am only interested in one value from each index on the list (see “attributes” below).

I have been looking at the “attributes” in entities card, but I can only get the list. It doesn’t seem like I can index the nested list and dictionary.

I’ve tried this:

type: entities
  - type: attribute
    entity: weather.open_meteo
    attribute: forecast
    name: Forecacst

but that gives the entire list of dictionaries. And indexing with . o square brackets [] doesn’t seem to work.

I have also looked at the config-template-card, but I know zero Javascript, so I didn’t get that far with that one. And started wondering if there was not a simpler way?

"attributes" for the weather.open_meteo entity. I want each "wind_speed" value ``` temperature: 20.7 temperature_unit: °C pressure_unit: hPa wind_bearing: 153 wind_speed: 15.8 wind_speed_unit: km/h visibility_unit: km precipitation_unit: mm forecast: - datetime: '2022-07-31' condition: rainy wind_bearing: 151 temperature: 20.8 templow: 14.3 wind_speed: 15.8 precipitation: 1.2 - datetime: '2022-08-01' condition: rainy wind_bearing: 286 temperature: 21.5 templow: 13.2 wind_speed: 17.9 precipitation: 0.3 - datetime: '2022-08-02' condition: rainy wind_bearing: 198 temperature: 19.1 templow: 11 wind_speed: 16.2 precipitation: 8.8 - datetime: '2022-08-03' condition: rainy wind_bearing: 190 temperature: 21.9 templow: 15.9 wind_speed: 15.2 precipitation: 1.3 - datetime: '2022-08-04' condition: rainy wind_bearing: 316 temperature: 19.6 templow: 16 wind_speed: 7.6 precipitation: 14 - datetime: '2022-08-05' condition: rainy wind_bearing: 310 temperature: 19.1 templow: 14.4 wind_speed: 16.6 precipitation: 1.4 - datetime: '2022-08-06' condition: cloudy wind_bearing: 275 temperature: 18.7 templow: 12.7 wind_speed: 16.6 precipitation: 0

friendly_name: Home


try this:

{{ state_attr('weather.open_meteo', 'forecast')[0].wind_speed }}

you’ll have to split them out individually for each day, so:

{{ state_attr('weather.home', 'forecast')[0].wind_speed }}
{{ state_attr('weather.home', 'forecast')[1].wind_speed }}
{{ state_attr('weather.home', 'forecast')[2].wind_speed }}

Thanks, but where exactly do I put this? I tried in the “entities” card, and in the “config_template_card” (though I’m not sure I used that one correctly).

I can use it just fine with a template sensor though, so I’m pretty sure you’re right :slight_smile: Just seems like making a new sensor is kind of a detour…

sometimes, depending on what you want to do with it, that will be the only way.

most (all?) of the built-in Lovelace cards don’t allow templating.

there are custom cards that allow it as you mentioned. But I haven’t done much at with that card to know how to pull a templated attribute out of the entity.

If you just want to display the data in an entity card then it’s easiest to just create a sensor.

OK, I’ll play around with the card-templater if I find time (didn’t manage to get that working just yet). I would be nice to not have to “clutter” HA with too many sensors where the data is available in other sensor attributes.

In the meantime, new sensor(s) it is. Thanks.