From 1f9c45b11c63dbec60f62cd133273cfef5c6eb52 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 3 Aug 2021 15:09:08 -0700 Subject: [PATCH 01/10] Add energy distribution card to arsaboo demo (#9702) * Add energy distribution card to arsaboo demo * Make link dashboard conform --- demo/src/configs/arsaboo/lovelace.ts | 5 +++++ .../lovelace/cards/energy/hui-energy-distribution-card.ts | 2 +- src/panels/lovelace/cards/types.ts | 2 +- src/panels/lovelace/common/generate-lovelace-config.ts | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/demo/src/configs/arsaboo/lovelace.ts b/demo/src/configs/arsaboo/lovelace.ts index 5d3107dfdd..e6195d20f4 100644 --- a/demo/src/configs/arsaboo/lovelace.ts +++ b/demo/src/configs/arsaboo/lovelace.ts @@ -29,6 +29,11 @@ export const demoLovelaceArsaboo: DemoConfig["lovelace"] = (localize) => ({ }, ], }, + { + title: "Energy distribution today", + type: "energy-distribution", + link_dashboard: true, + }, { type: "thermostat", entity: "climate.upstairs", diff --git a/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts b/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts index 6e233c50f7..78b13d914c 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts @@ -402,7 +402,7 @@ class HuiEnergyDistrubutionCard - ${this._config.linkDashboard + ${this._config.link_dashboard ? html`
Date: Tue, 3 Aug 2021 15:14:46 -0700 Subject: [PATCH 02/10] Bumped version to 20210803.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9c988b0d73..b9a780aa48 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="home-assistant-frontend", - version="20210803.1", + version="20210803.2", description="The Home Assistant frontend", url="https://github.com/home-assistant/frontend", author="The Home Assistant Authors", From 5e40dcdc38053359ec0fecfeb118cfc145c25c88 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 4 Aug 2021 00:16:08 +0200 Subject: [PATCH 03/10] Add support for statistics card to demo (#9703) --- demo/src/stubs/history.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/demo/src/stubs/history.ts b/demo/src/stubs/history.ts index f5000a70a3..342b6cc4f0 100644 --- a/demo/src/stubs/history.ts +++ b/demo/src/stubs/history.ts @@ -85,8 +85,8 @@ const generateMeanStatistics = ( statistic_id: id, start: currentDate.toISOString(), mean, - min: mean, - max: mean, + min: mean - Math.random() * maxDiff, + max: mean + Math.random() * maxDiff, last_reset: "1970-01-01T00:00:00+00:00", state: mean, sum: null, @@ -340,11 +340,12 @@ export const mockHistory = (mockHass: MockHomeAssistant) => { return results; } ); + mockHass.mockWS("history/list_statistic_ids", () => []); mockHass.mockWS( "history/statistics_during_period", ({ statistic_ids, start_time, end_time }, hass) => { const start = new Date(start_time); - const end = new Date(end_time); + const end = end_time ? new Date(end_time) : new Date(); const statistics: Record = {}; From 80b330ad7beaad0a7cbaf444e93d962f342fa0f2 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 3 Aug 2021 21:55:15 -0700 Subject: [PATCH 04/10] Specify YARN version on netlify (#9705) --- netlify.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 netlify.toml diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000000..fbd2ea0764 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,2 @@ +[build.environment] + YARN_VERSION = "1.22.11" From 740310800d2d860d814bbb9bc328b6e8f6842e06 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 3 Aug 2021 22:00:13 -0700 Subject: [PATCH 05/10] SET NODE_OPTIONS --- netlify.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/netlify.toml b/netlify.toml index fbd2ea0764..6bd9b585cd 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,2 +1,3 @@ [build.environment] YARN_VERSION = "1.22.11" + NODE_OPTIONS: --max_old_space_size=4096 From 03078cdd4535c982555ce581408156ca04fdf746 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 3 Aug 2021 22:02:38 -0700 Subject: [PATCH 06/10] TOML --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 6bd9b585cd..548eb2f450 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,3 +1,3 @@ [build.environment] YARN_VERSION = "1.22.11" - NODE_OPTIONS: --max_old_space_size=4096 + NODE_OPTIONS = "--max_old_space_size=4096" From 3485296e239f5480333268ce5781ab520ced3b54 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 4 Aug 2021 12:36:15 +0200 Subject: [PATCH 07/10] Fix typo (#9707) --- src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts | 2 +- src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts index 875845f103..f0f68158f6 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts @@ -101,7 +101,7 @@ export class HuiEnergySolarGraphCard ? html`
${isToday(this._start) ? "There is no data to show. It can take up to 2 hours for new data to arrive after you configure your energy dashboard." - : "There is not data for this period."} + : "There is no data for this period."}
` : ""}
diff --git a/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts index 7452d36d2d..8f0fe2e6dd 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts @@ -88,7 +88,7 @@ export class HuiEnergyUsageGraphCard ? html`
${isToday(this._start) ? "There is no data to show. It can take up to 2 hours for new data to arrive after you configure your energy dashboard." - : "There is not data for this period."} + : "There is no data for this period."}
` : ""} From 028b799d2c01b76965e28c943b9c00491a0a6686 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 4 Aug 2021 17:25:42 +0200 Subject: [PATCH 08/10] Default energy collection key should not be defined (#9710) --- src/data/energy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/energy.ts b/src/data/energy.ts index 40a0249959..a35dded6d1 100644 --- a/src/data/energy.ts +++ b/src/data/energy.ts @@ -12,7 +12,7 @@ import { ConfigEntry, getConfigEntries } from "./config_entries"; import { subscribeEntityRegistry } from "./entity_registry"; import { fetchStatistics, Statistics } from "./history"; -const energyCollectionKeys: string[] = []; +const energyCollectionKeys: (string | undefined)[] = []; export const emptyFlowFromGridSourceEnergyPreference = (): FlowFromGridSourceEnergyPreference => ({ @@ -278,7 +278,7 @@ export const getEnergyDataCollection = ( return (hass.connection as any)[key]; } - energyCollectionKeys.push(options.key || "energy"); + energyCollectionKeys.push(options.key); const collection = getCollection( hass.connection, From 7fcea16c6bf1fc8fb611bfa62a014b0e9e244d04 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 4 Aug 2021 18:19:38 +0200 Subject: [PATCH 09/10] Increase font size tooltips + position then static (#9713) --- .../hui-energy-carbon-consumed-gauge-card.ts | 12 +++++++++--- .../hui-energy-grid-neutrality-gauge-card.ts | 18 ++++++++++++------ .../hui-energy-solar-consumed-gauge-card.ts | 19 +++++++++++++------ 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts index 2752e867dc..bd8e13afce 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts @@ -126,8 +126,10 @@ class HuiEnergyCarbonGaugeCard - This card represents how much of the energy consumed by your home was - generated using non-fossil fuels like solar, wind and nuclear. + + This card represents how much of the energy consumed by your home + was generated using non-fossil fuels like solar, wind and nuclear. + ${value !== undefined @@ -194,10 +196,14 @@ class HuiEnergyCarbonGaugeCard top: 4px; color: var(--secondary-text-color); } + paper-tooltip > span { + font-size: 12px; + line-height: 12px; + } paper-tooltip { width: 80%; max-width: 250px; - margin-top: 10%; + top: 8px !important; } `; } diff --git a/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts index 00609e178b..6266313366 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts @@ -98,11 +98,13 @@ class HuiEnergyGridGaugeCard - This card represents your energy dependency. -

- If it's green, it means you produced more energy than that you - consumed from the grid. If it's in the red, it means that you relied - on the grid for part of your home's energy consumption. + + This card represents your energy dependency. +

+ If it's green, it means you produced more energy than that you + consumed from the grid. If it's in the red, it means that you relied + on the grid for part of your home's energy consumption. +
${value !== undefined ? html` span { + font-size: 12px; + line-height: 12px; + } paper-tooltip { width: 80%; max-width: 250px; - margin-top: 10%; + top: 8px !important; } `; } diff --git a/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts index dbb537aad3..1a0cbaed2b 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts @@ -88,11 +88,14 @@ class HuiEnergySolarGaugeCard - This card represents how much of the solar energy was used by your - home and was not returned to the grid. -

- If you frequently produce more than you consume, try to conserve this - energy by installing a battery or buying an electric car to charge. + + This card represents how much of the solar energy was used by your + home and was not returned to the grid. +

+ If you frequently produce more than you consume, try to conserve + this energy by installing a battery or buying an electric car to + charge. +
${value !== undefined ? html` span { + font-size: 12px; + line-height: 12px; + } paper-tooltip { width: 80%; max-width: 250px; - margin-top: 10%; + top: 8px !important; } `; } From e8a406526b7cad0954586fea63e2823886d7d005 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 4 Aug 2021 20:17:05 +0200 Subject: [PATCH 10/10] Bumped version to 20210804.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b9a780aa48..09d5db8710 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="home-assistant-frontend", - version="20210803.2", + version="20210804.0", description="The Home Assistant frontend", url="https://github.com/home-assistant/frontend", author="The Home Assistant Authors",