Solar Forecast: only publish if exists (#19591)
This commit is contained in:
parent
3af1b90cca
commit
69bfa6d2f6
2 changed files with 24 additions and 18 deletions
|
|
@ -83,12 +83,12 @@
|
|||
icon="sun"
|
||||
:power="pvProduction"
|
||||
:powerTooltip="pvTooltip"
|
||||
:details="solarForecast"
|
||||
:details="solarForecastRemainingToday"
|
||||
:detailsFmt="forecastFmt"
|
||||
:detailsTooltip="forecastTooltip(solarForecast)"
|
||||
:detailsInactive="solarForecast === 0"
|
||||
:detailsIcon="solarForecast !== undefined ? 'forecast' : undefined"
|
||||
:detailsClickable="solarForecast !== undefined"
|
||||
:detailsTooltip="solarForecastTooltip"
|
||||
:detailsInactive="!solarForecastExists"
|
||||
:detailsIcon="solarForecastIcon"
|
||||
:detailsClickable="solarForecastExists"
|
||||
:powerUnit="powerUnit"
|
||||
data-testid="energyflow-entry-production"
|
||||
@details-clicked="openForecastModal"
|
||||
|
|
@ -389,8 +389,20 @@ export default {
|
|||
}
|
||||
return this.fmtPricePerKWh(this.batteryGridChargeLimit, this.currency, true);
|
||||
},
|
||||
solarForecast() {
|
||||
return this.forecast?.solar?.today?.energy || undefined;
|
||||
solarForecastExists() {
|
||||
return !!this.forecast?.solar;
|
||||
},
|
||||
solarForecastRemainingToday() {
|
||||
return this.forecast?.solar?.today?.energy || 0;
|
||||
},
|
||||
solarForecastIcon() {
|
||||
return this.solarForecastExists ? "forecast" : undefined;
|
||||
},
|
||||
solarForecastTooltip() {
|
||||
if (this.solarForecastExists) {
|
||||
return [this.$t("main.energyflow.forecastTooltip")];
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -429,12 +441,6 @@ export default {
|
|||
}
|
||||
return result;
|
||||
},
|
||||
forecastTooltip(value) {
|
||||
if (value !== null) {
|
||||
return [this.$t("main.energyflow.forecastTooltip")];
|
||||
}
|
||||
return [];
|
||||
},
|
||||
detailsValue(price, co2) {
|
||||
if (this.co2Available) {
|
||||
return co2;
|
||||
|
|
|
|||
|
|
@ -99,10 +99,10 @@ func (site *Site) publishTariffs(greenShareHome float64, greenShareLoadpoints fl
|
|||
}
|
||||
|
||||
fc := struct {
|
||||
Co2 api.Rates `json:"co2,omitempty"`
|
||||
FeedIn api.Rates `json:"feedin,omitempty"`
|
||||
Grid api.Rates `json:"grid,omitempty"`
|
||||
Solar solarDetails `json:"solar,omitempty"`
|
||||
Co2 api.Rates `json:"co2,omitempty"`
|
||||
FeedIn api.Rates `json:"feedin,omitempty"`
|
||||
Grid api.Rates `json:"grid,omitempty"`
|
||||
Solar *solarDetails `json:"solar,omitempty"`
|
||||
}{
|
||||
Co2: tariff.Forecast(site.GetTariff(api.TariffUsageCo2)),
|
||||
FeedIn: tariff.Forecast(site.GetTariff(api.TariffUsageFeedIn)),
|
||||
|
|
@ -111,7 +111,7 @@ func (site *Site) publishTariffs(greenShareHome float64, greenShareLoadpoints fl
|
|||
|
||||
// calculate adjusted solar forecast
|
||||
if solar := timestampSeries(tariff.Forecast(site.GetTariff(api.TariffUsageSolar))); len(solar) > 0 {
|
||||
fc.Solar = site.solarDetails(solar)
|
||||
fc.Solar = lo.ToPtr(site.solarDetails(solar))
|
||||
}
|
||||
|
||||
site.publish(keys.Forecast, fc)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue