diff --git a/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/Installation.tsx b/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/Installation.tsx index 32195cb72..d8bae8c68 100644 --- a/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/Installation.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/Installation.tsx @@ -470,6 +470,7 @@ function SodioHomeInstallation(props: singleInstallationProps) { values={values} connected={connected} loading={loading} + batteryClusterNumber={props.current_installation.batteryClusterNumber} > } /> diff --git a/typescript/frontend-marios2/src/content/dashboards/Topology/TopologySodistoreHome.tsx b/typescript/frontend-marios2/src/content/dashboards/Topology/TopologySodistoreHome.tsx index 1f1a0b18f..f01e6d0eb 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Topology/TopologySodistoreHome.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Topology/TopologySodistoreHome.tsx @@ -18,6 +18,7 @@ interface TopologySodistoreHomeProps { values: JSONRecordData; connected: boolean; loading: boolean; + batteryClusterNumber:number; } function TopologySodistoreHome(props: TopologySodistoreHomeProps) { @@ -37,6 +38,24 @@ function TopologySodistoreHome(props: TopologySodistoreHomeProps) { const isMobile = window.innerWidth <= 1490; + const totalBatteryPower: number = Number( + props.values && props.values.InverterRecord + ? Array.from({ length: props.batteryClusterNumber }).reduce( + (sum: number, _, index) => { + const i = index + 1; + + const rawPower = + props.values.InverterRecord[`Battery${i}Power`] as unknown; + + const power = Number(rawPower) || 0; + + return sum + power; + }, + 0 + ) + : 0 + ); + return ( @@ -187,15 +206,12 @@ function TopologySodistoreHome(props: TopologySodistoreHomeProps) { orientation: 'horizontal', data: props.values?.InverterRecord ? { - value: props.values.InverterRecord.Battery1Power, + value: totalBatteryPower, unit: 'W' } : undefined, amount: props.values?.InverterRecord - ? getAmount( - highestConnectionValue, - props.values.InverterRecord.Battery1Power, - ) + ? getAmount(highestConnectionValue, totalBatteryPower) : 0, showValues: showValues }} @@ -232,27 +248,33 @@ function TopologySodistoreHome(props: TopologySodistoreHomeProps) { isFirst={false} /> {/*-------------------------------------------------------------------------------------------------------------------------------------------------------------*/} - { + const i = index + 1; // battery cluster index starting from 1 - connected: true - }} - isLast={true} - isFirst={false} - /> + return ( + + ); + })} )}