RESTful sensor with dynamic link in configuration.yaml

Hi. I am using RESTful sensor and config looks like that

So when it is a static link like

https://api.privatbank.ua/p24api/exchange_rates?json&date=11.1.2020

it is working fine and return the json, but when I try use dynamic params like

https://api.privatbank.ua/p24api/exchange_rates?json&date={{now().day}}.{{now().month}}.{{now().year}}

it stop working.

Are those template values doesn’t work in configuration.yaml? How to set dynamic date for that link?

Duke

Ok. it works now. If someone need it

  - platform: rest
#    resource: https://api.privatbank.ua/p24api/exchange_rates?json&date=11.1.2020
    resource_template: https://api.privatbank.ua/p24api/exchange_rates?json&date={{now().strftime('%d.%m.%Y')}}
    name: PrivatBank
#   value_template: '{{ value_json.date }}' 
    value_template: '{% for rate in value_json.exchangeRate -%}{%- if rate.currency == "USD" %}{{rate.purchaseRateNB | round(2)}}{% endif -%}{%- endfor %}'
4 Likes

Thank you!
You save my day!