Add an electricity estimate to the Costs page

The typical draws in the Inventory, the price of a kWh and the currency set
there give a cost per device and in all, counted in the totals under an
Electricity category when there is a draw, a price and a three-letter currency,
and said plainly (with what is missing) when there is not.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-10 20:59:50 +01:00
1 parent d69962528e
commit f546971000
6 files changed
+351 -9

No files matched your search

+18 -1
View File
@@ -1832,12 +1832,29 @@ export interface CostInput {
export interface CostsReport {
items: CostItem[];
/** What can be read rather than typed: a Hetzner project's estimate. */
automatic: { key: string; source: string; name: string; currency: string; monthly: number; detail: string; link: string; stale: boolean }[];
automatic: { key: string; source: string; name: string; currency: string; monthly: number; detail: string; link: string; stale: boolean; category?: string }[];
/** Per currency; none is converted into another. */
totals: { currency: string; monthly: number; yearly: number; items: number; categories: { category: string; monthly: number }[] }[];
/** What the electricity costs and what it is made of, whether or not it is counted in the totals. */
electricity: Electricity;
categories: string[];
}
/** The electricity estimate: the draws in the Inventory, the price of a kWh and the currency set under Settings → Inventory. */
export interface Electricity {
watts: number;
devices: { id: number; name: string; kind: string; watts: number; monthly: number | null; share: number }[];
withoutDraw: number;
pricePerKwh: number | null;
currencyLabel: string;
currency: string | null;
kwhPerMonth: number | null;
monthly: number | null;
yearly: number | null;
includedInTotals: boolean;
missing: "draw" | "price" | "currency" | null;
}
/** What the homelab cost, month by month for each currency, and what changed. */
export interface CostHistory {
/** From the first month there is anything to say about, to this one. */