Can someone here help me on how to create a rest sensor? I have created an example which is possible to test in HA. The question is at the bottom of the example.
{% set js = {
"textforecast": {
"@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"@xsi:noNamespaceSchemaLocation": "https://schema.api.met.no/schemas/textforecast-0.3.xsd",
"meta": {
"@licenseurl": "https://www.met.no/en/free-meteorological-data/Licensing-and-crediting"
},
"time": [
{
"@from": "2022-10-19T06:00:00",
"@to": "2022-10-20T00:00:00",
"forecasttype": {
"@name": "normal",
"location": [
{
"#text": "Skiftende bris. Stort sett pent v\u00e6r.",
"@id": "0709",
"@name": "Langfjella"
},
{
"#text": "Nordvestlig bris, frisk bris utsatte steder. Til dels pent v\u00e6r, men mer skyet i nord\u00f8stlige omr\u00e5der.",
"@id": "50027",
"@name": "Fjellet i S\u00f8r-Norge unntatt Langfjella"
},
{
"#text": "Nordleg bris. Pent ver. Lokal t\u00e5ke. I kveld skiftande bris. Etter kvart tilskyande.",
"@id": "0611",
"@name": "Rogaland"
},
{
"#text": "Nordleg bris. Pent ver. Lokal t\u00e5ke.",
"@id": "0612",
"@name": "Hordaland"
}
]
}
}
]
}
} %}
This is the data I want
{{ js.textforecast.time[0].forecasttype.location[2]["#text"] }}
How do I continue this so that I get the value of #text?
{{ js.textforecast.time[0].forecasttype.location|selectattr("@id", "eq", "0611")|first }}