Official exchange rate for EUR/USD to PLN for Polish National Bank (NBP) via API
Home Assistant

Official exchange rate for EUR/USD to PLN for Polish National Bank (NBP) via API

The official exchange rate of Polish Zloty to foreign currencies US Dollar and Euro for the last available date from the website of the Polish National Bank (NBP) via API
A flow by Michal 'mKotek' Kotnowski

Go to automations Download flow Download assets

Flow Details

You need to create a sensor in the configuration.yaml file or add a link to the file where the eur_npb_a and usd_nbp_a sensors are defined. In my case, I added the following lines to the my sensors.yaml file (or configuration.yaml if you are not using separate files per HA domain).

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_55bb50.

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

The automation is based on the one for Ukraine hryvnia by Dmytro Sudakevych (megadimich), thank you for the inspiration.

1. sensors.yaml: - platform: rest name: EUR NBP A # sensor.eur_nbp_a resource: http://api.nbp.pl/api/exchangerates/rates/A/EUR/?format=json value_template: "{{ value_json.rates[0].mid }}" json_attributes_path: $.rates.[0] scan_interval: 500 unit_of_measurement: "PLN" - platform: rest name: USD NBP A # sensor.usd_nbp_a resource: http://api.nbp.pl/api/exchangerates/rates/A/USD/?format=json value_template: "{{ value_json.rates[0].mid }}" json_attributes_path: $.rates.[0] scan_interval: 500 unit_of_measurement: "PLN"" 2. automations.yaml: - id: '2024101201' alias: 'AWTRIX: USD and EURO currency rates for Polish National Bank (NBP) Table A' description: '' triggers: - minutes: /4 trigger: time_pattern conditions: [] actions: - data: qos: '0' retain: false topic: awtrix_55bb50/custom/rateeurnbpa payload: '{ "text": "{{ states(''sensor.eur_nbp_a'') | round(4) }}", "icon": "2147", "repeat": 2, "duration": 5 }' action: mqtt.publish - data: qos: '0' retain: false topic: awtrix_55bb50/custom/rateusdnbpa payload: '{ "text": "{{ states(''sensor.usd_nbp_a'') | round(4) }}", "icon": "11388", "repeat": 2, "duration": 5 }' action: mqtt.publish mode: single
/flows/Kx0QA4BWOneR/2147.gif
/flows/Kx0QA4BWOneR/11388.gif
-- Flow first published on October 12, 2024, last updated on October 12, 2024 at 22:45.