From 587d70e21c861ade932d47bf2b104426e057f724 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 10 Dec 2024 08:29:25 -0800 Subject: [PATCH] Fix: correct evcc units --- docs/widgets/services/evcc.md | 2 +- public/locales/en/common.json | 2 +- src/widgets/evcc/component.jsx | 22 +++++++++------------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/docs/widgets/services/evcc.md b/docs/widgets/services/evcc.md index 108b6eb4..1d3af2ba 100644 --- a/docs/widgets/services/evcc.md +++ b/docs/widgets/services/evcc.md @@ -3,7 +3,7 @@ title: EVCC description: EVCC Widget Configuration --- -Learn more about [EVSS](https://github.com/evcc-io/evcc). +Learn more about [EVCC](https://github.com/evcc-io/evcc). Allowed fields: `["pv_power", "grid_power", "home_power", "charge_power]`. diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 484f76b5..e3670e80 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 9f5d4c4d..03afcd83 100644 --- a/src/widgets/evcc/component.jsx +++ b/src/widgets/evcc/component.jsx @@ -4,6 +4,11 @@ import Container from "components/services/widget/container"; import Block from "components/services/widget/block"; import useWidgetAPI from "utils/proxy/use-widget-api"; +function toKilowatts(value) { + const { t } = useTranslation(); + return value > 0 ? t("common.number", { value: value / 1000, maximumFractionDigits: 1 }) : 0; +} + export default function Component({ service }) { const { t } = useTranslation(); @@ -27,21 +32,12 @@ export default function Component({ service }) { return ( - - - + + + );