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
| System | Home Assistant |
|---|---|
| Firmware | AWTRIX 3 |
| Topic | Smarthome |
| Built by | Michal 'mKotek' Kotnowski |
| File | Kx0QA4BWOneR.yaml · 1.4 KB |
| Icons | 2 |
| Published | 12 Oct 2024 · updated 12 Oct 2024 |
| Downloads | 6 |
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.
Kx0QA4BWOneR.yaml
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
These icons belong on the device, in /ICONS. Each one is at
most 32×8
pixels — shown here magnified, at their real proportions.
8×8 px
8×8 px
More flows for Home Assistant or Smarthome
Something wrong with this flow? Report it.