From 835ec4cf20ad9057685a713a9a1581e2c2653f50 Mon Sep 17 00:00:00 2001 From: Gerben ten Hove Date: Sun, 25 Oct 2020 17:45:43 +0100 Subject: [PATCH] Removed possible fix for #64. --- CHANGELOG.md | 1 - power-wheel-card.js | 29 ++++++++++++++--------------- preload-cards.js | 6 ------ 3 files changed, 14 insertions(+), 22 deletions(-) delete mode 100644 preload-cards.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 712bc29..7dd0919 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,6 @@ Changelog ==== ## 0.1.5-dev ### Fixes -* Trying to solve #64. Could it be caused by lazy loading in HA? ## 0.1.4 ### Improvements diff --git a/power-wheel-card.js b/power-wheel-card.js index 25459b9..92db6f8 100644 --- a/power-wheel-card.js +++ b/power-wheel-card.js @@ -629,21 +629,20 @@ class PowerWheelCard extends LitElement { setConfig(config) { config = { ...config }; - // Disabled as part of testing for issue #64: could lazy loading of HA be the cause? - // if (!config.solar_power_entity) { - // throw new Error('You need to define a solar_power_entity'); - // } - // if (!config.grid_power_consumption_entity && !config.grid_power_production_entity - // && !config.grid_power_entity) { - // throw new Error('You need to define a grid_power_consumption_entity' + - // 'and a grid_power_production_entity OR you can define a grid_power_entity'); - // } - // if (config.grid_power_production_entity && !config.grid_power_consumption_entity) { - // throw new Error('You need to define a grid_power_consumption_entity'); - // } - // if (config.grid_power_consumption_entity && !config.grid_power_production_entity) { - // throw new Error('You need to define a grid_power_production_entity'); - // } + if (!config.solar_power_entity) { + throw new Error('You need to define a solar_power_entity'); + } + if (!config.grid_power_consumption_entity && !config.grid_power_production_entity + && !config.grid_power_entity) { + throw new Error('You need to define a grid_power_consumption_entity' + + 'and a grid_power_production_entity OR you can define a grid_power_entity'); + } + if (config.grid_power_production_entity && !config.grid_power_consumption_entity) { + throw new Error('You need to define a grid_power_consumption_entity'); + } + if (config.grid_power_consumption_entity && !config.grid_power_production_entity) { + throw new Error('You need to define a grid_power_production_entity'); + } config.charging_is_positive = config.charging_is_positive !== false; config.charging_is_positive = config.charging_is_positive ? 1 : -1; config.production_is_positive = config.production_is_positive !== false; diff --git a/preload-cards.js b/preload-cards.js deleted file mode 100644 index d6f63ce..0000000 --- a/preload-cards.js +++ /dev/null @@ -1,6 +0,0 @@ -// Part of testing for #64: could lazy loading of HA be the culprit? - -const preloadCard = type => window.loadCardHelpers() - .then(({ createCardElement }) => createCardElement({type})) - -preloadCard("custom:power-wheel-card");