Skip to content

Release/v2.0.7#235

Open
cayossarian wants to merge 22 commits intomainfrom
release/v2.0.7
Open

Release/v2.0.7#235
cayossarian wants to merge 22 commits intomainfrom
release/v2.0.7

Conversation

@cayossarian
Copy link
Copy Markdown
Member

Avoid HA frontend dependencies per the HA dev blog for custom cards
Fix name preservation on first row on resize
Fix stale refresh on favorites

Picks up span-card ae88740, which restores the _recoverIfNeeded retry
on the panel's visibilitychange handler. Without it, returning to the
Favorites view from a backgrounded tab leaves #tab-content blank when
an async build step resolves empty during WS reconnect.
Picks up span-card 74ddb32, which closes the flex gap between the
relay toggle and the power value so the circuit name reclaims that
10px on narrow displays.
Picks up span-card d540ec9, which drops the 70px min-width on
.list-power-value so short readings hug the relay and the circuit name
reclaims the freed column.
Picks up span-card 30f1012, which adds a two-row fold for list rows
(media query at 520px) and By Panel breaker cells (container query
at 760px panel-grid width) so long circuit names display fully on
phone-width displays instead of ellipsizing into nothing.
Picks up span-card be051ae, which replaces every HA custom-element
reference (ha-icon, ha-switch, ha-card, ha-menu-button, ha-chart-base)
with in-house Lit elements so the card is no longer at risk when HA
renames or removes a frontend component (per the 2026.4 frontend dev
blog). Bundle grows from ~230 KB to ~770 KB, dominated by the bundled
ECharts (SVG renderer, tree-shaken to LineChart + GridComponent +
TooltipComponent + SVGRenderer) that replaces ha-chart-base.
Picks up span-card a8c6d7f, which addresses a code-review pass over the
HA-frontend-deps refactor:
- Guarded customElements.define on the four new Lit elements so
  both span-panel.js and span-panel-card.js can co-exist on the
  same document without throwing on duplicate registration.
- span-chart re-mounts its ECharts instance if options arrives late
  or the element is reattached after disconnect.
- Truncation-fold MutationObserver narrowed to subtree:false and
  default hysteresis bumped to 48px to stop borderline-name
  oscillation.
- 23 new unit tests (truncation-fold, span-icon, span-switch,
  span-menu-button) backed by happy-dom; 245 pass total.
Reverts the entity-routing rule from d65ac95. The previous fix
preferred a circuit-UUID favorite when an entity's unique_id encoded
one — even for entities device-info-attached to a BESS or EVSE
sub-device. That made the EVSE feed-circuit power/current sensors
land as circuit favorites no matter how the user reached them, with
two visible problems:

  1. Heart on the EVSE device card in By Panel created a circuit
     favorite, so the EVSE never appeared as a device card in the
     Favorites view — only as a circuit row representing the feed.
  2. There was no way to favorite an EVSE-as-device through any
     entity with a circuit UUID; the user had to hunt for an EVSE
     status sensor (no circuit UUID) for the device-card outcome.

The simpler rule restored here: any entity attached to a sub-device
favorites the sub-device. The device card on the dashboard already
represents both the EVSE/BESS status sensors AND its feed-circuit
power, so a circuit favorite for the same physical thing would render
it twice in the Favorites view (once as a card, once as a row).
Routing all sub-device entities to the device favorite eliminates
that duplication and preserves the user's natural mental model:
clicking the heart on anything attached to the EVSE means 'favorite
the EVSE'.

The list views (By Activity / By Area on a real panel) are unaffected
— they iterate topology.circuits flat, so the EVSE feed circuit still
appears as a row alongside other circuits in those views (where there
is no device-card layer to provide an alternative representation).

Test for the EVSE-feed-circuit case updated to assert sub-device
favorite; 27 favorites tests pass.
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

Release prep for v2.0.7, updating pinned dependencies and adjusting how Favorites resolve certain entity types (notably sub-device-attached EVSE feed-circuit sensors) alongside corresponding version/test updates.

Changes:

  • Bump integration version to 2.0.7 (manifest + pyproject) and refresh lockfile dependencies (HA, stubs, pytest helper, pillow, uv).
  • Change favorites target resolution so any sub-device-attached entity favorites the sub-device (not the circuit UUID embedded in unique_id).
  • Update favorites service tests and add 2.0.7 changelog entries.

Reviewed changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
uv.lock Updates pinned dependency versions (HA/stubs/tooling and transitive packages).
pyproject.toml Bumps project version and updates HA/stubs + dev dependency constraints.
custom_components/span_panel/manifest.json Bumps integration version to 2.0.7.
custom_components/span_panel/services.py Changes favorites resolution logic to prefer sub-device favorites for sub-device-attached entities.
tests/test_favorites_service.py Updates expectation for EVSE feed-circuit sensor favorite target (now sub-device).
CHANGELOG.md Adds release notes for 2.0.7.

Comment thread CHANGELOG.md Outdated
Picks up span-card 37e406d which addresses four valid copilot
findings on PR #12:
- Truncation-fold MutationObserver switched to subtree:true with a
  row-touching filter so we re-attach when rows are added under any
  wrapper, not only on full container.innerHTML resets.
- span-menu-button button now has explicit type="button" so it
  cannot trigger a form submission if ever placed inside a <form>.
- Test suites for span-icon and truncation-fold restore their
  console.warn spy and ResizeObserver shim in afterEach so they
  don't leak across test files.

245 tests pass; bundle unchanged.
Picks up span-card ea964b1 which narrows the By Panel tab-label
gutters from 28px to 14px and removes the column-gap between each
gutter and its cell. Reclaims ~22px per cell on narrow viewports
so the relay toggle and gear icon fit in the folded cell layout.
Picks up span-card 5a7ac64 — folded layout in 240V double-pole
breaker cells now keeps the controls row at content height and
lets the chart absorb the extra cell height instead of stretching
the badge and relay toggle.
Picks up span-card 83adfc8 — .breaker-badge padding reduced 7px to
3px on left/right, and the .is-folded controls row's 1fr slack
column moved from between the shedding icon and the relay toggle
to between the relay toggle and the power reading. Reclaims ~8px
per cell on narrow displays and removes the wasted-looking gap
that the slack-position created on wider cells.
Picks up span-card 9c09081 — truncation-fold preserves uniform fold
when rows are added/removed under a folded grid, and small test +
comment grammar cleanups.
Picks up span-card 42ccda3 — orange .circuit-custom-monitoring border
and orange gear-icon tint removed from the breaker grid and list
rows. The hasCustomOverrides() helper was firing on circuits that
have no actual overrides set (the integration sends the threshold
field for every circuit), and the user does not want the visual at
all even when correct.
Picks up span-card 4491c9c — guards the customElements.define for
span-error-banner to prevent the cross-bundle collision that left
<span-panel> un-upgraded (blank sidebar view) when the Lovelace
card bundle was loaded into the page before the panel bundle.
Picks up span-card 783a8ff — removes _recoverIfNeeded retry,
_onVisibilityChange handlers, and the location.reload() module
listener. All were defending against symptoms of the root cause
fixed in efd1fb0 / span-card 4491c9c (span-error-banner cross-bundle
registration collision). Dead code; both bundles shrink slightly.
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