mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-07 14:18:47 +00:00
Fix: correct evcc units (#4396)
This commit is contained in:
parent
27f536c267
commit
01252c6193
2 changed files with 9 additions and 14 deletions
|
@ -120,7 +120,7 @@
|
||||||
"grid_power": "Grid",
|
"grid_power": "Grid",
|
||||||
"home_power": "Consumption",
|
"home_power": "Consumption",
|
||||||
"charge_power": "Charger",
|
"charge_power": "Charger",
|
||||||
"watt_hour": "Wh"
|
"kilowatt": "kW"
|
||||||
},
|
},
|
||||||
"flood": {
|
"flood": {
|
||||||
"download": "Download",
|
"download": "Download",
|
||||||
|
|
|
@ -4,6 +4,10 @@ import Container from "components/services/widget/container";
|
||||||
import Block from "components/services/widget/block";
|
import Block from "components/services/widget/block";
|
||||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
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 }) {
|
export default function Component({ service }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
@ -27,21 +31,12 @@ export default function Component({ service }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<Block
|
<Block label="evcc.pv_power" value={`${toKilowatts(t, stateData.result.pvPower)} ${t("evcc.kilowatt")}`} />
|
||||||
label="evcc.pv_power"
|
<Block label="evcc.grid_power" value={`${toKilowatts(t, stateData.result.gridPower)} ${t("evcc.kilowatt")}`} />
|
||||||
value={`${t("common.number", { value: stateData.result.pvPower })} ${t("evcc.watt_hour")}`}
|
<Block label="evcc.home_power" value={`${toKilowatts(t, stateData.result.homePower)} ${t("evcc.kilowatt")}`} />
|
||||||
/>
|
|
||||||
<Block
|
|
||||||
label="evcc.grid_power"
|
|
||||||
value={`${t("common.number", { value: stateData.result.gridPower })} ${t("evcc.watt_hour")}`}
|
|
||||||
/>
|
|
||||||
<Block
|
|
||||||
label="evcc.home_power"
|
|
||||||
value={`${t("common.number", { value: stateData.result.homePower })} ${t("evcc.watt_hour")}`}
|
|
||||||
/>
|
|
||||||
<Block
|
<Block
|
||||||
label="evcc.charge_power"
|
label="evcc.charge_power"
|
||||||
value={`${t("common.number", { value: stateData.result.loadpoints[0].chargePower })} ${t("evcc.watt_hour")}`}
|
value={`${toKilowatts(t, stateData.result.loadpoints[0].chargePower)} ${t("evcc.kilowatt")}`}
|
||||||
/>
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue