ben8p / home-assistant-bunq-balance-sensors

Home assistant custom component to provide monetary account balance sensors for Bunq
17 stars 6 forks source link
bunq bunq-api hacs hassio home-assistant home-assistant-custom home-assistant-sensor

hacs_badge

Bunq Integration

This integration provides access to Bunq:

⚠️⚠️⚠️⚠️⚠️ Backward incompatibility ⚠️⚠️⚠️⚠️⚠️

Version 1.0.0 of the integration was using configuration.yaml and bunq api key. This is now fully deprecated. It won't work anymore. It was replaced by oauth.

If you are upgrading, before installing version 2.0.0 you should:

Minimum version for HA

2023.6.1+

Integration configuration

Simply follow the config flow. The integration uses oauth. In order to get the "client id" and the "client secret" follow these steps:

Note: During the configuration process you will be redirected to https://my.home-assistant.io. There, you need to enter the address on which your home assistant can be reached (it can be local ip/dns or external one) Then click on "Link Account"

Why oauth instead of API Key ?

oauth is much safer. API keys gives all writes to your accounts (including money transfert). However, oauth only allow reading.

Displaying transaction details

Each account sensor can show the balance as well as a list of transactions.
You can use the custom card html-template-card to display them.

Example of configuration:

type: "custom:html-template-card"
title: Transactions
ignore_line_breaks: true
content: >
    <style>.bunq_table { width:100% } .bunq_table tr:nth-child(even) {background:
    var(--material-secondary-background-color)}</style>
    <table class="bunq_table">
        <tr>
            <th>Amount</th> <th>Description</th> <th>Time</th>
        </tr>

        {% for transaction in state_attr('sensor.bunq_groceries', 'transactions') %}
        <tr>
            <td style="width: 20%;text-align:right">
            {{ transaction.amount }}&nbsp;{{ transaction.currency }}
            </td>

            <td style="padding:0 0.5em">
            {{ transaction.description }}
            </td>

            <td style="width: 20%;">
            {{ strptime(transaction.created, '%Y-%m-%d %H:%M:%S.%f') | relative_time }}
            </td>
        </tr>
        {% endfor %}
    </table>

CHANGELOG

V2.1.0

V2.0.0

V1.0.0