Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions assets/js/components/Energyflow/Energyflow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
data-testid="energyflow"
@click="toggleDetails"
>
<div class="row">
<div class="visualization-wrapper">
<Visualization
class="col-12 mb-3 mb-md-4"
class="mb-3 mb-md-4"
:gridImport="gridImport"
:selfPv="selfPv"
:selfBattery="selfBattery"
Expand All @@ -16,7 +16,7 @@
:batteryCharge="batteryCharge"
:batteryDischarge="batteryDischarge"
:batteryGridCharge="batteryGridChargeActive"
:batteryHold="batteryHold"
:batteryHold="!showBatteryState && batteryHold"
:pvProduction="pvProduction"
:homePower="homePower"
:batterySoc="batterySoc"
Expand All @@ -25,6 +25,10 @@
:inPower="inPower"
:outPower="outPower"
/>
<div v-if="showBatteryState" class="battery-state-display">
<BatteryIcon :soc="batterySoc" :hold="batteryHold" class="battery-icon" />
<div class="battery-soc-value">{{ batterySocFmt(batterySoc) }}</div>
</div>
</div>
<div
class="details"
Expand Down Expand Up @@ -296,13 +300,15 @@
import "@h2d2/shopicons/es/filled/square";
import Modal from "bootstrap/js/dist/modal";
import Visualization from "./Visualization.vue";
import BatteryIcon from "./BatteryIcon.vue";
import Entry from "./Entry.vue";
import formatter, { POWER_UNIT } from "@/mixins/formatter";
import AnimatedNumber from "../Helper/AnimatedNumber.vue";
import settings from "@/settings";
import collector from "@/mixins/collector.js";
import { defineComponent, type PropType } from "vue";
import {
ICON_SIZE,
SMART_COST_TYPE,
type BatteryMeter,
type Meter,
Expand All @@ -315,6 +321,7 @@ export default defineComponent({
name: "Energyflow",
components: {
Visualization,
BatteryIcon,
EnergyflowEntry: Entry,
AnimatedNumber,
},
Expand Down Expand Up @@ -352,7 +359,12 @@ export default defineComponent({
forecast: { type: Object as PropType<Forecast>, default: () => ({}) },
},
data: () => {
return { detailsOpen: false, detailsCompleteHeight: null as number | null, ready: false };
return {
detailsOpen: false,
detailsCompleteHeight: null as number | null,
ready: false,
ICON_SIZE,
};
},
computed: {
gridImport() {
Expand Down Expand Up @@ -427,6 +439,9 @@ export default defineComponent({
batteryFmt() {
return (soc: number) => this.fmtPercentage(soc, 0);
},
batterySocFmt() {
return (soc: number) => Math.round(soc).toString();
},
fmtLoadpointSoc() {
return (soc: number) => this.fmtPercentage(soc, 0);
},
Expand Down Expand Up @@ -498,6 +513,9 @@ export default defineComponent({
count: this.activeLoadpointsCount,
});
},
showBatteryState() {
return this.batteryConfigured;
},
consumers() {
return [...this.aux, ...this.ext];
},
Expand Down Expand Up @@ -659,4 +677,22 @@ export default defineComponent({
.legend-battery--mixed {
clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.visualization-wrapper {
position: relative;
}
.battery-state-display {
position: absolute;
top: 2.2rem;
right: -0.35rem;
display: flex;
flex-direction: column;
align-items: center;
color: var(--evcc-gray);
}
.battery-soc-value {
font-size: 0.75rem;
font-weight: 400;
line-height: 0.9;
white-space: nowrap;
}
</style>
5 changes: 5 additions & 0 deletions i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,11 @@
"vehicle": "Fahrzeug"
},
"settings": {
"batteryState": {
"label": "Batteriezustand",
"shortLabel": "Batterie",
"value": "Batteriezustand neben der Energiefluss-Visualisierung anzeigen."
},
"deviceInfo": "Einstellungen, die du in diesem Dialog vornimmst, gelten nur für dieses Gerät.",
"fullscreen": {
"enter": "Vollbild starten",
Expand Down
5 changes: 5 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,11 @@
"vehicle": "Vehicle"
},
"settings": {
"batteryState": {
"label": "Battery State",
"shortLabel": "Battery",
"value": "Show battery state next to energy flow visualization."
},
"deviceInfo": "Settings you make in this dialog only affect this device.",
"fullscreen": {
"enter": "Enter fullscreen",
Expand Down
Loading