Update for new card-tools version
This commit is contained in:
parent
f06d3dba74
commit
a64a9b4cbe
@ -1,8 +1,9 @@
|
|||||||
customElements.whenDefined('card-tools').then(() => {
|
customElements.whenDefined('card-tools').then(() => {
|
||||||
class StateSwitch extends cardTools.litElement() {
|
const cardTools = customElements.get('card-tools');
|
||||||
|
class StateSwitch extends cardTools.LitElement {
|
||||||
|
|
||||||
setConfig(config) {
|
setConfig(config) {
|
||||||
cardTools.checkVersion(0.3);
|
cardTools.checkVersion(0.4);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
this.cardSize = 1;
|
this.cardSize = 1;
|
||||||
@ -16,7 +17,7 @@ class StateSwitch extends cardTools.litElement() {
|
|||||||
this.idCard = cardTools.createCard({
|
this.idCard = cardTools.createCard({
|
||||||
type: "markdown",
|
type: "markdown",
|
||||||
title: "Device ID",
|
title: "Device ID",
|
||||||
content: `Your device id is: \`${cardTools.deviceID()}\``,
|
content: `Your device id is: \`${cardTools.deviceID}\``,
|
||||||
});
|
});
|
||||||
|
|
||||||
if(config.entity === 'hash') {
|
if(config.entity === 'hash') {
|
||||||
@ -25,7 +26,7 @@ class StateSwitch extends cardTools.litElement() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return cardTools.litHtml()`
|
return cardTools.LitHtml`
|
||||||
<div id="root">${this.currentCard}</div>
|
<div id="root">${this.currentCard}</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -38,7 +39,7 @@ class StateSwitch extends cardTools.litElement() {
|
|||||||
this.currentCard = this.cards[hass.user.name]
|
this.currentCard = this.cards[hass.user.name]
|
||||||
|| this.cards[this.config.default];
|
|| this.cards[this.config.default];
|
||||||
} else if(this.config.entity == 'browser') {
|
} else if(this.config.entity == 'browser') {
|
||||||
this.currentCard = this.cards[cardTools.deviceID()]
|
this.currentCard = this.cards[cardTools.deviceID]
|
||||||
|| ((this.config.default)
|
|| ((this.config.default)
|
||||||
? this.cards[this.config.default]
|
? this.cards[this.config.default]
|
||||||
: this.idCard);
|
: this.idCard);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user