Setup failed for rest: No setup function defined

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?

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?

No, did not further investigate but used the sensor: solution.

same lol gotta multiples but at least it works

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???

I’m getting the same error on core-2021.2.3. I’ll try upgrading to the latest versions and see if that helps.