Giter Site home page Giter Site logo

ynab's Introduction

ynab

YNAB component for Home Assistant This component will retreieve the following data from your YNAB budget

  1. To be budgeted amount
  2. Current month's budgeted amount
  3. Current month's remaining balance of any specified category
  4. Current month's budgeted amount of any specific category
  5. Current balance of any specified account
  6. Number of transactions needing approval
  7. Number of uncleared transactions
  8. Number of overspent categories

Update Frequency & YNAB API Rate Limit

To keep api usage low, the sensor updates every 5 minutes which equates to 12 times per hour. YNAB has a rate limit (https://api.ynab.com/#rate-limiting) of 200 requests per hour and that number resets every hour on the hour.

Installation

HACS

  1. Open HACS > Settings
  2. In ADD CUSTOM REPOSITORY box paste this git's URL https://github.com/wxt9861/ynab and select type Integration
  3. Click INSTALL
  4. Make necessary modifications to your configuration.yaml
  5. Restart Home Assistant

Manual install

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called ynab.
  4. Download all the files from the custom_components/ynab/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Add ynab: to your HA configuration (see examples below)
  7. Restart Home Assistant

Configuration options

Key Type Required Default Description
api_key string True None YNAB API key (see instructions below)
name string False sensor.ynab Custom name for the sensor
budget string False last-used Budget ID to use if you have multiple budgets. If none specified, your last used budget will be used
currency string False $ Currency to use as unit of measurement
categories list False None List of YNAB categories to include in the sensor. These are CASE SENSITIVE
accounts list False None List of YNAB accounts to include in the sensor. These are CASE SENSITIVE

Example default configuration.yaml

ynab:
  api_key: <api_key_here>

Example: configuration.yaml with options

ynab:
  api_key: <api_key_here>
  name: "My YNAB Budget"
  budget: <budget_id_here>
  currency: "$"
  categories:
    - "HASS Budget"
    - "Vacation Budget"
  accounts:
    - "Savings Account"

To enable debug

logger:
  logs:
    custom_components.ynab: debug

Generate YNAB API key / Get budget ID

API:

  1. Log on to YNAB
  2. Go to My Budget > My Account > Developer Settings
  3. Click on New Token
  4. Enter your password and click Generate
  5. Copy the token that appears at the top of the page

Budget ID: The budget ID is the combination between the slashes after the URL https://app.youneedabudget.com If you only have one budget, you can omit the budget option, if you have multiple budgets pick a budget you want the sensor to report on. At this time only 1 budget is retrieved.

ynab's People

Contributors

alasdairh avatar arretx avatar bazgear avatar burnnat avatar cameri avatar quinnhosler avatar rghunter avatar wxt9861 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ynab's Issues

Error Updating Sensor

home assistant: core-2021.7.3
ynab: v0.1.9

The sensor seemed to work (maybe) the first time, but it has pretty consistently failed after that.

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/ynab/init.py:107
Integration: ynab (documentation, issues)
First occurred: 01:43:30 (3 occurrences)
Last logged: 01:53:30

Update for sensor.ynab fails
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 73, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/lib/python3.9/socket.py", line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f8e6ef3a0>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.youneedabudget.com', port=443): Max retries exceeded with url: /v1/budgets (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f8e6ef3a0>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 401, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 609, in async_device_update
raise exc
File "/config/custom_components/ynab/sensor.py", line 31, in async_update
await self.hass.data[DOMAIN_DATA]["client"].update_data()
File "/config/custom_components/ynab/init.py", line 107, in update_data
self.all_budgets = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/ynab_sdk/api/budgets.py", line 12, in get_budgets
response = self.client.get("/budgets")
File "/usr/local/lib/python3.9/site-packages/ynab_sdk/utils/clients/default_client.py", line 14, in get
response = requests.get(url, headers=self.headers)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.youneedabudget.com', port=443): Max retries exceeded with url: /v1/budgets (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f8e6ef3a0>: Failed to establish a new connection: [Errno -3] Try again'))

Error on device update (new install)

I just installed this integration and from the start, it is not working. Here is what the logs show. Any ideas?

2021-08-27 17:52:53 ERROR (MainThread) [homeassistant.components.sensor] ynab: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 646, in async_device_update
await task
File "/config/custom_components/ynab/sensor.py", line 31, in async_update
await self.hass.data[DOMAIN_DATA]["client"].update_data()
File "/config/custom_components/ynab/init.py", line 107, in update_data
self.all_budgets = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/ynab_sdk/api/budgets.py", line 13, in get_budgets
return BudgetSummaryResponse.from_dict(response)
File "/usr/local/lib/python3.9/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 102, in from_dict
data = Data.from_dict(obj.get("data"))
File "/usr/local/lib/python3.9/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 91, in from_dict
budgets = parsers.from_list(Budget.from_dict, obj.get("budgets"))
File "/usr/local/lib/python3.9/site-packages/ynab_sdk/utils/parsers.py", line 47, in from_list
return [f(y) for y in x]
File "/usr/local/lib/python3.9/site-packages/ynab_sdk/utils/parsers.py", line 47, in
return [f(y) for y in x]
File "/usr/local/lib/python3.9/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 71, in from_dict
date_format = DateFormat.from_dict(obj.get("date_format"))
File "/usr/local/lib/python3.9/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 48, in from_dict
assert isinstance(obj, dict)
AssertionError

Sensor not created

I'm having the exact same issue as #21 but can't figure it out. I have this in my configuration.yaml:

logger:
  default: info
  logs:
    custom_components.ynab: debug

ynab:
  api_key: !secret ynab_token
  accounts:
    - "Shared Chequing"
    - "Shared VISA"
    - "Shared Line of Credit"

Logs look fine, but there is no sensor.

2022-06-28 13:58:15 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ynab
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Found 1 budgets
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Budget name: My Budget - id: xxxxxx
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Retrieving data from budget id: xxxxxx
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for: to be budgeted: 0.0
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for: unapproved transactions: 0
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for: uncleared transactions: 0
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for: total balance: -6572.84
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for account: ['Shared Chequing', 1312.17]
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for account: ['Shared Line of Credit', -5643.41]
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for account: ['Shared VISA', -241.6]
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for: budgeted this month: 312.17
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for: activity this month: 0.0
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for: age of money: None
2022-06-28 13:58:18 DEBUG (MainThread) [custom_components.ynab] Received data for: overspent categories: 1

Setting the name seems to do nothing as i still see "Setting up sensor.ynab" in the log, and there is still no sensor.

ynab:
  api_key: !secret ynab_token
  name: budget
  accounts:
    - "Shared Chequing"
    - "Shared VISA"
    - "Shared Line of Credit"

Pending Transactions for monitored accounts

Hi, not as much an issue but a limitation that I'm curious if you could assist with.

I have various credit cards and I manage one and my wife manages the other. It would be awesome to see if there were "need_approval" tagged to each account, so I could script a notification and dashboard to show who needs to go in and update their budget.

Thanks!

Claude AI Magically Fixed My YNAB Integration and I Wanted to Share In Case It's Helpful Or To Find Out If I Have Made A Poor Decision

Title is accurate, sharing in case it helps someone else.... or to give people a chance to tell me how badly Claude is screwing me over.

So I finally remembered that this integration existed and decided to add it to my homeassistant instance a couple of days ago. This is such a neat integration and it will enable some cool automations that will greatly boost my Partner Approval Factor. I installed it via the HACS following the instructions and saw the following error in logs after restarting.

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:727
integration: Sensor (documentation, issues)
First occurred: 3:02:59 PM (1 occurrences)
Last logged: 3:02:59 PM
ynab: Error on device update!

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 727, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1300, in async_device_update
    await self.async_update()
  File "/config/custom_components/ynab/sensor.py", line 32, in async_update
    await self.hass.data[DOMAIN_DATA]["client"].update_data()
  File "/config/custom_components/ynab/__init__.py", line 123, in update_data
    self.all_budgets = await self.hass.async_add_executor_job(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ynab_sdk/api/budgets.py", line 13, in get_budgets
    return BudgetSummaryResponse.from_dict(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 102, in from_dict
    data = Data.from_dict(obj.get("data"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 91, in from_dict
    budgets = parsers.from_list(Budget.from_dict, obj.get("budgets"))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ynab_sdk/utils/parsers.py", line 47, in from_list
    return [f(y) for y in x]
            ^^^^
  File "/usr/local/lib/python3.12/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 72, in from_dict
    currency_format = CurrencyFormat.from_dict(obj.get("currency_format"))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 21, in from_dict
    assert isinstance(obj, dict)
           ^^^^^^^^^^^^^^^^^^^^^
AssertionError

I thought I had messed up the configuration.yml so I tried cutting it down to the minimum, changing things etc.. No dice. I checked this repo's issues and didn't see anything, checked the original ynab-sdk repo and also didn't see anything there.

I got claude involved and after a very long back and forth I ended up with this:

Here's what you can do:

In your custom component directory (/config/custom_components/ynab/), create a new file called ynab_sdk_patch.py.

Add the following code to ynab_sdk_patch.py:
from ynab_sdk.api.models.responses.budget_summary import CurrencyFormat, Budget
from ynab_sdk.utils import parsers

def patched_currency_format_from_dict(obj):
    if obj is None or not isinstance(obj, dict):
        print(f"Warning: currency_format is not a dict. Received: {obj}")
        return CurrencyFormat("", "", 0, "", False, "", "", False)
    
    iso_code = parsers.from_str(obj.get("iso_code", ""))
    example_format = parsers.from_str(obj.get("example_format", ""))
    decimal_digits = parsers.from_int(obj.get("decimal_digits", 0))
    decimal_separator = parsers.from_str(obj.get("decimal_separator", ""))
    symbol_first = parsers.from_bool(obj.get("symbol_first", False))
    group_separator = parsers.from_str(obj.get("group_separator", ""))
    currency_symbol = parsers.from_str(obj.get("currency_symbol", ""))
    display_symbol = parsers.from_bool(obj.get("display_symbol", False))
    
    return CurrencyFormat(
        iso_code,
        example_format,
        decimal_digits,
        decimal_separator,
        symbol_first,
        group_separator,
        currency_symbol,
        display_symbol,
    )

def patched_budget_from_dict(obj):
    assert isinstance(obj, dict)
    budget_id = parsers.from_str(obj.get("id"))
    name = parsers.from_str(obj.get("name"))
    last_modified_on = parsers.from_datetime(obj.get("last_modified_on"))
    first_month = parsers.from_str(obj.get("first_month"))
    last_month = parsers.from_str(obj.get("last_month"))
    date_format = obj.get("date_format")
    currency_format = patched_currency_format_from_dict(obj.get("currency_format"))
    return Budget(
        budget_id,
        name,
        last_modified_on,
        first_month,
        last_month,
        date_format,
        currency_format,
    )

# Patch the original methods
CurrencyFormat.from_dict = staticmethod(patched_currency_format_from_dict)
Budget.from_dict = staticmethod(patched_budget_from_dict)
In your __init__.py file, add the following import at the top:
from .ynab_sdk_patch import *

I don't know much about python development but this didn't look like it was going to steal my data or permanently break my homeassistant so I copy pasted this all in where Claude suggested and my ynab integration is working now. Does anyone know what I did and whether this was a good idea? Is it just working for everyone else, did I bark up a wrong tree? Will AI take all our jobs and do pigs have wings?

API Access Not Working

I'm seeing the same issue as previously, on the latest release...no info except that the token doesn't work. Even created a new token and doesn't work. api_key is the only option I'm specifying in my config. I have a couple older budgets but specifying one doesn't seem to make a difference.

Logger: custom_components.ynab
Source: custom_components/ynab/init.py:209
Integration: ynab (documentation)
First occurred: 3:37:14 PM (1 occurrences)
Last logged: 3:37:14 PM

Could not retrieve data - verify API key

Warnings about updating the sensor taking long

Getting warnings in the home assistant core logs about the component taking longer than expected to update the sensor

[homeassistant.helpers.entity] Update of sensor.budget is taking over 10 seconds
2021-09-08 09:33:43 WARNING (MainThread) [homeassistant.components.sensor] Updating ynab sensor took longer than the scheduled update interval 0:00:30

I will enable debugging and update with that as well

Categories Not Updating Balances

I am including two categories in my request so that I can add them as template sensors and display them on a dashboard. When I budget money I see the overall available balance update every 5 minutes as expected, but the category balances do not update. The names match up (case sensitive) and the correct values were set when the initial connection was established, but after that they don't update.

Request: Original Budgeted Amount

In addition to importing the amount I have left in my budget, I would love to see it also include the original budgeted amount.

This way I can create my budgets in YNAB and have my custom bar-card update automatically with the correct graph information.

And example of this is below.

type: custom:bar-card
entities:
  - entity: sensor.template_ynab_groceries
    unit_of_measurement: $
    icon: mdi:cart
    severity:
      - from: '0'
        to: '100'
        color: rgba(222,91,107,1)
      - from: '101'
        to: '300'
        color: var(--label-badge-yellow)
      - from: '301'
        color: var(--label-badge-green)
    min: '0'
    max: '500'

Ideally, I want the max value to be imported as well, with that being what I had originally budgeted.

The integration quit working for some reason...

I've included the log. Just checked my system and I have no sensor for YNAB anymore. Is this related to the recent change?

2023-08-14 22:09:07.426 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ynab which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-14 22:09:46.299 ERROR (MainThread) [homeassistant.components.sensor] ynab: Error on device update!
File "/config/custom_components/ynab/sensor.py", line 32, in async_update
File "/config/custom_components/ynab/init.py", line 119, in update_data
File "/usr/local/lib/python3.11/site-packages/ynab_sdk/api/budgets.py", line 12, in get_budgets
File "/usr/local/lib/python3.11/site-packages/ynab_sdk/utils/clients/default_client.py", line 14, in get

Component stopped working

Sensor.ynab suddenly disappeared from Home Assistant

2022-12-22 21:43:57.275 ERROR (MainThread) [homeassistant.components.sensor] ynab: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update
await task
File "/config/custom_components/ynab/sensor.py", line 32, in async_update
await self.hass.data[DOMAIN_DATA]["client"].update_data()
File "/config/custom_components/ynab/__init__.py", line 113, in update_data
self.all_budgets = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/ynab_sdk/api/budgets.py", line 13, in get_budgets
return BudgetSummaryResponse.from_dict(response)
File "/usr/local/lib/python3.10/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 102, in from_dict
data = Data.from_dict(obj.get("data"))
File "/usr/local/lib/python3.10/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 91, in from_dict
budgets = parsers.from_list(Budget.from_dict, obj.get("budgets"))
File "/usr/local/lib/python3.10/site-packages/ynab_sdk/utils/parsers.py", line 47, in from_list
return [f(y) for y in x]
File "/usr/local/lib/python3.10/site-packages/ynab_sdk/utils/parsers.py", line 47, in <listcomp>
return [f(y) for y in x]
File "/usr/local/lib/python3.10/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 72, in from_dict
currency_format = CurrencyFormat.from_dict(obj.get("currency_format"))
File "/usr/local/lib/python3.10/site-packages/ynab_sdk/api/models/responses/budget_summary.py", line 21, in from_dict
assert isinstance(obj, dict)
AssertionError

Home Assistant 2022.12.8
Supervisor 2022.12.1
Frontend 20221213.1 - latest

No sensor found, and no errors in logs

Log:-

$ klogs home | grep ynab
2022-06-28 15:57:24 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration ynab which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-06-28 15:57:25 INFO (MainThread) [custom_components.ynab]
ynab
https://github.com/wxt9861/ynab/issues
2022-06-28 15:57:28 DEBUG (MainThread) [custom_components.ynab] Connection with YNAB established
2022-06-28 15:57:28 DEBUG (MainThread) [custom_components.ynab] YAML configured budget - ef98fccb-e212-43ea-99c5-6ec5f00b130d
2022-06-28 15:57:28 DEBUG (MainThread) [custom_components.ynab] Monitoring categories - ['Groceries']
2022-06-28 15:57:28 DEBUG (MainThread) [custom_components.ynab] Monitoring accounts - ['Savings', 'Checking', 'Chase Travel', 'Amazon CC']
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Found 1 budgets
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Budget name: My Budget - id: ef98fccb-e212-43ea-99c5-6ec5f00b130d
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Retrieving data from budget id: ef98fccb-e212-43ea-99c5-6ec5f00b130d
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for: to be budgeted: 1887.77
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for: unapproved transactions: 0
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for: uncleared transactions: 0
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for: total balance: 1737.37
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for account: ['Amazon CC', -1]
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for account: ['Chase Travel', -14]
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for account: ['Checking', 2]
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for account: ['Savings', 5]
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for: budgeted this month: 1
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for: activity this month: -12
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for: age of money: 1
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for: overspent categories: 0
2022-06-28 15:57:29 DEBUG (MainThread) [custom_components.ynab] Received data for categories: ['Groceries', 0.0]

image

I changed values from logs, but that's about it. As I can see, there are no errors, however, there is no sensor.ynab created in the Home Assistant page.

Could you give clues on how I debug this? Thanks!

Add support for account balances

I needed support to grab account balances from a budget and it was not available.

I added support in this PR:

#15

I've also corrected a few typos and added documentation of the feature.

Could not retrieve data - verify API key

I'm trying to get your fine integration to work, but I keep getting this error in my logs.

I have verified that I have a correct API Key for ynab. I have some automations i Node-red which uses the ynab API so I know the API keys are working.

I'm using version 0.1.3 from HACS

My config configuration.yaml looks like this

ynab:
  api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The only thing the logs say are:

2019-11-07 23:30:48 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ynab
2019-11-07 23:30:49 ERROR (MainThread) [custom_components.ynab] Could not retrieve data - verify API key

Feature Request : Home Budget Lovelace Card

Love this added it the other day, but I do not see a really good way to display it.
Perhaps a Lovelace card that does the following:

Ready to assign balance
Overspent categories
number of transactions to approve
number of scheduled transactions today

Category Balances defined by the user

  • Fun Money
  • Dining OUt
  • Etc..etc

Update frequency?

The sensor works! However, after 24 hours, there were no changes to the state, which I know would not be true.

So, I'm wondering how the update system works and if the YNAB account is queried regularly or not. Today, the moment I logged into my YNAB account, the sensor in Home Assistant updated...but the whole reason I was seeking out this type of integration was to have HA notify me when there was something new on YNAB.

This makes me wonder if YNAB only processes bank imports upon user login, in which case, there's no way to fully automate notification of new transactions.

Thoughts? By the way, thanks for the integration, aside from this hiccup, it's really cool to be able to integrate this data into the UI in HA.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.