Exchange Rate Sensor in Home Assistant

I was in need to track the exchange rate between AUD and EUR. I looked for a way to track exchange rate in Home Assistant, but all the integrations I found required a paid API key when you want to track a rate from USD. After some search, I found a free API that provides exchange rates for various currencies. The API is hosted on GitHub and can be accessed using the following URL: https://github.com/fawazahmed0/exchange-api

API Documentation

It consists of a single JSON file hosted as a library on JSdelivr CDN. The latest version of the JSON file can be accessed using the following URL: https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/.json

I needed to track AUD to EUR exchange rate in Home Assistant. To achieve this, I created a custom sensor using the REST platform. The sensor fetches the exchange rate from the API every 24 hours and displays it in the Home Assistant dashboard.

Sensor configuration

sensor:
  - platform: rest
    name: AUD to EUR Exchange Rate
    resource: https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/aud.json
    value_template: "{{ value_json.aud.eur }}"
    unit_of_measurement: "EUR"
    scan_interval: 86400  # 24 hours in seconds (1 fetch per day)
    json_attributes_path: "$.aud"
    json_attributes:
      - eur
    device_class: monetary
    state_class: measurement
    icon: mdi:currency-eur