Hi.
I’m trying to parse some data from this json:
[
{
"Name": "Lisboa",
"District": "Lisboa",
"Geo_Point_County": "-9.15677178979339,38.73767450124629",
"Geo_Point_District": "-9.1945933,39.016146",
"field_code": 11,
"Interruptions": "[{\"Date\":\"13\\/10\\/2019\",\"Start_time\":\"05:00\",\"Parish\":\"Zona urbana\",\"Address\":\"R. Atalaia, R. Barroca, Lrg. Calhariz, Trav. Espera, R. Rosa, R. Luz Soriano, Trav. Merc\\u00eas, R. Salgadeiras, R. Trombeta, Travessa Fi\\u00e9is Deus e imedia\\u00e7\\u00f5es \",\"Additional_information\":\"Conserva\\u00e7\\u00e3o de Rede\",\"Cancelled\":\"0\",\"End_time\":\"11:00\"}]"
},
{
"Name": "Mafra",
"District": "Lisboa",
"Geo_Point_County": "-9.308886327661053,38.9611362162495",
"Geo_Point_District": "-9.1945933,39.016146",
"field_code": 11,
"Interruptions": "[{\"Date\":\"13\\/10\\/2019\",\"Start_time\":\"07:00\",\"Parish\":\"Ericeira\",\"Address\":\": Estrada Nacional 247, Trav. Comandante Filipe Freire, Bairro Andorinhas, R. Boavista, Urb. Carrasqueira, R. Dr. Eduardo Burnay, R. Bairro Jo\\u00e3o David Soares, R. Silvas, Praia Sul, R. Descobrimentos, R. Francisco L. Franco, Urb. Casal Gradil, R. Casal Gradil, Casal Rivoti, R. Manuel P. Santa Rosa, R. Comandante Manuel Freire, R. Comandante Filipe Freire, Avenida S. Sebasti\\u00e3o, R. Lombas, R. Carrasqueira Vila, Prct. Francisco L. Franco e imedia\\u00e7\\u00f5es\",\"Additional_information\":\"Conserva\\u00e7\\u00e3o de Rede\",\"Cancelled\":\"0\",\"End_time\":\"11:00\"},{\"Date\":\"13\\/10\\/2019\",\"Start_time\":\"07:00\",\"Parish\":\"Carvoeira\",\"Address\":\"Quinta Eduardo Alho e imedia\\u00e7\\u00f5es \",\"Additional_information\":\"Conserva\\u00e7\\u00e3o de Rede\",\"Cancelled\":\"0\",\"End_time\":\"11:00\"}]"
}
]
The “name” and “district” are simple. But the “parish” inside the “interruptions” is not.
This does not work, giving no data at all:
sensor:
- platform: rest
name: 'EDPD Interrupções - 1'
value_template: '{{ value_json[0].Interruptions.Parish }}'
resource: https://www.edpdistribuicao.pt/pt-pt/county_interruptions?_format=json
force_update: true
This one, just crashes HA because the content is bigger than 255 chars:
sensor:
- platform: rest
name: 'EDPD Interrupções - 1'
value_template: '{{ value_json[0].Interruptions }}'
resource: https://www.edpdistribuicao.pt/pt-pt/county_interruptions?_format=json
force_update: true
Any help would be appreciated.
Thanks.