mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Entity is not required for button card (#7909)
Fixes https://github.com/home-assistant/frontend/issues/7908
This commit is contained in:
parent
b79c03433e
commit
e014c7aff6
@ -84,9 +84,6 @@ export class HuiButtonCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setConfig(config: ButtonCardConfig): void {
|
public setConfig(config: ButtonCardConfig): void {
|
||||||
if (!config.entity) {
|
|
||||||
throw new Error("Entity must be specified");
|
|
||||||
}
|
|
||||||
if (config.entity && !isValidEntityId(config.entity)) {
|
if (config.entity && !isValidEntityId(config.entity)) {
|
||||||
throw new Error("Invalid entity");
|
throw new Error("Invalid entity");
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,14 @@ import { customElement } from "lit-element";
|
|||||||
import { HuiButtonCard } from "./hui-button-card";
|
import { HuiButtonCard } from "./hui-button-card";
|
||||||
|
|
||||||
@customElement("hui-entity-button-card")
|
@customElement("hui-entity-button-card")
|
||||||
class HuiEntityButtonCard extends HuiButtonCard {}
|
class HuiEntityButtonCard extends HuiButtonCard {
|
||||||
|
public setConfig(config): void {
|
||||||
|
if (!config.entity) {
|
||||||
|
throw new Error("Entity must be specified");
|
||||||
|
}
|
||||||
|
super.setConfig(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user