Currencylayer - option to update less frequently

Hi Guys,

Wondering how could we add a configuration to currencylayer to update less frequently. Currently, it is updating hourly, but their free tier limit will be only 250 requests/month from 1st of July (see official notification below). I do not have the need to update it every hour, maybe like 3 times a day…

As you may have noticed, the currencylayer Free Plan was recently adjusted to offer 250 instead of 1,000 monthly API requests as a result of significant system load associated with very high user demand.

We’re writing to let you know that your current API usage appears to exceed this new limit of 250 monthly requests, which means that additional API requests may start failing once the new limit is enforced on July 1st.

1 Like

You could use a commandline sensor with a curl command to read the currency of your choice via an API call. The commandline sensor has a scan_interval parameter for how often to poll.

I do not know how real the currencylayer’s rates are. You may use instead a scrape sensor toward your favourite currency changer’s regularily updated currency web-page. It is not as elegant as one with an API but you get real exchange rates.

Atticus

1 Like

Something like this: (I only need it once per day)

- platform: command_line
  name: "currencylayer usd cad"
  unit_of_measurement: "CAD"
  scan_interval: 86400
  command: "curl http://api.currencylayer.com/live?access_key=<your key> 2>/dev/null | jq -r '.quotes.USDCAD'"
1 Like

If you want to retrieve more than one:

- platform: command_line
  name: "currencylayer usdgbpcad"
  unit_of_measurement: "USD"
  scan_interval: 86400
  command: "curl http://api.currencylayer.com/live?access_key=<yourkey> 2>/dev/null | jq '.quotes.USDGBP, .quotes.USDCAD'"

Then you can retrieve it via:

states('sensor.currencylayer_usdgbpcad').split("\n")[0]
states('sensor.currencylayer_usdgbpcad').split("\n")[1]