Giter VIP home page Giter VIP logo

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

Watchers

 avatar  avatar  avatar  avatar  avatar

ynab's Issues

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!

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

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.

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

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'))

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"

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.

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

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.

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.

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!

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

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

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

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

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.