Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 28 additions & 38 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,46 @@ All notable changes to this project will be documented in this file.

## [2.3.4] - 11/2026

### Fixed

- **The SPAN Panel card and the sidebar dashboard now show a panel and each of its battery, charger and solar devices by the name you gave it in Home
Assistant**, where a renamed device kept the name the integration gave it.

- **A SPAN Panel card opened while Home Assistant is starting or restarting, or while the integration retries a panel it cannot reach, says it is waiting for
the panel to load and draws the panel once it has loaded**, where it showed "Unable to connect to SPAN Panel" until Retry was pressed or the dashboard was
opened again.
This release is a dashboard focused release.

- **The sidebar dashboard, opened while Home Assistant is starting or restarting or while the integration retries a panel it cannot reach, says it is waiting
for the panel to load and draws the panel once it has loaded**, where it showed errors, monitoring as off or missing favorites meanwhile, and could miss the
panel's unreachable warning.

- **A SPAN Panel card or the sidebar dashboard whose panel failed to set up, as when it must be authenticated again, cannot load until Home Assistant is
restarted, or is disabled, says so and how to set it right, and draws the panel once it has loaded**, where the card showed "Unable to connect to SPAN Panel"
and the sidebar "SPAN Panel integration is not loaded", monitoring as off or no favorites.
### Fixed

- **A SPAN Panel card left on a dashboard after its panel was removed says it is unable to connect**, where it drew an empty card.
- **A panel, circuit or device you rename in Home Assistant now shows its new name on the SPAN Panel card and in the sidebar dashboard.** Before, they kept
showing its original name.

- **The card and the sidebar dashboard show a panel's monitoring again once a reload of the panel, as after its options are changed, finishes**, where a view
drawn or a circuit's side panel opened during the reload could show monitoring as off until opened again.
- **While Home Assistant is starting, or keeps retrying a panel it can't reach, the SPAN Panel card and the sidebar dashboard say they're waiting for the panel
and show it as soon as it's ready.** Before, the card said "Unable to connect to SPAN Panel" until you pressed Retry, and the sidebar showed errors,
monitoring as off, or no favorites.

- **The sidebar dashboard says no SPAN Panel is found where there is none**, where it showed "Panel device not found. Check device_id in card config."
- **When a panel can't start because it needs you to sign in again, needs Home Assistant restarted, or is disabled, the card and the sidebar dashboard now say
so and what to do, and show the panel once it starts.** Before, the card said "Unable to connect to SPAN Panel" and the sidebar "SPAN Panel integration is not
loaded".

- **The sidebar dashboard's panel list catches up once the connection to Home Assistant is back**, where a panel added, removed or renamed just as the
connection was lost stayed listed as it was until the next change.
- **A SPAN Panel card left on a dashboard after you remove its panel now says it can't connect, and the sidebar dashboard says when you have no SPAN Panel.**
Before, the card was blank and the sidebar showed "Panel device not found. Check device_id in card config."

- **The Monitoring tab's Event Bus help lists every key of the `span_panel_current_alert` event**, the new `alert_display_name`, the circuit's name as Home
Assistant shows it, among them, where it left out the keys for the monitoring rating, the copied package ratings and when the overload began.
- **After a panel reloads, for example when you change its options, the card and the sidebar dashboard show its monitoring again.** Before, anything opened
during the reload could show monitoring as off until you opened it again.

- **An error from a breaker, circuit priority, charger or adopted-device control now names the circuit or device by the name you gave it in Home Assistant**,
where it kept the name the panel or the integration gave it.
- **The sidebar dashboard's list of panels updates once the connection to Home Assistant comes back.** Before, a panel added, removed or renamed while the
connection was down stayed listed as it was.

- **Current monitoring notifications now name a circuit by the name you gave it in Home Assistant, including through `{name}` in a custom title or message**,
where they used its name in the SPAN app; the `span_panel_current_alert` event carries that name in a new `alert_display_name` field and leaves `alert_name`
as it was.
- **The Monitoring tab's Event Bus help now says what the `span_panel_current_alert` event is for, and links to the full list of its fields.** Before, it showed
a bare list of field names.

- **The Get monitoring status action now fails with an error when the panel it is asked about has not finished loading, such as while Home Assistant starts, or
when the config entry it names is not a SPAN Panel's**, where it answered that monitoring was off, so a script step that calls it then stops unless it is set
to continue on error, and Home Assistant logs the error.
- **Current monitoring notifications, including your own notification text through `{name}`, and the `alert_name` that automations read from the
`span_panel_current_alert` event now use the name you gave a circuit in Home Assistant instead of its SPAN app name.** If an automation compares `alert_name`
to a circuit's name, check it still matches.

- **Changing a panel's current monitoring while the panel is not loaded, or naming a config entry that is not a SPAN Panel's, now fails with an error, turning
monitoring off included**, where turning it off reported success and left monitoring to start again once the panel loaded, and turning it on, changing its
settings or a threshold named by circuit id or leg, or sending a test notification said monitoring was not enabled.
- **`{entity_id}` in your own current monitoring notification text now gives the entity ID of the circuit's current sensor, or its power sensor where it has
none.** Before, it gave an internal circuit id.

- **The `{entity_id}` placeholder in a current monitoring notification's title or message now carries the entity ID of the circuit's Current sensor, or its
Power sensor where it has none, or of the mains leg's Current sensor**, where it carried the circuit's internal id or the leg's name.
- **Current monitoring actions, such as Get monitoring status or turning monitoring off, now fail with a clear error when the panel hasn't finished loading or
the panel named doesn't exist.** Before, Get monitoring status said monitoring was off and turning it off seemed to work but didn't, so check any script that
calls these while Home Assistant starts.

- **Current monitoring turned off now stays off after Home Assistant restarts on a panel whose options still hold the monitoring switch an earlier release
stored there**, where it came back on at every restart.
- **Turning current monitoring off now stays off after Home Assistant restarts.** Before, on panels first set up with an older release, it came back on at every
restart.

## [2.3.3] - 11/2026

Expand Down
34 changes: 13 additions & 21 deletions custom_components/span_panel/alert_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
def format_notification(
*,
alert_type: str,
display_name: str,
alert_name: str,
entity_id: str,
current_a: float,
monitoring_rating_a: float,
Expand All @@ -52,7 +52,7 @@ def format_notification(
) -> tuple[str, str]:
"""Format notification title and message using templates.

`display_name` is the point's name as Home Assistant shows it, which the
`alert_name` is the point's name as Home Assistant shows it, which the
`{name}` placeholder carries, and `entity_id` the entity it is shown under,
which `{entity_id}` carries. `monitoring_rating_a` is the rating the point
was judged against, which the `{breaker_rating_a}` placeholder carries.
Expand Down Expand Up @@ -82,7 +82,7 @@ def format_notification(
"""
window_m = (window_duration_s or 0) // 60
template_vars = {
"name": display_name,
"name": alert_name,
"entity_id": entity_id,
"alert_type": alert_type,
"current_a": f"{current_a:.1f}",
Expand All @@ -95,12 +95,12 @@ def format_notification(
try:
title = title_template.format_map(template_vars)
except (KeyError, ValueError):
title = f"SPAN: {display_name} {alert_type}"
title = f"SPAN: {alert_name} {alert_type}"
try:
message = message_template.format_map(template_vars)
except (KeyError, ValueError):
message = (
f"{display_name} at {current_a:.1f}A "
f"{alert_name} at {current_a:.1f}A "
f"({utilization_pct}% of {monitoring_rating_a:.0f}A rating) at {local_time or ''}"
)
return title, message
Expand Down Expand Up @@ -172,7 +172,6 @@ def dispatch_alert(
*,
alert_type: str,
alert_name: str,
display_name: str,
alert_id: str,
entity_id: str,
alert_source: str,
Expand All @@ -190,14 +189,12 @@ def dispatch_alert(
) -> None:
"""Dispatch alert through all enabled notification channels.

`alert_name` is the panel's name for the point and `display_name` the name
Home Assistant shows for it, the user's where they renamed the circuit's
device. The event carries both, as `alert_name` and `alert_display_name`:
automations read `alert_name`, so a rename in Home Assistant never changes
it. The title and message are read by a person, so their `{name}` is the
name that person finds the circuit under. `alert_id` is the point's id,
which the event carries, and `entity_id` the entity the point is shown
under, which only the text's `{entity_id}` carries.
`alert_name` is the point's name as Home Assistant shows it, the user's
where they renamed the circuit's device: the name a person finds the circuit
under, which the event's `alert_name`, the text's `{name}` and the log line
all carry. `alert_id` is the point's id, which the event carries and a
rename never changes, and `entity_id` the entity the point is shown under,
which only the text's `{entity_id}` carries.

The event payload carries the ratings as `get_monitoring_status` does:
`breaker_rating_a` is the panel's rating (a shared meter's capacity over its
Expand All @@ -219,7 +216,6 @@ def dispatch_alert(
"alert_source": alert_source,
"alert_id": alert_id,
"alert_name": alert_name,
"alert_display_name": display_name,
"alert_type": alert_type,
"current_a": round(current_a, 1),
"breaker_rating_a": breaker_rating_a,
Expand Down Expand Up @@ -248,7 +244,7 @@ def dispatch_alert(

title, message = format_notification(
alert_type=alert_type,
display_name=display_name,
alert_name=alert_name,
entity_id=entity_id,
current_a=current_a,
monitoring_rating_a=monitoring_rating_a,
Expand Down Expand Up @@ -295,9 +291,6 @@ def dispatch_test_alert(
"""Dispatch a test notification using sample values through all enabled channels."""
alert_type = "spike"
alert_name = "Kitchen Oven"
# The sample circuit is one nobody renamed, so Home Assistant shows it by
# the panel's name.
display_name = alert_name
alert_id = "sensor.kitchen_oven_current"
# The sample's id has always been its sensor's entity ID, so the text's
# `{entity_id}` carries the same one.
Expand All @@ -323,7 +316,6 @@ def dispatch_test_alert(
"alert_source": alert_source,
"alert_id": alert_id,
"alert_name": alert_name,
"alert_display_name": display_name,
"alert_type": alert_type,
"current_a": current_a,
"breaker_rating_a": breaker_rating_a,
Expand All @@ -344,7 +336,7 @@ def dispatch_test_alert(

title, message = format_notification(
alert_type=alert_type,
display_name=display_name,
alert_name=alert_name,
entity_id=entity_id,
current_a=current_a,
monitoring_rating_a=monitoring_rating_a,
Expand Down
31 changes: 9 additions & 22 deletions custom_components/span_panel/current_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,8 @@ class MonitoredCircuit:
its first member: that key is stable while the membership is, which is
enough for alerts and overrides, neither of which is an entity.

`name` is the panel's name for the point, each member's label joined with " + ":
the alert event's `alert_name`, which automations read, so a rename in Home
Assistant never changes it. The alert's text names the point as Home
Assistant shows it instead (`CurrentMonitor._display_name`).
A point carries no name: an alert names it as Home Assistant shows it, read
from the device registry when the alert fires (`CurrentMonitor._alert_name`).

`rating_a` is the rating judged against and `panel_rating_a` the breaker rating the
panel published, each None where a circuit, or the capacity of a group, is unknown.
Expand All @@ -204,7 +202,6 @@ class MonitoredCircuit:

point_id: str
members: tuple[str, ...]
name: str
current_a: float | None
rating_a: float | None
panel_rating_a: float | None
Expand All @@ -229,9 +226,6 @@ def monitored_circuits(
point = MonitoredCircuit(
point_id=key,
members=members,
name=" + ".join(
construct_circuit_label(snapshot.circuits[member], member) for member in members
),
current_a=snapshot.circuits[key].current_a,
rating_a=meter_capacity_a((spaces[m], r.judged_a) for m, r in resolved.items()),
panel_rating_a=meter_capacity_a((spaces[m], r.panel_a) for m, r in resolved.items()),
Expand All @@ -248,9 +242,6 @@ def monitored_circuits(
points[circuit_id] = MonitoredCircuit(
point_id=circuit_id,
members=(circuit_id,),
# Its label, as a shared meter's members are named above: the
# panel's name, or its breaker positions, never its wire id.
name=construct_circuit_label(circuit, circuit_id),
current_a=circuit.current_a,
rating_a=rating.judged_a,
panel_rating_a=rating.panel_a,
Expand Down Expand Up @@ -781,8 +772,7 @@ def _evaluate_circuits(self, snapshot: SpanPanelSnapshot) -> None:
self._hass,
self.get_global_settings(),
alert_type=alert.alert_type,
alert_name=point.name,
display_name=self._display_name(point, snapshot),
alert_name=self._alert_name(point, snapshot),
alert_id=circuit_id,
alert_source="circuit",
current_a=alert.current_a,
Expand All @@ -803,8 +793,7 @@ def _evaluate_circuits(self, snapshot: SpanPanelSnapshot) -> None:
self._hass,
self.get_global_settings(),
alert_type=alert.alert_type,
alert_name=point.name,
display_name=self._display_name(point, snapshot),
alert_name=self._alert_name(point, snapshot),
alert_id=circuit_id,
alert_source="circuit",
current_a=alert.current_a,
Expand All @@ -821,11 +810,11 @@ def _evaluate_circuits(self, snapshot: SpanPanelSnapshot) -> None:
entity_id=self._resolve_circuit_entity_id(circuit_id),
)

def _display_name(self, point: MonitoredCircuit, snapshot: SpanPanelSnapshot) -> str:
"""Name a point as Home Assistant shows it, for the text of the alert it raises.
def _alert_name(self, point: MonitoredCircuit, snapshot: SpanPanelSnapshot) -> str:
"""Name a point as Home Assistant shows it, for the alert it raises.

Each member's device as Home Assistant shows it (`util.circuit_display_name`),
joined as `MonitoredCircuit.name` joins the panel's names. Asked when an
those of circuits that share a meter joined with " + ". Asked when an
alert fires rather than held, so a device renamed since setup is named
by its new name in the next alert.
"""
Expand Down Expand Up @@ -864,8 +853,8 @@ def _evaluate_mains(self, snapshot: SpanPanelSnapshot) -> None:
self._mains_overrides.get(leg, {}), self.get_global_settings()
)

# The mains has no device of its own, so its text and its event both
# name the leg by its own name.
# The mains has no device of its own, so its alert names the leg by
# its own name.
leg_name = f"Mains {leg.replace('_', ' ').title()}"

alert = check_spike(state, current, rating, spike_pct, cooldown_m)
Expand All @@ -875,7 +864,6 @@ def _evaluate_mains(self, snapshot: SpanPanelSnapshot) -> None:
self.get_global_settings(),
alert_type=alert.alert_type,
alert_name=leg_name,
display_name=leg_name,
alert_id=leg,
alert_source="mains",
current_a=alert.current_a,
Expand All @@ -898,7 +886,6 @@ def _evaluate_mains(self, snapshot: SpanPanelSnapshot) -> None:
self.get_global_settings(),
alert_type=alert.alert_type,
alert_name=leg_name,
display_name=leg_name,
alert_id=leg,
alert_source="mains",
current_a=alert.current_a,
Expand Down
4 changes: 2 additions & 2 deletions custom_components/span_panel/frontend/dist/span-panel-card.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions custom_components/span_panel/frontend/dist/span-panel.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion custom_components/span_panel/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"span-panel-api-schema-1==1.5.0",
"span-panel-api==3.9.1"
],
"version": "2.3.4b2",
"version": "2.3.4b3",
"zeroconf": [
{
"type": "_span._tcp.local."
Expand Down
8 changes: 6 additions & 2 deletions custom_components/span_panel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,12 +607,16 @@ def circuit_display_name(
*,
config_entry_id: str,
) -> str:
"""Return a circuit's name as Home Assistant shows it, for text that names the circuit to a person.
"""Return a circuit's name as Home Assistant shows it, wherever the integration names the circuit.

A current alert's name is this one, in its text, the `alert_name` of its
event and its log line, so a person and an automation find the circuit
under the name Home Assistant shows.

Its own device's name (`device_display_name`): the user's where they renamed
the device, else the name it is registered under. Read from the registry
each time it is asked, so a rename made since setup is the name the next
message carries. Unlike `effective_circuit_device_name`, a registered
alert carries. Unlike `effective_circuit_device_name`, a registered
device's `name` is read rather than the one it is about to be given:
between a rename on the panel and the reload that renames the device, Home
Assistant still shows the old one.
Expand Down
Loading