Get Atrribute Array Value

Hi, is anyone can tell me how do iget the value in the image here please.

I’ve tried with templating and array but did not make it working.

Thxs!

Capture

Not sure what you want to do with it, but the basic template for extracting that value is:

{{ state_attr('sensor.limeil_brevannes_next_rain', '1_hour_forecast')['5 min'] }}

Perfect. thx you. i ried with [0] but did not think to try with [5 min]

thxs

It didn’t work with [0] (i.e., an “index”) because it’s not a list (aka array.) It’s a Python dict (aka dictionary, aka “map”), so you need to use the “key”, which in this case is '5 min'.

Ok thanks. I’d like to test value if it contains the word “Pluie”, how can i do that please. is there a “like” comparator?

You might try regex_search().

{{ state_attr(‘sensor.limeil_brevannes_next_rain’, ‘1_hour_forecast’)[‘5 min’] }}|regex_search(pluie, ignorecase=true)

i’d like to put it in a condition. seems it does not work

Because pluie is not a variable, it’s a string. So you need to quote it. And the function needs to be inside the template.

{{ state_attr('sensor.limeil_brevannes_next_rain', '1_hour_forecast')['5 min'] |regex_search('pluie', ignorecase=true) }}

Thxs a lot. beginning with the template stuff