https://github.com/mysiar/ha-custom-component-mnbp
This sensor is using official NBP API
https://github.com/mysiar/ha-custom-component-mnbp
custom-component home-assistant integration
Last synced: about 1 month ago
JSON representation
This sensor is using official NBP API
- Host: GitHub
- URL: https://github.com/mysiar/ha-custom-component-mnbp
- Owner: mysiar
- License: mit
- Created: 2025-10-29T13:25:47.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-10-29T16:32:15.000Z (8 months ago)
- Last Synced: 2025-10-29T17:40:36.196Z (8 months ago)
- Topics: custom-component, home-assistant, integration
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Home Assistant custom component NBP
Provides
- NBP exchange rates for today (table C) `*`
- NBP gold price for today `*`
`*` - requires manual update via automation to fetch the latest data from NBP API.
## Sensor configuration
```yaml
sensor:
- platform: mnbp
type: exchange_today
- platform: mnbp
type: gold_today
```
## Automations
```yaml
- id: 'f2b0c78b-25b9-4ec2-9e9c-aa258cc8a4a1'
alias: Update NBP Exchange Sensor Daily at 08:30
description: Trigger manual update of NBP exchange rate sensor
trigger:
- platform: time
at: "08:30:00"
action:
- service: homeassistant.update_entity
target:
entity_id: sensor.nbp_exchange_rate_today
mode: single
- id: 'f2b0c78b-25b9-4ec2-9e9c-aa258cc8a4a2'
alias: Update NBP Gold Sensor Daily at 08:30
description: Trigger manual update of NBP gold price sensor
trigger:
- platform: time
at: "08:30:00"
action:
- service: homeassistant.update_entity
target:
entity_id: sensor.nbp_gold_price_today
mode: single
```
## Instalation
### 📦 Manual Installation
To install this integration manually, you need to download [**mnbp.zip**](https://github.com/mysiar/ha-custom-component-mnbp/releases/latest/download/mnbp.zip) and extract its contents to the `config/custom_components/mnbp` directory.
```bash
mkdir -p custom_components/mnbp
cd custom_components/mnbp
wget https://github.com/mysiar/ha-custom-component-mnbp/releases/latest/download/mnbp.zip
unzip mnbp.zip
rm mnbp.zip
```
## Display data (markdown-card)
### exchange_today
#### markdown table display
```yaml
{% set rates = state_attr('sensor.nbp_exchange_rate_today', 'rates') %}
{% if rates %}
|Kod | Kupno | Sprzedaż | Waluta|
|------|---------|----------|-------|{% for r in rates %}
| {{ "%-5s"|format(r.code) }} | {{"%7.4f"|format(r.bid) }} | {{ "%8.4f"|format(r.ask) }} | {{ r.currency }} |{% endfor %} {% else %} _Brak danych kursów walut._ {% endif %}
```
#### html table display
```yaml
{% set rates = state_attr('sensor.nbp_exchange_rate_today', 'rates') %}
{% if rates %}
KodKupnoSprzedażWaluta
{% for r in rates %}
{{ r.code }}
{{ "%.4f"|format(r.bid) }} zł
{{ "%.4f"|format(r.ask) }} zł
{{ r.currency }}
{% endfor %}
{% else %}
Brak danych kursów walut.
{% endif %}
```
### gold_today
```
{% set sensor = 'sensor.nbp_gold_price_today' %}
{% set value = states(sensor) %}
{{value}} zł
```