ahue
(Ahue)
March 4, 2021, 7:37pm
1
Receiving this error, when using the rest integration:
Setup failed for rest: No setup function defined.
rest:
- resource: https://api.corona-zahlen.org/districts/09671
sensor:
- name: Corona Inzidenz AB
value_template: "{{ value_json.data['09671'].weekIncidence | round(1) }}"
When creating the sensor via the sensors integration, using the rest platform, everything works.
sensor:
- platform: rest
resource: https://api.corona-zahlen.org/districts/09671
name: Corona Inzidenz AB
value_template: "{{ value_json.data['09671'].weekIncidence | round(1) }}"
Since I did not find anything on that in the community - can anyone help?
System information:
core-2021.2.1
supervisor-2021.03.4
What’s the problem with the sensor? Why do you wanna use the rest integration instead?
ahue
(Ahue)
March 4, 2021, 8:00pm
3
I plan to create more sensors from the one resource, thats when the documentation suggest to use the rest: integration directly.
Im having this same problem as well. Did you find a solution?
ahue
(Ahue)
March 10, 2021, 9:00pm
5
No, did not further investigate but used the sensor: solution.
same lol gotta multiples but at least it works
hajo62
(Hajo)
April 1, 2021, 7:23am
7
Maybe you also find that hint for corona-zahlen useful: Json_attributes - How to extract
That’s what I learned:
- resource: https://api.corona-zahlen.org/vaccinations
sensor:
# Deutschland
- name: rki_covid_germany_vaccinated
value_template: "{{ value_json.data.vaccinated }}"
- name: rki_covid_germany_vaccinated_delta
value_template: "{{ value_json.data.delta }}"
- name: rki_covid_germany_vaccinated_quote
value_template: "{{ (100 * value_json.data.quote) | round(1) }}"
unit_of_measurement: '%'
- name: rki_covid_germany_secondvaccinated
value_template: "{{ value_json.data.secondVaccination.vaccinated }}"
- name: rki_covid_germany_secondvaccinated_quote
value_template: "{{ (100 * value_json.data.secondVaccination.quote) | round(1) }}"
unit_of_measurement: '%'
- name: rki_covid_germany_incidence
value_template: '{{ states.sensor.rki_covid_germany.attributes.weekIncidence | round(1) }}'
- name: rki_covid_germany_recovered
value_template: '{{ states.sensor.rki_covid_germany.attributes.recovered | round(0) }}'
- name: rki_covid_germany_r
value_template: '{{ states.sensor.rki_covid_germany.attributes.r.value }}'
1 Like
That shouldn’t happen. That sounds like a bug or your install got corrupted somehow. Have you tried updating HA to the latest core version? You should definitely be able to use the rest integration. I’ve definitely used it on a recent version. Maybe there was an issue back in 2021.2.1???
FSund
(Filip Sund)
April 3, 2021, 8:43am
9
I’m getting the same error on core-2021.2.3
. I’ll try upgrading to the latest versions and see if that helps.