diff --git a/backend/app/api/routes/archives.py b/backend/app/api/routes/archives.py index 5ed61ed85..47fe87a6b 100644 --- a/backend/app/api/routes/archives.py +++ b/backend/app/api/routes/archives.py @@ -570,7 +570,7 @@ async def get_archive_stats( total_energy_kwh += mqtt_data.energy total_energy_kwh = round(total_energy_kwh, 3) - total_energy_cost = round(total_energy_kwh * energy_cost_per_kwh, 2) + total_energy_cost = round(total_energy_kwh * energy_cost_per_kwh, 3) else: # Print mode: sum up per-print energy from archives energy_kwh_result = await db.execute(select(func.sum(PrintArchive.energy_kwh))) @@ -591,7 +591,7 @@ async def get_archive_stats( average_time_accuracy=average_accuracy, time_accuracy_by_printer=accuracy_by_printer if accuracy_by_printer else None, total_energy_kwh=round(total_energy_kwh, 3), - total_energy_cost=round(total_energy_cost, 2), + total_energy_cost=round(total_energy_cost, 3), ) diff --git a/backend/app/api/routes/projects.py b/backend/app/api/routes/projects.py index 4e9eb588f..bf31f2d87 100644 --- a/backend/app/api/routes/projects.py +++ b/backend/app/api/routes/projects.py @@ -144,7 +144,7 @@ async def compute_project_stats( parts_progress_percent=parts_progress_percent, estimated_cost=round((sums.total_filament_cost or 0), 2), total_energy_kwh=round((sums.total_energy or 0), 3), - total_energy_cost=round((sums.total_energy_cost or 0), 2), + total_energy_cost=round((sums.total_energy_cost or 0), 3), remaining_prints=remaining_prints, remaining_parts=remaining_parts, bom_total_items=bom_stats.total or 0, diff --git a/backend/app/main.py b/backend/app/main.py index 05c24d367..d948f92c8 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -2447,7 +2447,7 @@ async def on_print_complete(printer_id: int, data: dict): energy_cost_per_kwh = await get_setting(db, "energy_cost_per_kwh") cost_per_kwh = float(energy_cost_per_kwh) if energy_cost_per_kwh else 0.15 - energy_cost = round(energy_used * cost_per_kwh, 2) + energy_cost = round(energy_used * cost_per_kwh, 3) from backend.app.models.archive import PrintArchive diff --git a/frontend/src/components/SmartPlugCard.tsx b/frontend/src/components/SmartPlugCard.tsx index 29c19f3f2..afe07c786 100644 --- a/frontend/src/components/SmartPlugCard.tsx +++ b/frontend/src/components/SmartPlugCard.tsx @@ -265,7 +265,7 @@ export function SmartPlugCard({ plug, onEdit }: SmartPlugCardProps) { )} {status.energy.today !== null && status.energy.today !== undefined && (
-

{status.energy.today.toFixed(2)}

+

{status.energy.today.toFixed(3)}

kWh Today

)} diff --git a/frontend/src/pages/ProjectDetailPage.tsx b/frontend/src/pages/ProjectDetailPage.tsx index 38b3e2aba..f9e1f9b47 100644 --- a/frontend/src/pages/ProjectDetailPage.tsx +++ b/frontend/src/pages/ProjectDetailPage.tsx @@ -640,7 +640,7 @@ export function ProjectDetailPage() {

{t('projectDetail.cost.energy')}

- {stats.total_energy_kwh.toFixed(2)} kWh + {stats.total_energy_kwh.toFixed(3)} kWh {stats.total_energy_cost > 0 && ( ({currency}{stats.total_energy_cost.toFixed(2)}) diff --git a/frontend/src/pages/SettingsPage.tsx b/frontend/src/pages/SettingsPage.tsx index b2532e189..13ef799ce 100644 --- a/frontend/src/pages/SettingsPage.tsx +++ b/frontend/src/pages/SettingsPage.tsx @@ -1527,7 +1527,7 @@ export function SettingsPage() { @@ -2580,7 +2580,7 @@ export function SettingsPage() { Today

- {plugEnergySummary.totalToday.toFixed(2)} + {plugEnergySummary.totalToday.toFixed(3)} kWh
{(localSettings?.energy_cost_per_kwh ?? 0) > 0 && ( @@ -2597,7 +2597,7 @@ export function SettingsPage() { Yesterday
- {plugEnergySummary.totalYesterday.toFixed(2)} + {plugEnergySummary.totalYesterday.toFixed(3)} kWh
{(localSettings?.energy_cost_per_kwh ?? 0) > 0 && ( diff --git a/frontend/src/pages/StatsPage.tsx b/frontend/src/pages/StatsPage.tsx index 3d05b56fd..9a88c0fe8 100644 --- a/frontend/src/pages/StatsPage.tsx +++ b/frontend/src/pages/StatsPage.tsx @@ -91,7 +91,7 @@ function QuickStatsWidget({

{t('stats.energyUsed')}

-

{stats?.total_energy_kwh.toFixed(2) || '0.00'} kWh

+

{stats?.total_energy_kwh.toFixed(3) || '0.000'} kWh