Skip to content

feat: order history & spending analytics sensors#64

Open
kwaczek wants to merge 11 commits intodvejsada:masterfrom
kwaczek:feat/order-history-sensors
Open

feat: order history & spending analytics sensors#64
kwaczek wants to merge 11 commits intodvejsada:masterfrom
kwaczek:feat/order-history-sensors

Conversation

@kwaczek
Copy link

@kwaczek kwaczek commented Feb 26, 2026

Summary

  • Order History Storage: Persistent JSON-based OrderStore with paginated API fetch for full order history backfill
  • Spending Analytics Sensors: 10 new sensors for category spending (L0–L3) and per-item spending, each with "this year" and "all time" variants
  • Config Flow: Two-step wizard (login → analytics) with opt-in checkboxes for analytics levels, configurable top N items (default 10), and hide discontinued products toggle
  • Options Flow: All analytics settings reconfigurable on existing entries via the Configure button
  • Background Processing: Full order history download and enrichment runs in the background without blocking the config flow
  • Localized Notifications: Progress notifications during enrichment in EN/CS based on HA language setting

Test plan

  • Production deployment tested with 484 orders
  • Fresh Docker HA instance: full wizard flow (login → analytics → completion) works end-to-end
  • Options flow: changing top N and hide discontinued works on existing entries
  • Sensors correctly display top N items with total_count attribute
  • Discontinued products excluded when hide option is enabled
  • Background history fetch completes without blocking UI
  • Verify on clean install without analytics enabled (base sensors only)

🤖 Generated with Claude Code

mirobotur and others added 10 commits February 26, 2026 12:27
Adds yearly and all-time spending sensors with local JSON storage
for order history. Phase 1 of the order analytics feature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7 bite-sized tasks: API pagination, OrderStore, sensors, service, translations, tests, deploy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add opt-in spending analytics with category breakdown sensors (L0-L3)
and per-item spending sensors. Users can configure analytics levels,
top N items to display (default 10), and hide discontinued products
via the config flow wizard and options flow. Full order history is
fetched in the background when analytics is enabled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kwaczek kwaczek changed the title feat: add yearly and all-time spending sensors with order history storage feat: order history & spending analytics sensors Feb 27, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dvejsada
Copy link
Owner

@kwaczek Thank you for this PR. However, please kindly add to make this (i.e. total history fetching and analytics) optional in the config with default being off - I would presume that may people (and I am one of them) do not want this kind of details to be fetched and stored in HA, incl. all history.

@kwaczek
Copy link
Author

kwaczek commented Feb 28, 2026

@dvejsada It is optional during the wizard and turned off by default. Spin off a new HA in docker and check the wizard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants