Initial Up Banking Home Assistant integration
Validate / syntax (push) Canceled after 0s

This commit is contained in:
git
2026-09-27 17:36:54 +10:00
commit 264a7dd42f
17 changed files with 486 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
"""Pure data conversion helpers kept independent of Home Assistant."""
from __future__ import annotations
from typing import Any
def account_label(account: dict[str, Any]) -> str:
"""Human friendly account label used only in UI, never as an identifier."""
attrs = account["attributes"]
return f"{attrs['displayName']} ({attrs['accountType'].title()}, {attrs['ownershipType'].title()})"
def transaction_event(transaction: dict[str, Any], event_type: str) -> dict[str, Any]:
"""Return the deliberately small, automation-oriented event payload."""
attrs = transaction["attributes"]
money = attrs["amount"]
account = transaction.get("relationships", {}).get("account", {}).get("data", {})
return {
"transaction_id": transaction["id"],
"event_type": event_type,
"status": attrs["status"].lower(),
"account_id": account.get("id"),
"amount": money["value"],
"currency": money["currencyCode"],
"description": attrs.get("description", ""),
"created_at": attrs.get("createdAt"),
"raw_text": attrs.get("rawText"),
}