Skip to content

feat(now): draw Overview under the house from the box snapshot - #53

Merged
frahlg merged 2 commits into
mainfrom
now-hero-from-status
Aug 20, 2026
Merged

feat(now): draw Overview under the house from the box snapshot#53
frahlg merged 2 commits into
mainfrom
now-hero-from-status

Conversation

@frahlg

@frahlg frahlg commented Aug 20, 2026

Copy link
Copy Markdown
Member

The LAN Overview already looked finished. This app used the same energy-flow component and fed it five frozen numbers, then stopped.

What changed

Hero. GET /api/status is the document the box page draws from. Now polls it while the glance is on screen and builds the same planet list: one bubble per live driver, kWh today on each corner, self-powered share. Frozen fields stay the fallback when the session has no passthrough. A faulted charger still has a planet, which is why LAN always looked right.

Under the house. The rest of that glance, loaded after the first frame:

  • compact price chart (fed, so it never hits this origin)
  • what FTW does next, with a link to Plan
  • today: imported, exported, solar, saved
  • fuse, per phase when the meter reports amps

Tap "Full view" on the compact price chart opens Plan. Open history goes to History.

Why not the whole LAN page

Settings, driver editor and diagnose stay on the box. This app is the glance. The cards reuse the box APIs the passthrough already prices as reads.

Test

  • npm test — 902 passed
  • npm run check — clean
  • Entry bundle still excludes the Overview cards and the price chart

The LAN page already fed <ftw-energy-flow> from GET /api/status: per-driver
planets, kWh today, self-powered. Now does the same, then the rest of that
glance — compact price, the next plan step, today's totals, savings, fuse.

Frozen fields stay the fallback. The new cards load after the first frame.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ftw-webapp 84b30dc Commit Preview URL

Branch Preview URL
Aug 20 2026, 06:03 PM

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95042c34d6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/views/NowOutlook.svelte Outdated
Comment on lines +487 to +489
.fill.warn { background: var(--energy-generation); }
.fill.crit { background: var(--energy-import); }
.fill.is-out { background: var(--energy-storage); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep fuse warning colors above export styling

When an exporting phase reaches the 70% or 90% threshold, the fill receives both warn/crit and is-out. Because .fill.is-out has equal specificity and is declared last, its storage color overrides both warning colors, so a critically loaded exporting fuse appears normal instead of red. Give the threshold styles precedence over the direction style.

Useful? React with 👍 / 👎.

Comment thread src/lib/state/flow.ts Outdated
const soc = num(d.bat_soc)
planets.push({
id: `bat-${name}`, corner: 'top-right', title: 'BATTERY', role: 'battery', name,
kw: Math.abs(batW) / 1000, toHub: batW < 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve battery direction during aggregation

On sites with multiple batteries, the component defaults to its combined view and sums each planet's kw, then derives the combined battery label from that sum (src/vendor/ftw/ftw-energy-flow.js:1630-1638). Converting every bat_w to an absolute value here means two discharging batteries are summed as a positive value and labeled “charging”; mixed charging/discharging batteries are also added rather than netted. Preserve direction through the aggregation path while keeping individual display values unsigned if desired.

Useful? React with 👍 / 👎.

Comment thread src/views/NowOutlook.svelte Outdated
Comment on lines +250 to +252
class:is-export={savings.today.savedMinor >= 0}
class:is-import={savings.today.savedMinor < 0}
>{formatCompactMinor(savings.today.savedMinor)}</strong>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Respect unavailable savings for today

When today's savings row has resolution: 'no_prices' but any earlier day in the week is priced, loadSavings retains the periods because week.available is true, while summarize sets today's amount to zero and today.available to false. Rendering the amount unconditionally therefore tells the user they saved +0.00 today even though the box could not calculate today's savings; gate or label the daily figure using savings.today.available.

Useful? React with 👍 / 👎.

Codex review on #53: an exporting phase on the fuse overrode warn/crit
colours; two discharging packs summed as a charge; a day without prices
printed as +0.00 saved.
@frahlg
frahlg merged commit 956b3b5 into main Aug 20, 2026
3 checks passed
@frahlg
frahlg deleted the now-hero-from-status branch August 20, 2026 18:04
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.

1 participant