diff --git a/assets/js/components/Energyflow/Energyflow.vue b/assets/js/components/Energyflow/Energyflow.vue
index 9e81b2a7c..ba26b8b9d 100644
--- a/assets/js/components/Energyflow/Energyflow.vue
+++ b/assets/js/components/Energyflow/Energyflow.vue
@@ -396,7 +396,12 @@ export default {
return !!this.forecast?.solar;
},
solarForecastRemainingToday() {
- return this.forecast?.solar?.today?.energy || undefined;
+ if (!this.forecast?.solar) {
+ return undefined;
+ }
+ const { today, scale } = this.forecast.solar || {};
+ const factor = this.$hiddenFeatures() && settings.solarAdjusted && scale ? scale : 1;
+ return today.energy * factor;
},
solarForecastIcon() {
return this.solarForecastExists ? "forecast" : undefined;
diff --git a/assets/js/components/Forecast/ForecastModal.vue b/assets/js/components/Forecast/ForecastModal.vue
index 668945588..7246088b7 100644
--- a/assets/js/components/Forecast/ForecastModal.vue
+++ b/assets/js/components/Forecast/ForecastModal.vue
@@ -40,7 +40,7 @@
/>
🧪 {{ solarAdjustText }}
@@ -104,6 +104,17 @@ export default defineComponent({
? adjustedSolar(this.forecast.solar)
: this.forecast.solar;
},
+ solarAdjustText() {
+ let percent = "";
+
+ const scale = this.forecast.solar?.scale;
+ if (scale) {
+ const percentDiff = scale * 100 - 100;
+ percent = ` (${this.fmtPercentage(percentDiff, 0, true)})`;
+ }
+
+ return this.$t("forecast.solarAdjust", { percent });
+ },
},
watch: {
isModalVisible: function (newVal) {
diff --git a/assets/js/mixins/formatter.js b/assets/js/mixins/formatter.js
index 0153a154b..846b9d08b 100644
--- a/assets/js/mixins/formatter.js
+++ b/assets/js/mixins/formatter.js
@@ -341,12 +341,13 @@ export default {
}
return result;
},
- fmtPercentage: function (value, digits = 0) {
- return new Intl.NumberFormat(this.$i18n?.locale, {
+ fmtPercentage: function (value, digits = 0, forceSign = false) {
+ const sign = forceSign && value > 0 ? "+" : "";
+ return `${sign}${new Intl.NumberFormat(this.$i18n?.locale, {
style: "percent",
minimumFractionDigits: digits,
maximumFractionDigits: digits,
- }).format(value / 100);
+ }).format(value / 100)}`;
},
hasLeadingPercentageSign: function () {
return ["tr", "ar"].includes(this.$i18n?.locale);
diff --git a/assets/js/mixins/formatter.test.js b/assets/js/mixins/formatter.test.js
index 5403d62a0..67f799bfe 100644
--- a/assets/js/mixins/formatter.test.js
+++ b/assets/js/mixins/formatter.test.js
@@ -169,3 +169,17 @@ describe("getShortenedWeekdaysLabel", () => {
expect(fmt.getShortenedWeekdaysLabel([0, 2, 3, 5, 6])).eq("Di, Mi, Fr – So");
});
});
+
+describe("fmtPercentage", () => {
+ test("should format percentage", () => {
+ expect(fmt.fmtPercentage(0)).eq("0 %");
+ expect(fmt.fmtPercentage(100)).eq("100 %");
+ expect(fmt.fmtPercentage(100, 1)).eq("100,0 %");
+ });
+ test("should force signed", () => {
+ expect(fmt.fmtPercentage(100, 0, true)).eq("+100 %");
+ expect(fmt.fmtPercentage(100, 0, false)).eq("100 %");
+ expect(fmt.fmtPercentage(-100, 0, true)).eq("-100 %");
+ expect(fmt.fmtPercentage(-100, 0, false)).eq("-100 %");
+ });
+});
diff --git a/i18n/de.toml b/i18n/de.toml
index b332f1ab7..c68771cdd 100644
--- a/i18n/de.toml
+++ b/i18n/de.toml
@@ -438,7 +438,7 @@ modalUpdateStatusStart = "Installation gestartet:"
[forecast]
modalTitle = "Vorhersage"
-solarAdjust = "Solarprognose anhand der realen Produktionsdaten anpassen."
+solarAdjust = "Solarprognose anhand der realen Produktionsdaten anpassen{percent}."
[forecast.co2]
average = "Durchschnitt"
diff --git a/i18n/en.toml b/i18n/en.toml
index bc3c1a71f..eae80cab8 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -437,7 +437,7 @@ modalUpdateStatusStart = "Installation started:"
[forecast]
modalTitle = "Forecast"
-solarAdjust = "Adjust solar forecast based on real production data."
+solarAdjust = "Adjust solar forecast based on real production data{percent}."
[forecast.co2]
average = "Average"
diff --git a/i18n/fr.toml b/i18n/fr.toml
index 6bc311019..34d4a88ec 100644
--- a/i18n/fr.toml
+++ b/i18n/fr.toml
@@ -450,7 +450,7 @@ modalUpdateStatusStart = "L'installation a commencé:"
[forecast]
modalTitle = "Prévisions"
-solarAdjust = "Ajuster la prévision solaire basé sur la production réelle."
+solarAdjust = "Ajuster la prévision solaire basé sur la production réelle{percent}."
[forecast.co2]
average = "Moyenne"
diff --git a/i18n/lb.toml b/i18n/lb.toml
index d88cde470..f83ebe052 100644
--- a/i18n/lb.toml
+++ b/i18n/lb.toml
@@ -443,7 +443,7 @@ modalUpdateStatusStart = "Installatioun ugefaang:"
[forecast]
modalTitle = "Prognose"
-solarAdjust = "Solarprognose unhand vun de reale Produktionsdaten upassen."
+solarAdjust = "Solarprognose unhand vun de reale Produktionsdaten upassen{percent}."
[forecast.co2]
average = "Moyenne"
diff --git a/i18n/lt.toml b/i18n/lt.toml
index 5c990aba4..23f07e3c4 100644
--- a/i18n/lt.toml
+++ b/i18n/lt.toml
@@ -450,7 +450,7 @@ modalUpdateStatusStart = "Instaliavimas pradėtas:"
[forecast]
modalTitle = "Prognozė"
-solarAdjust = "Pakoreguoti saulės prognozę remiantis faktiškais gamybos duomenimis."
+solarAdjust = "Pakoreguoti saulės prognozę remiantis faktiškais gamybos duomenimis{percent}."
[forecast.co2]
average = "Vidurkis"
diff --git a/i18n/pt.toml b/i18n/pt.toml
index 341699dcf..aef9825bc 100644
--- a/i18n/pt.toml
+++ b/i18n/pt.toml
@@ -446,7 +446,7 @@ modalUpdateStatusStart = "Instalação iniciada:"
[forecast]
modalTitle = "Previsões"
-solarAdjust = "Ajustar a previsão solar com base em dados reais de produção."
+solarAdjust = "Ajustar a previsão solar com base em dados reais de produção{percent}."
[forecast.co2]
average = "Média"
diff --git a/i18n/sv.toml b/i18n/sv.toml
index e0ac2b006..16d1fce5b 100644
--- a/i18n/sv.toml
+++ b/i18n/sv.toml
@@ -450,7 +450,7 @@ modalUpdateStatusStart = "Installationen har börjat:"
[forecast]
modalTitle = "Prognos"
-solarAdjust = "Justera solprognosen baserat på verkliga produktionsvärden."
+solarAdjust = "Justera solprognosen baserat på verkliga produktionsvärden{percent}."
[forecast.co2]
average = "Genomsnitt"
diff --git a/i18n/tr.toml b/i18n/tr.toml
index 51926df29..a8b73a70f 100644
--- a/i18n/tr.toml
+++ b/i18n/tr.toml
@@ -437,7 +437,7 @@ modalUpdateStatusStart = "Kurulum başladı:"
[forecast]
modalTitle = "“Öngörü”"
-solarAdjust = "Güneş enerjisi tahminlerini gerçek üretim verilerine göre ayarla."
+solarAdjust = "Güneş enerjisi tahminlerini gerçek üretim verilerine göre ayarla{percent}."
[forecast.co2]
average = "“Ortalama”"
diff --git a/i18n/uk.toml b/i18n/uk.toml
index 2827fd335..7239a57b4 100644
--- a/i18n/uk.toml
+++ b/i18n/uk.toml
@@ -451,7 +451,7 @@ modalUpdateStatusStart = "Встановлення розпочато:"
[forecast]
modalTitle = "Прогноз"
-solarAdjust = "Скоригуйте сонячний прогноз на основі реальних даних виробництва."
+solarAdjust = "Скоригуйте сонячний прогноз на основі реальних даних виробництва{percent}."
[forecast.co2]
average = "Середній"