Skip to content

Commit

Permalink
add optional flags for height and scale
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwetteronline committed Nov 19, 2020
1 parent e16ec86 commit da4fdc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
type: "custom:carnet-card"
car_id: passat_gte_2020 # your car identifer in home assistant (e.g. binary_sensor.passat_gte_2020_climatisation_without_external_power)
slice_url: https://images.portal.volkswagen-we.com/slices/passat_variant_gte_pa/passat_variant_gte_pa # either you can extract this url from the logs of the homeassistant-volkswagencarnet plugin or use the dev tools and debug the portal.volkswagen-we.com website.
scale: 0.5 # optional (if you want the card to be smaller)
height: 270px # optional (if you want the card to be smaller)
```
## Development
Expand Down
10 changes: 10 additions & 0 deletions carnet-card.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
class CarnetCard extends HTMLElement {
set hass(hass) {
if (!this.content) {
const scale = this.config.scale;
const height = this.config.height;

const card = document.createElement("ha-card");
this.content = document.createElement("div");
this.content.style.width = "100%";
if (!!height) {
this.content.style.height = `${height}`;
}
if (!!scale) {
this.content.style.transform = `scale(${scale})`;
}
this.content.style.transformOrigin = "top center";
card.appendChild(this.content);
this.appendChild(card);
}
Expand Down

0 comments on commit da4fdc5

Please sign in to comment.