Skip to content

Commit

Permalink
Fix #25: Card doesn't work in HA 0.116
Browse files Browse the repository at this point in the history
  • Loading branch information
danimart1991 committed Oct 8, 2020
1 parent f39019e commit bc908ba
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ You could use [HACS](https://hacs.xyz/) or follow this [guide](https://www.danie

```yaml
resources:
url: /local/pvpc-hourly-pricing-card.js?v=1.2.3
url: /local/pvpc-hourly-pricing-card.js?v=1.2.4
type: module
```
Expand Down
22 changes: 15 additions & 7 deletions dist/pvpc-hourly-pricing-card-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ const locale = {
}
};

const LitElement = Object.getPrototypeOf(customElements.get('hui-view'));
const html = LitElement.prototype.html;
const css = LitElement.prototype.css;
const LitElement =
window.LitElement || Object.getPrototypeOf(customElements.get('home-assistant') || customElements.get('hui-view'));
const { html, css } = LitElement.prototype;

export class PVPCHourlyPricingCardEditor extends LitElement {
setConfig(config) {
Expand Down Expand Up @@ -152,21 +152,29 @@ export class PVPCHourlyPricingCardEditor extends LitElement {
</div>
<div class="side-by-side">
<div>
<ha-switch .checked=${this._current} .configValue="${'current'}" @change="${this._valueChanged}"></ha-switch>
<ha-switch
.checked=${this._current}
.configValue="${'current'}"
@change="${this._valueChanged}"
></ha-switch>
<label class="mdc-label">${this.ll('optionShowCurrent')}</label>
</div>
<div>
<ha-switch .checked=${this._details} .configValue="${'details'}" @change="${this._valueChanged}" ></ha-switch>
<ha-switch
.checked=${this._details}
.configValue="${'details'}"
@change="${this._valueChanged}"
></ha-switch>
<label class="mdc-label">${this.ll('optionShowDetails')}</label>
</div>
</div>
<div class="side-by-side">
<div>
<ha-switch .checked=${this._graph} .configValue="${'graph'}" @change="${this._valueChanged}" ></ha-switch>
<ha-switch .checked=${this._graph} .configValue="${'graph'}" @change="${this._valueChanged}"></ha-switch>
<label class="mdc-label">${this.ll('optionShowGraph')}</label>
</div>
<div>
<ha-switch .checked=${this._info} .configValue="${'info'}" @change="${this._valueChanged}" ></ha-switch>
<ha-switch .checked=${this._info} .configValue="${'info'}" @change="${this._valueChanged}"></ha-switch>
<label class="mdc-label">${this.ll('optionShowInfo')}</label>
</div>
</div>
Expand Down
11 changes: 7 additions & 4 deletions dist/pvpc-hourly-pricing-card.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const LitElement = Object.getPrototypeOf(customElements.get('hui-view'));
const html = LitElement.prototype.html;
const css = LitElement.prototype.css;
const LitElement =
window.LitElement || Object.getPrototypeOf(customElements.get('home-assistant') || customElements.get('hui-view'));
const { html, css } = LitElement.prototype;

const locale = {
da: {
Expand Down Expand Up @@ -126,7 +126,10 @@ function hasConfigOrEntityChanged(element, changedProps) {

class PVPCHourlyPricingCard extends LitElement {
static get properties() {
return { _config: {}, hass: {} };
return {
_config: { type: Object },
hass: { type: Object }
};
}

static async getConfigElement() {
Expand Down

0 comments on commit bc908ba

Please sign in to comment.