Skip to content

Fix/activity, Area#9

Merged
cayossarian merged 5 commits into
mainfrom
fix/activity-area
Apr 14, 2026
Merged

Fix/activity, Area#9
cayossarian merged 5 commits into
mainfrom
fix/activity-area

Conversation

@cayossarian
Copy link
Copy Markdown
Member

Add 'By Activity' and 'By Area' in addition to the existing 'By Panel' views.

Add two new shared views to both the Lovelace card and integration panel:
- By Activity: circuits sorted by power consumption with expandable graphs
- By Area: circuits grouped by HA area with expandable graphs

Both views share rendering code via ListViewController and reuse
renderCircuitSlot for expanded circuit cards. Includes search filtering,
W/A unit toggle, area resolution at discovery time with live registry
subscriptions, and configurable tab style (text/icon) for the card.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds two new list-style ways to browse circuits—By Activity and By Area—to both the integration panel UI and the Lovelace card, backed by Home Assistant registry-based area resolution.

Changes:

  • Add shared tab bar rendering + new By Activity / By Area tabs in the panel and card.
  • Implement list views (search, expand/collapse, unit toggle) and HA area resolution with live registry update subscriptions.
  • Add card editor option for tab style (text vs icon) and bump version to 0.9.2 (plus a chart update fix).

Reviewed changes

Copilot reviewed 16 out of 19 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/types.ts Adds Circuit.area and CardConfig.tab_style types.
src/panel/span-panel.ts Adds Activity/Area tabs and list-view rendering inside the integration panel.
src/i18n.ts Adds new tab/list/editor strings across supported languages.
src/editor/span-panel-card-editor.ts Adds a “Tab Style” selector to the card editor.
src/core/tab-bar-renderer.ts New helper to render a shared tab bar + delegated click binding.
src/core/list-view-controller.ts New controller for list views (rendering, search filtering, expand/collapse, unit change events).
src/core/list-renderer.ts New HTML builders for list UI pieces (rows, expanded content, headers).
src/core/grid-renderer.ts Updates renderCircuitSlot to support inline rendering and hides unknown shedding icon.
src/core/area-resolver.ts New HA registry-based area resolver + live update subscription helper.
src/constants.ts Bumps CARD_VERSION to 0.9.2.
src/chart/chart-update.ts Ensures ha-chart-base receives hass before insertion.
src/card/span-panel-card.ts Adds tabs + list views to the Lovelace card and wires unit-change behavior.
src/card/card-styles.ts Adds shared tab bar and list view styling.
src/card/card-discovery.ts Assigns areas during discovery via resolveAndAssignAreas.
package.json Bumps package version to 0.9.2.
package-lock.json Updates lockfile version metadata to 0.9.2.
CHANGELOG.md Documents the new views, tab bar, and chart fix for 0.9.2.

Comment thread src/core/tab-bar-renderer.ts Outdated
Comment thread src/core/list-renderer.ts
Comment thread src/core/list-view-controller.ts
Comment thread src/core/area-resolver.ts Outdated
Comment thread src/core/area-resolver.ts
Comment thread src/panel/span-panel.ts
Comment thread src/panel/span-panel.ts Outdated
- Escape tab.id and tab.icon in buildTabBarHTML via escapeHtml()
- Escape t() output in HTML attributes (placeholder, title)
- Replace innerHTML error rendering with createElement + textContent
- Wrap async area registry handler in try/catch
The By Activity / By Area search filter was lost whenever
subscribeAreaUpdates fired (entity or area registry change), because
renderActivityView/renderAreaView rebuilt the DOM via innerHTML with a
fresh empty search input while _searchQuery persisted only on the
controller and was never re-applied.

Thread _searchQuery through buildSearchBarHTML so the input renders with
its current value, and extract the filtering logic into _applyFilter so
both the input handler and render paths apply identical filter state.
@cayossarian cayossarian merged commit ff9ac92 into main Apr 14, 2026
2 checks passed
@cayossarian cayossarian deleted the fix/activity-area branch April 19, 2026 20:22
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.

2 participants