From 01252c619388bd9e8d29cc481f70abb1d9d9e5a2 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 10 Dec 2024 08:36:32 -0800 Subject: [PATCH] Fix: correct evcc units (#4396) --- public/locales/en/common.json | 2 +- src/widgets/evcc/component.jsx | 21 ++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 484f76b5c..e3670e806 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -120,7 +120,7 @@ "grid_power": "Grid", "home_power": "Consumption", "charge_power": "Charger", - "watt_hour": "Wh" + "kilowatt": "kW" }, "flood": { "download": "Download", diff --git a/src/widgets/evcc/component.jsx b/src/widgets/evcc/component.jsx index 9f5d4c4d5..09a8ffe4f 100644 --- a/src/widgets/evcc/component.jsx +++ b/src/widgets/evcc/component.jsx @@ -4,6 +4,10 @@ import Container from "components/services/widget/container"; import Block from "components/services/widget/block"; import useWidgetAPI from "utils/proxy/use-widget-api"; +function toKilowatts(t, value) { + return value > 0 ? t("common.number", { value: value / 1000, maximumFractionDigits: 1 }) : 0; +} + export default function Component({ service }) { const { t } = useTranslation(); @@ -27,21 +31,12 @@ export default function Component({ service }) { return ( - - - + + + );