diff --git a/assets/js/components/Savings.vue b/assets/js/components/Savings.vue index 014ec37de..8163f6892 100644 --- a/assets/js/components/Savings.vue +++ b/assets/js/components/Savings.vue @@ -212,7 +212,7 @@ export default { components: { Sponsor, SavingsTile, LiveCommunity, TelemetrySettings, CustomSelect }, mixins: [formatter], props: { - stats: { type: Object, default: () => ({}) }, + statistics: { type: Object, default: () => ({}) }, co2Configured: Boolean, sponsor: String, currency: String, @@ -256,7 +256,7 @@ export default { }, avgPriceFormatted() { const value = this.fmtPricePerKWh( - this.currentStats.avgPrice, + this.currentStatistics.avgPrice, this.currency, false, false @@ -264,14 +264,14 @@ export default { const unit = this.pricePerKWhUnit(this.currency); return { value, unit }; }, - currentStats() { - return this.stats[this.period] || {}; + currentStatistics() { + return this.statistics[this.period] || {}; }, totalCharged() { - return this.currentStats.chargedKWh; + return this.currentStatistics.chargedKWh; }, solarPercentage() { - return this.currentStats.solarPercentage; + return this.currentStatistics.solarPercentage; }, solarCharged() { return (this.solarPercentage / 100) * this.totalCharged; @@ -280,10 +280,10 @@ export default { return this.totalCharged - this.solarCharged; }, avgPrice() { - return this.currentStats.avgPrice; + return this.currentStatistics.avgPrice; }, avgCo2() { - return this.currentStats.avgCo2; + return this.currentStatistics.avgCo2; }, priceConfigured() { return this.referenceGrid !== undefined; diff --git a/assets/js/components/Site.vue b/assets/js/components/Site.vue index b1657da54..bb5bac05c 100644 --- a/assets/js/components/Site.vue +++ b/assets/js/components/Site.vue @@ -80,7 +80,7 @@ export default { auth: Object, currency: String, - stats: Object, + statistics: Object, tariffFeedIn: Number, tariffGrid: Number, tariffCo2: Number, @@ -136,7 +136,7 @@ export default { }, sponsor: this.sponsor, savings: { - stats: this.stats, + statistics: this.statistics, co2Configured: this.tariffCo2 !== undefined, priceConfigured: this.tariffGrid !== undefined, currency: this.currency, diff --git a/core/stats.go b/core/stats.go index 1c77ab2f7..6f356b161 100644 --- a/core/stats.go +++ b/core/stats.go @@ -30,12 +30,12 @@ func (s *Stats) Update(p publisher) { return } - var stats = map[string]map[string]float64{ + stats := map[string]map[string]float64{ "30d": s.calculate(30), "365d": s.calculate(365), "total": s.calculate(365 * 100), // 100 years } - p.publish("stats", stats) + p.publish("statistics", stats) s.updated = time.Now() } diff --git a/server/mqtt.go b/server/mqtt.go index 0b7b92d8c..ab8d21ca6 100644 --- a/server/mqtt.go +++ b/server/mqtt.go @@ -19,6 +19,7 @@ var deprecatedTopics = []string{ "activePhases", "range", "socCharge", "vehicleSoC", "batterySoC", "bufferSoC", "minSoC", "prioritySoC", "targetSoC", "vehicleTargetSoC", "savingsAmount", "savingsEffectivePrice", "savingsGridCharged", "savingsSelfConsumptionCharged", "savingsSelfConsumptionPercent", "savingsTotalCharged", + "stats/30d", "stats/365d", "stats/total", } // MQTT is the MQTT server. It uses the MQTT client for publishing. diff --git a/tests/stats.evcc.yaml b/tests/statistics.evcc.yaml similarity index 100% rename from tests/stats.evcc.yaml rename to tests/statistics.evcc.yaml diff --git a/tests/stats.spec.js b/tests/statistics.spec.js similarity index 96% rename from tests/stats.spec.js rename to tests/statistics.spec.js index 6c16beb49..9b555033c 100644 --- a/tests/stats.spec.js +++ b/tests/statistics.spec.js @@ -2,7 +2,7 @@ const { test, expect } = require("@playwright/test"); const { start, stop } = require("./evcc"); test.beforeAll(async () => { - await start("stats.evcc.yaml", "stats.sql"); + await start("statistics.evcc.yaml", "statistics.sql"); }); test.afterAll(async () => { await stop(); @@ -32,7 +32,7 @@ test.describe("footer", async () => { }); }); -test.describe.skip("stats values", async () => { +test.describe.skip("statistics values", async () => { test("last 30 days", async ({ page }) => { await page.goto("/"); await page.getByTestId("savings-button").click(); diff --git a/tests/stats.sql b/tests/statistics.sql similarity index 100% rename from tests/stats.sql rename to tests/statistics.sql