I am trying to create an automation that tells me if my morning train is on time when I leave my house. In order to do this I need to filter out information I get from one of the attributes of the sensor.
If I use this - ‘{{ state_attr(‘sensor.trains_trowbridge_to_bristol_temple_meads’, ‘service’)}}’
I get this:
’
{
“sta”: “20:49”,
“eta”: “On time”,
“std”: “20:50”,
“etd”: “On time”,
“platform”: “1”,
“operator”: “Great Western Railway”,
“operatorCode”: “GW”,
“serviceType”: “train”,
“serviceID”: “598447TRWBRDG_”,
“origin”: {
“location”: {
“locationName”: “Salisbury”,
“crs”: “SAL”
}
},
“destination”: {
“location”: {
“locationName”: “Bristol Temple Meads”,
“crs”: “BRI”
}
}
}
’
I want to extract the value for “eta” and “platform” so they can be sent to me via a push notification.
ohh ok, i didn’t know those would “appear” because it was unformatted
Have you tried
with or without [1] ? , i think he should/need to do without [1] , in his case … it work in the Template-Section ( i actually think it was you who taught me my first “dict-traverse” )
… but as mention, i have never seen, or tried template from “unformmated” text , and i always use the States-Section to figure out howto address the specific value, from an attr.