Skip to content

Normalize currency codes, improve auth/connectivity handling, add options & UI fixes#10

Open
GuvHas wants to merge 1 commit intomainfrom
codex/review-home-assistant-integration-code
Open

Normalize currency codes, improve auth/connectivity handling, add options & UI fixes#10
GuvHas wants to merge 1 commit intomainfrom
codex/review-home-assistant-integration-code

Conversation

@GuvHas
Copy link
Copy Markdown
Owner

@GuvHas GuvHas commented Mar 17, 2026

Motivation

  • Move currency handling to ISO-style codes and provide consistent symbols and normalization to avoid legacy-symbol ambiguity.
  • Improve detection and handling of authentication and transient connectivity errors from the third-party cellartracker library to present accurate HA config flow feedback and coordinator behavior.
  • Tighten options validation for scan interval and harden the UI/API endpoints and embedded web UI for safer token handling and display of currency symbols.

Description

  • Replace legacy currency symbols with ISO-like codes and add CURRENCY_SYMBOLS, LEGACY_CURRENCY_MAP, DEFAULT_SCAN_INTERVAL, MIN_SCAN_INTERVAL, and normalize_currency in const.py and update defaults accordingly.
  • Update cellar_data.py to use CONF_USERNAME, CONF_PASSWORD, and CONF_SCAN_INTERVAL, add _is_auth_error/_is_connectivity_error helpers, raise ConfigEntryAuthFailed for auth failures, log connectivity issues, and set always_update=False on the DataUpdateCoordinator.
  • Improve config_flow.py to normalize currency input, validate credentials using the cellartracker library with granular error mapping (auth, cannot_connect, unknown), and enforce minimum scan interval constraints in the UI.
  • Update sensor.py to normalize the configured currency for the monetary sensor and mark the inventory status sensor with EntityCategory.DIAGNOSTIC.
  • Enhance REST views in views.py to expose currency_symbol alongside currency from /api/cellartracker/settings using CURRENCY_SYMBOLS.
  • Harden the embedded web UI www/cellar.html with improved token extraction (supporting ct_token), same-origin credentials, safer fetch error messaging, normalized settings usage for currency_symbol, rel="noopener noreferrer" on links, and improved search/filter event handling.
  • Bump package metadata version in hacs.json to 0.0.11.

Testing

  • No automated tests were added or executed as part of this change.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant