Hey everyone, I’ve been trying to set up a REST sensor in Home Assistant to track COVID-19 vaccination rates in my area. Here’s what my configuration looks like:
yaml
- platform: rest
resource: https://www.coronavirus.sachsen.de/corona-statistics/rest/incidenceVaccinationDevelopment.jsp?_=1636644181472
name: ‘Inzidenz Sachsen geimpfte’
timeout: 60
value_template: ‘{{ value_json.incidenceFullyVaccinated.values.[(@.length-1)] }}’
unit_of_measurement: ‘Fälle’
The sensor works perfectly in the JSONPath Online Evaluator, but I keep getting this error in Home Assistant:
Invalid config for [sensor.rest]: invalid template (TemplateSyntaxError: expected name or number) for dictionary value @ data[‘value_template’]. Got ‘{{ value_json.incidenceFullyVaccinated.values.[(@.length-1)] }}’.
I’ve tried adjusting the template syntax, but nothing seems to work. Has anyone encountered a similar issue or have any tips on how to resolve this? I’d really appreciate any help!
Also, if anyone has successfully integrated REST sensors with complex JSON structures, I’d love to hear about your setup and any best practices you’ve discovered. Thanks in advance! ![]()