diff --git a/src/components/ha-selector/ha-selector-qr-code.ts b/src/components/ha-selector/ha-selector-qr-code.ts new file mode 100644 index 0000000000..91361be7c0 --- /dev/null +++ b/src/components/ha-selector/ha-selector-qr-code.ts @@ -0,0 +1,30 @@ +import { LitElement, css, html } from "lit"; +import { customElement, property } from "lit/decorators"; +import { QRCodeSelector } from "../../data/selector"; +import "../ha-qr-code"; + +@customElement("ha-selector-qr_code") +export class HaSelectorQRCode extends LitElement { + @property({ attribute: false }) public selector!: QRCodeSelector; + + protected render() { + return html``; + } + + static styles = css` + ha-qr-code { + text-align: center; + } + `; +} + +declare global { + interface HTMLElementTagNameMap { + "ha-selector-qr_code": HaSelectorQRCode; + } +} diff --git a/src/components/ha-selector/ha-selector.ts b/src/components/ha-selector/ha-selector.ts index 66696fbf83..e7f9613f5f 100644 --- a/src/components/ha-selector/ha-selector.ts +++ b/src/components/ha-selector/ha-selector.ts @@ -34,6 +34,7 @@ const LOAD_ELEMENTS = { navigation: () => import("./ha-selector-navigation"), number: () => import("./ha-selector-number"), object: () => import("./ha-selector-object"), + qr_code: () => import("./ha-selector-qr-code"), select: () => import("./ha-selector-select"), selector: () => import("./ha-selector-selector"), state: () => import("./ha-selector-state"), diff --git a/src/data/selector.ts b/src/data/selector.ts index 3362e638ff..d4de771854 100644 --- a/src/data/selector.ts +++ b/src/data/selector.ts @@ -41,6 +41,7 @@ export type Selector = | NumberSelector | ObjectSelector | AssistPipelineSelector + | QRCodeSelector | SelectSelector | SelectorSelector | StateSelector @@ -340,6 +341,15 @@ export interface BackupLocationSelector { backup_location: {} | null; } +export interface QRCodeSelector { + qr_code: { + data: string; + scale?: number; + error_correction_level?: "low" | "medium" | "quartile" | "high"; + center_image?: string; + } | null; +} + export interface StringSelector { text: { multiline?: boolean;