REST resource template issue

Hej guys,
reffering to my topic Scrape sensor for bank exchange rates from XML (below) I would like to report the problem with the REST resource template.

[Scrape sensor for bank exchange rates from XML]

As I did not change anything in my config and everything was working fine, there must be some issue with the HA updates.

Now I can not restart my HA server, because it is telling me error on line 88 - which had no error before.

Any idea, what is wrong ???

Thanks a lot

resourcee_template is spelled wrong, should be:
resource_template

Hey man,
checked and corrected, my bad…but still not working…

rest:
  - resource: https://www.cnb.cz/cs/financni-trhy/devizovy-trh/kurzy-devizoveho-trhu/kurzy-devizoveho-trhu/denni_kurz.xml
    scan_interval: 28800
    sensor:
      - name: Kurz CZK/EUR
        unit_of_measurement: 'CZK/EUR'
        device_class: monetary
        value_template: "{{ value_json.kurzy.tabulka.radek|selectattr('@kod','eq','EUR')|map(attribute='@kurz')|first|replace(',','.') }}"

      - name: Kurz CZK/GBP
        unit_of_measurement: 'CZK/GBP'
        device_class: monetary
        value_template: "{{ value_json.kurzy.tabulka.radek|selectattr('@kod','eq','GBP')|map(attribute='@kurz')|first|replace(',','.') }}"

      - name: Kurz CZK/USD
        unit_of_measurement: 'CZK/USD'
        device_class: monetary
        value_template: "{{ value_json.kurzy.tabulka.radek|selectattr('@kod','eq','USD')|map(attribute='@kurz')|first|replace(',','.') }}"
        
      - name: Kurz CZK/PLN
        unit_of_measurement: 'CZK/PLN'
        device_class: monetary
        value_template: "{{ value_json.kurzy.tabulka.radek|selectattr('@kod','eq','PLN')|map(attribute='@kurz')|first|replace(',','.') }}"


  - resource_template: https://csob.cz/spa/exrate/exrates/-/date/{{ now().isoformat()[:10] }}/kurzovni-listek.xml
    scan_interval: 28800
    sensor:
      - name: Kurz CSOB CZK EUR
        unit_of_measurement: 'CZK/EUR'
        device_class: monetary
        value_template: "{{ (value_json.ExchangeRate.Country|selectattr('@ID','eq','EUR')|first)['FXcashless']['@Sale'] }}"
        
      - name: Kurz CSOB CZK GBP
        unit_of_measurement: 'CZK/GBP'
        device_class: monetary
        value_template: "{{ (value_json.ExchangeRate.Country|selectattr('@ID','eq','GBP')|first)['FXcashless']['@Sale'] }}"
         
      - name: Kurz CSOB CZK USD
        unit_of_measurement: 'CZK/USD'
        device_class: monetary
        value_template: "{{ (value_json.ExchangeRate.Country|selectattr('@ID','eq','USD')|first)['FXcashless']['@Sale'] }}"
        
      - name: Kurz CSOB CZK PLN
        unit_of_measurement: 'CZK/PLN'
        device_class: monetary
        value_template: "{{ (value_json.ExchangeRate.Country|selectattr('@ID','eq','PLN')|first)['FXcashless']['@Sale'] }}"
        



Check that the resource actually loads. I’m getting an error when visiting https://csob.cz/spa/exrate/exrates/-/date/2023-11-01/kurzovni-listek.xml

1 Like

YES, that was in princip correct!

I hade to remove the -/date/ and it´s working fine!