Official exchange rate of hryvnia to foreign currencies
Home Assistant

Official exchange rate of hryvnia to foreign currencies

The official exchange rate of the hryvnia to foreign currencies dollar and euro for the current date from the website of the National Bank of Ukraine (API)
A flow by Dmytro Sudakevych (megadimich)

Go to automations Download flow Download assets

Flow Details

  1. You need to create a sensor in the configuration.yaml file or add a link to the file where the bank_gov_ua sensor is recorded. In my case, I added the following lines to the configuration.yaml:

homeassistant:
packages: !include_dir_merge_named includes/packages

Place the bank_gov_ua_sensors.yaml file in the packages folder.

  1. Create your automation. I added my automation to the automations.yaml file. In this file, set your AWTRIX MQTT prefix in topic: instead of awtrix_565c3c.

  2. Do not forget to download the icons mentioned in the project: 11388, 2147.

If you have any questions, please contact me on Discord at megadimich.

1. File bank_gov_ua_sensors.yaml: #https://bank.gov.ua/ua/open-data/api-dev bank_gov_ua_sensors: sensor: - platform: rest name: bank_gov_ua_eur resource_template: https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange?valcode=EUR&json&date={{ now().strftime("%Y%m%d") }} method: GET headers: content-type: 'application/json' value_template: "{{ value_json[0].rate }}" json_attributes: - "''" scan_interval: 3600 # 1 Hour - platform: rest name: bank_gov_ua_usd resource_template: https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange?valcode=USD&json&date={{ now().strftime("%Y%m%d") }} method: GET headers: content-type: 'application/json' value_template: "{{ value_json[0].rate }}" json_attributes: - "''" scan_interval: 3600 # 1 Hour 2. File automations.yaml: - id: '1703259398273' alias: 'AWTRIX: USD and EURO currency rates' description: '' trigger: - platform: time_pattern minutes: /4 condition: [] action: - service: mqtt.publish data: qos: '0' retain: false topic: awtrix_565c3c/custom/rateusd payload: '{ "text": "{{ states(''sensor.bank_gov_ua_usd'') | round(3) }}", "icon": "11388", "repeat": 2, "duration": 5 }' - service: mqtt.publish data: qos: '0' retain: false topic: awtrix_565c3c/custom/rateeur payload: '{ "text": "{{ states(''sensor.bank_gov_ua_eur'') | round(3) }}", "icon": "2147", "repeat": 2, "duration": 5 }' mode: single
/flows/npWxo0jJ5vJk/11388.gif
/flows/npWxo0jJ5vJk/2147.gif
-- Flow first published on December 24, 2023, last updated on December 24, 2023 at 15:09.