I’m pretty new to this!
First I did a REST sensor like:
…
#Get Crossrate for EUR/SEK
- platform: rest
name: EUR Crossrate
resource_template: https://api.riksbank.se/swea/v1/CrossRates/SEKEURPMI/SEKETT/{{ now().strftime(‘%Y-%m-%d’) }}
headers:
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: !Secrets xyz
method: GET
value_template: “{{ value_json[0].value | float | round(2) }}”
scan_interval: 86400
…
Result:
…
[{
“date”: “string”,
“value”: 0
}]
…
It worked fine but it pulled to many times from the source. I only want to do this 17:00 Mon-Fri
So I tried a rest_command instead(to use in automation):
…
#Get Crossrate for EUR/SEK
rest_command:
usd_request:
url: https://api.riksbank.se/swea/v1/CrossRates/SEKEURPMI/SEKETT/{{ now().strftime(‘%Y-%m-%d’) }}
headers:
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: !Secrets xyz
method: GET
…
It works when I tested this in Sevices
BUT how can I store the result, so I can use it in the dashboard?