Skip to content

Commit

Permalink
Corrected Readme, added warning, fixed algnment bug when grid is abscent
Browse files Browse the repository at this point in the history
  • Loading branch information
reptilex committed Mar 12, 2021
1 parent d1f56ca commit 18690c5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# tesla-style-solar-power-card

> **⚠ WARNING: BREAKING CONFIG CHANGE**
> **You have to define the bubbles/icons AND the FLOWS!!**
> Without defining each flow no line will show, read the usage part carefully
This is a [home-assistant](home-assistant.io) card for solar installations. It provides a tesla style graphic to see the flows of energy ((k)W).

### Table of contents
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"module": "dist/index.js",
"scripts": {
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
"build": "rimraf dist && tsc && rollup -c rollup.config.js",
"build": "rimraf dist && tsc && rollup -c rollup.config.js && cp tesla-style-solar-power-card.js ../homeassistant/config/www",
"prepublish": "tsc",
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
Expand Down
17 changes: 17 additions & 0 deletions src/services/HtmlResizeForPowerCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,23 @@ export class HtmlResizeForPowerCard {
);
}
});
const gridElement = <HTMLElement>(
teslaCardElement.querySelector('.grid_consumption_entity')
);
if (gridElement === null) {
changeSelectorStyle('.generation_yield_entity', 'margin', '0px');
changeSelectorStyle('.battery_consumption_entity', 'margin', '0px');
changeSelectorStyle('.power_lines', 'width', 30 * pxRate + 'px');
selectorElement = <HTMLElement>(
teslaCardElement.querySelector('.power_lines svg')
);
if (selectorElement !== null)
selectorElement.setAttribute(
'viewBox',
12 * pxRate + ' 0 ' + 42 * pxRate + ' ' + 42 * pxRate
);
}

changeSelectorStyle('.acc_appliance1', 'top', 10 + 'px');
changeSelectorStyle('.acc_appliance1_line', 'top', 23 * pxRate + 'px');
changeSelectorStyle('.acc_appliance2', 'bottom', 10 + 'px');
Expand Down
6 changes: 4 additions & 2 deletions tesla-style-solar-power-card.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 18690c5

Please sign in to comment.