Skip to content

Commit

Permalink
Trying to solve #64. Could it be caused by lazy loading in HA?
Browse files Browse the repository at this point in the history
  • Loading branch information
gurbyz committed Oct 20, 2020
1 parent 258ccd9 commit e2ce88d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Changelog
====
## 0.1.5-dev
### Fixes
* Trying to solve #64. Could it be caused by lazy loading in HA?

## 0.1.4
### Improvements
* Documentation improvement. As mentioned in #60.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "power-wheel-card",
"version": "0.1.4",
"version": "0.1.5-dev",
"description": "An intuitive way to represent the power and energy that your home is consuming or producing.",
"directories": {
"test": "test"
Expand Down
31 changes: 16 additions & 15 deletions power-wheel-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

const __VERSION = "0.1.4";
const __VERSION = "0.1.5-dev";

const LitElement = customElements.get('hui-masonry-view')
? Object.getPrototypeOf(customElements.get('hui-masonry-view'))
Expand Down Expand Up @@ -629,20 +629,21 @@ class PowerWheelCard extends LitElement {

setConfig(config) {
config = { ...config };
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');
}
// 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');
// }
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;
Expand Down

0 comments on commit e2ce88d

Please sign in to comment.