Skip to content

Commit

Permalink
Merge pull request #27 from wxt9861/feat/budget_amount
Browse files Browse the repository at this point in the history
Feat/budget amount
  • Loading branch information
wxt9861 authored May 1, 2023
2 parents 50752fc + cb3d1fb commit 5327501
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ 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 balance of any specified account
5. Number of transactions needing approval
6. Number of uncleared transactions
7. Number of overspent categories
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

To keep api usage low, the sensor updates every 5 minutes.

Expand Down
5 changes: 4 additions & 1 deletion custom_components/ynab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,12 @@ async def update_data(self):
self.hass.data[DOMAIN_DATA].update(
[(category.name, category.balance / 1000)]
)
self.hass.data[DOMAIN_DATA].update(
[(category.name + "_budgeted", category.budgeted / 1000)]
)
_LOGGER.debug(
"Received data for categories: %s",
[category.name, category.balance / 1000],
[category.name, category.balance / 1000, category.budgeted / 1000],
)


Expand Down
2 changes: 1 addition & 1 deletion custom_components/ynab/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

PLATFORMS = ["sensor"]
REQUIRED_FILES = ["const.py", "manifest.json", "sensor.py"]
VERSION = "0.1.13"
VERSION = "0.2.0"
ISSUE_URL = "https://github.com/wxt9861/ynab/issues"

STARTUP = """
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ynab/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"codeowners": ["@wxt9861"],
"iot_class": "cloud_polling",
"requirements": ["ynab-sdk==0.4.0"],
"version": "0.1.13"
"version": "0.2.0"
}
3 changes: 3 additions & 0 deletions custom_components/ynab/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ async def async_update(self):
self.attr[category.replace(" ", "_").lower()] = self.hass.data[
DOMAIN_DATA
].get(category)
self.attr[
(category + "_budgeted").replace(" ", "_").lower()
] = self.hass.data[DOMAIN_DATA].get(category + "_budgeted")
else:
category_error = CATEGORY_ERROR.format(category=category)
_LOGGER.error(category_error)
Expand Down

0 comments on commit 5327501

Please sign in to comment.