diff --git a/.changeset/charger-connection-in-flow.md b/.changeset/charger-connection-in-flow.md
new file mode 100644
index 000000000..a25fb0434
--- /dev/null
+++ b/.changeset/charger-connection-in-flow.md
@@ -0,0 +1,5 @@
+---
+"ftw": patch
+---
+
+Show when a car is not connected in the power flow. An attached car with no power reading shows that it is connected and power data is missing. Control feedback preserves these connection states.
diff --git a/web/components/energy-flow-readings.js b/web/components/energy-flow-readings.js
index a251506fc..28cf3e425 100644
--- a/web/components/energy-flow-readings.js
+++ b/web/components/energy-flow-readings.js
@@ -181,17 +181,25 @@ export function flowReadingsFromStatus(status, opts) {
}
}
- const evW = num(d.ev_w);
- if (evW !== null) {
+ const disconnected = d.ev_connected === false;
+ // An explicit disconnect takes precedence over any lingering power reading.
+ const evW = disconnected ? 0 : num(d.ev_w);
+ if (evW !== null || typeof d.ev_connected === "boolean") {
const active = !isIdle(evW, thresholdW);
const planet = {
id: `ev-${name}`, corner: "bottom-right", title: "EV CHARGER", role: "ev", name,
kw: Math.abs(evW) / 1000, toHub: false,
color: planetColor("ev", evW, thresholdW),
- sub: active ? "charging" : "idle",
+ sub: disconnected ? "not connected" : active ? "charging" : "idle",
clickable: true,
};
- if (online) {
+ if (online && evW === null) {
+ live.ev = true;
+ planets.push(placeholderPlanet({
+ id: planet.id, corner: planet.corner, title: planet.title,
+ role: planet.role, name, sub: "connected · no data", clickable: true,
+ }));
+ } else if (online) {
live.ev = true;
planets.push(planet);
} else {
@@ -225,10 +233,21 @@ export function flowReadingsFromStatus(status, opts) {
selfPoweredPctToday = Math.max(0, Math.min(100, (1 - importWh / loadWh) * 100));
}
+ const markedPlanets = withControlMarks(planets, status?.control_feedback, opts?.live !== false);
+ for (const planet of markedPlanets) {
+ const driver = status?.drivers?.[planet.name];
+ if (planet.role !== "ev" || !driverOnline(driver) || opts?.live === false) continue;
+ if (driver?.ev_connected === false) {
+ Object.assign(planet, {placeholder: false, kw: 0, sub: "not connected"});
+ } else if (driver?.ev_connected === true && num(driver.ev_w) === null) {
+ planet.sub = "connected · no data";
+ }
+ }
+
return {
load: loadW === null ? null : loadW / 1000,
loadEstimated: hasEstimate,
- planets: withControlMarks(planets, status?.control_feedback, opts?.live !== false),
+ planets: markedPlanets,
selfPoweredPctToday,
};
}
diff --git a/web/components/ftw-energy-flow.js b/web/components/ftw-energy-flow.js
index c17acf4b0..bcf041275 100644
--- a/web/components/ftw-energy-flow.js
+++ b/web/components/ftw-energy-flow.js
@@ -443,7 +443,10 @@ class FtwEnergyFlow extends FtwElement {
.sv-hub-label { font-size: 11px; }
.sv-hub-sub { font-size: 10px; }
}
+ .sv-ev-status-compact { display: none; }
@media (max-width: 600px) {
+ .sv-ev-status-wide { display: none; }
+ .sv-ev-status-compact { display: inline; }
svg { height: calc(var(--efl-h-factor, 1) * 460px); }
:host([embedded]) .ef-toggle {
bottom: 30px;
@@ -1596,6 +1599,14 @@ function renderCircleNode({ pos, title, nameLabel, value, sub, color, soc,
// stroke/fill in the icon SVG.
const iconSvg = ROLE_ICON[role] || ROLE_ICON.unknown;
const iconScale = r * 0.45 / 10;
+ const splitEVStatus = role === "ev" && sub === "connected · no data";
+ const compactEVStatus = splitEVStatus
+ ? `
+ connected
+ no data
+ `
+ : "";
return `
` : ""}
+ fill="var(--hero-sub-text)" class="sv-node-sub${splitEVStatus ? " sv-ev-status-wide" : ""}">
${escapeXml(sub)}
+ ${compactEVStatus}
${socText}
`;
}
@@ -1703,7 +1715,8 @@ function aggregateGroups(groups) {
} else if (first.role === "pv") {
sub = idle ? "idle" : "generating";
} else if (first.role === "ev") {
- sub = idle ? "idle" : "charging";
+ sub = group.every(p => p.sub === "not connected") ? "not connected"
+ : idle ? "idle" : "charging";
}
// SoC: simple mean across reporters. Real weighting needs per-
// battery capacity, which the component doesn't have here — the
diff --git a/web/energy-flow-readings.test.mjs b/web/energy-flow-readings.test.mjs
index 2977a3f10..1768730b5 100644
--- a/web/energy-flow-readings.test.mjs
+++ b/web/energy-flow-readings.test.mjs
@@ -245,3 +245,35 @@ it("draws Core's estimated Home use as an estimate, not a blank", () => {
assert.equal(result.loadEstimated, true);
assert.equal(flowReadingsFromStatus({load_w: 980, load_quality: "measured"}).loadEstimated, false);
});
+
+it("shows an unplugged charger even without power and preserves connected idle", () => {
+ for (const ev_w of [null, 0, 1000]) {
+ const r = flowReadingsFromStatus({drivers:{easee:{status:"ok",ev_connected:false,ev_w}}});
+ const ev = r.planets.find(p => p.id === "ev-easee");
+ assert.equal(ev.sub, "not connected");
+ assert.equal(ev.kw, 0);
+ }
+ const r = flowReadingsFromStatus({drivers:{easee:{status:"ok",ev_connected:true,ev_w:0}}});
+ assert.equal(r.planets.find(p => p.id === "ev-easee").sub, "idle");
+});
+
+it("keeps a known connected state when charger power is unavailable", () => {
+ const r = flowReadingsFromStatus({drivers:{easee:{status:"ok",ev_connected:true,ev_w:null}}});
+ const ev = r.planets.find(p => p.id === "ev-easee");
+ assert.equal(ev.sub, "connected · no data");
+ assert.equal(ev.placeholder, true);
+});
+
+it("keeps charger connection information when control feedback has no power", () => {
+ const feedback = {driver:"easee",kind:"ev",status:"waiting",severity:"info",readings_fresh:false};
+ const status = {drivers:{easee:{status:"ok",ev_connected:false,ev_w:null}},
+ control_feedback:[{...feedback,reason:"not_connected"}]};
+ const disconnected = flowReadingsFromStatus(status).planets.find(p => p.id === "ev-easee");
+ assert.equal(disconnected.sub, "not connected");
+ assert.equal(disconnected.placeholder, false);
+ status.drivers.easee.ev_connected = true;
+ status.control_feedback[0].reason = "telemetry_stale";
+ const connected = flowReadingsFromStatus(status).planets.find(p => p.id === "ev-easee");
+ assert.equal(connected.sub, "connected · no data");
+ assert.equal(connected.placeholder, true);
+});