I have a URL which returns the following xml:
<SiteRep>
<Period type="Day" value="2023-07-06Z">
<Rep D="SW" F="15" G="13" H="69" Pp="6" S="9" T="17" V="VG" W="7" U="5">540</Rep>
<Rep D="SW" F="16" G="18" H="49" Pp="7" S="11" T="19" V="GO" W="7" U="7">720</Rep>
<Rep D="SSW" F="17" G="18" H="56" Pp="6" S="11" T="19" V="GO" W="7" U="4">900</Rep>
<Rep D="SSW" F="16" G="22" H="47" Pp="3" S="13" T="19" V="VG" W="3" U="1">1080</Rep>
<Rep D="S" F="14" G="20" H="67" Pp="0" S="7" T="15" V="VG" W="0" U="0">1260</Rep>
</Period>
I know I can use the following to get the 1st T
of the 1st Period
- name: Weather temp (rest)
unique_id: weather_temp_rest
device_class: temperature
unit_of_measurement: '°C'
value_template: >
{% set row = 0 %}
{{ value_json.SiteRep.DV.Location.Period[0].Rep[row]['@T'] }}
…but is it possible to set row
to get the T
associated with the Rep
text of 900
(in this example, the 3rd row)? I have tied #900
but just get errors. i.e.
<Rep D="SSW" F="17" G="18" H="56" Pp="6" S="11" T="19" V="GO" W="7" U="4">900</Rep>
get this ^ based on this ^