Skip to content

Commit 147ac4f

Browse files
cloudbr34k84claude
andcommitted
fix: add device_info to User sensor, update README for v0.4.4
- PocketSmithUserSensor now defines device_info so it appears under the PocketSmith device like all other entities - Per-category sensor docs updated to reflect monthly scoping - Attribute descriptions updated for budgeted, actual, remaining, over_by, percentage_used - Added transaction_count attribute to docs - Over budget binary sensor description updated Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 73ef27e commit 147ac4f

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
- Live balance sensors for every account linked to your PocketSmith profile
1414
- A net worth sensor summing all account balances
15-
- Per-category spending sensors with budget vs. actual tracking
15+
- Per-category spending sensors with monthly budget vs. actual tracking (pro-rated for non-bill categories, event-based for bill categories)
1616
- Uncategorised transaction count so nothing slips through the cracks
1717
- Binary sensors that alert you when you are over budget or have uncategorised transactions
1818
- A user profile sensor with account metadata
@@ -167,12 +167,12 @@ Reports the total number of spending/income categories (excluding transfer categ
167167

168168
### Per-category sensors
169169

170-
One sensor is created for each non-transfer category in your PocketSmith account, enriched with budget data for the current period.
170+
One sensor is created for each non-transfer category in your PocketSmith account, enriched with budget data scoped to the current calendar month.
171171

172172
| Property | Value |
173173
|---|---|
174174
| Entity ID pattern | `sensor.<category_name>` |
175-
| State | Actual spend in the current period (numeric, `0` if no data) |
175+
| State | Actual spend for the current calendar month (numeric, `0` if no data) |
176176
| Unit | Category currency code |
177177
| Icon | `mdi:cash-check` (on budget) / `mdi:cash-remove` (over budget) |
178178

@@ -185,12 +185,13 @@ One sensor is created for each non-transfer category in your PocketSmith account
185185
| `parent_id` | Parent category ID (if nested) |
186186
| `parent_title` | Parent category name (if nested) |
187187
| `is_bill` | `true` if marked as a bill in PocketSmith |
188-
| `budgeted` | Budgeted amount for the current period |
189-
| `actual` | Actual spend for the current period |
190-
| `remaining` | Amount remaining under budget (`under_by`) |
191-
| `over_by` | Amount over budget (if applicable) |
188+
| `budgeted` | Budgeted amount for the current month. For non-bill categories this is pro-rated from the budget period to the calendar month. For bill categories this is the sum of bills scheduled this month. |
189+
| `actual` | Actual spend from transactions this calendar month (`0` if no transactions) |
190+
| `remaining` | Amount remaining under budget (`0` if over budget) |
191+
| `over_by` | Amount over budget (`0` if under budget) |
192192
| `over_budget` | `true` / `false` |
193-
| `percentage_used` | Percentage of budget consumed |
193+
| `percentage_used` | Percentage of budget consumed (rounded to 2 decimal places) |
194+
| `transaction_count` | Number of transactions in this category for the current month |
194195
| `currency` | Currency code |
195196

196197
---
@@ -213,7 +214,7 @@ Reports the authenticated user's display name and exposes profile metadata as at
213214

214215
### Pocketsmith Over Budget
215216

216-
Turns **on** (problem) when one or more non-transfer budget categories have exceeded their budget in the current period.
217+
Turns **on** (problem) when one or more non-transfer budget categories have exceeded their monthly budget.
217218

218219
| Property | Value |
219220
|---|---|

custom_components/ha_pocketsmith/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"iot_class": "cloud_polling",
1111
"issue_tracker": "https://github.com/cloudbr34k84/home-assistant-pocketsmith/issues",
1212
"requirements": [],
13-
"version": "0.4.4"
13+
"version": "0.4.5"
1414
}

custom_components/ha_pocketsmith/sensor.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,12 @@ def __init__(self, coordinator: PocketSmithCoordinator) -> None:
343343
"""Initialise the sensor."""
344344
super().__init__(coordinator)
345345
self._user_id = coordinator.data["user_id"]
346+
347+
@property
348+
def device_info(self) -> DeviceInfo:
349+
"""Return device info."""
350+
return _make_device_info(self.coordinator)
351+
346352
@property
347353
def unique_id(self) -> str:
348354
"""Return a unique ID for this sensor."""

0 commit comments

Comments
 (0)