mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Change how external QR code scanning works (#19743)
This commit is contained in:
parent
208bfebc12
commit
553230ca23
@ -35,13 +35,22 @@ interface EMOutgoingMessageConfigGet extends EMMessage {
|
|||||||
type: "config/get";
|
type: "config/get";
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EMOutgoingMessageScanQRCode extends EMMessage {
|
interface EMOutgoingMessageBarCodeScan extends EMMessage {
|
||||||
type: "qr_code/scan";
|
type: "bar_code/scan";
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
alternative_option_label?: string;
|
alternative_option_label?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface EMOutgoingMessageBarCodeClose extends EMMessage {
|
||||||
|
type: "bar_code/close";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EMOutgoingMessageBarCodeNotify extends EMMessage {
|
||||||
|
type: "bar_code/notify";
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface EMOutgoingMessageMatterCommission extends EMMessage {
|
interface EMOutgoingMessageMatterCommission extends EMMessage {
|
||||||
type: "matter/commission";
|
type: "matter/commission";
|
||||||
}
|
}
|
||||||
@ -55,13 +64,6 @@ type EMOutgoingMessageWithAnswer = {
|
|||||||
request: EMOutgoingMessageConfigGet;
|
request: EMOutgoingMessageConfigGet;
|
||||||
response: ExternalConfig;
|
response: ExternalConfig;
|
||||||
};
|
};
|
||||||
"qr_code/scan": {
|
|
||||||
request: EMOutgoingMessageScanQRCode;
|
|
||||||
response:
|
|
||||||
| EMIncomingMessageQRCodeResponseCanceled
|
|
||||||
| EMIncomingMessageQRCodeResponseAlternativeOptions
|
|
||||||
| EMIncomingMessageQRCodeResponseScanResult;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface EMOutgoingMessageExoplayerPlayHLS extends EMMessage {
|
interface EMOutgoingMessageExoplayerPlayHLS extends EMMessage {
|
||||||
@ -124,20 +126,23 @@ interface EMOutgoingMessageAssistShow extends EMMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type EMOutgoingMessageWithoutAnswer =
|
type EMOutgoingMessageWithoutAnswer =
|
||||||
| EMOutgoingMessageHaptic
|
| EMMessageResultError
|
||||||
| EMOutgoingMessageConnectionStatus
|
| EMMessageResultSuccess
|
||||||
| EMOutgoingMessageAppConfiguration
|
| EMOutgoingMessageAppConfiguration
|
||||||
| EMOutgoingMessageTagWrite
|
|
||||||
| EMOutgoingMessageSidebarShow
|
|
||||||
| EMOutgoingMessageAssistShow
|
| EMOutgoingMessageAssistShow
|
||||||
|
| EMOutgoingMessageBarCodeClose
|
||||||
|
| EMOutgoingMessageBarCodeNotify
|
||||||
|
| EMOutgoingMessageBarCodeScan
|
||||||
|
| EMOutgoingMessageConnectionStatus
|
||||||
| EMOutgoingMessageExoplayerPlayHLS
|
| EMOutgoingMessageExoplayerPlayHLS
|
||||||
| EMOutgoingMessageExoplayerResize
|
| EMOutgoingMessageExoplayerResize
|
||||||
| EMOutgoingMessageExoplayerStop
|
| EMOutgoingMessageExoplayerStop
|
||||||
| EMOutgoingMessageThemeUpdate
|
| EMOutgoingMessageHaptic
|
||||||
| EMMessageResultSuccess
|
| EMOutgoingMessageImportThreadCredentials
|
||||||
| EMMessageResultError
|
|
||||||
| EMOutgoingMessageMatterCommission
|
| EMOutgoingMessageMatterCommission
|
||||||
| EMOutgoingMessageImportThreadCredentials;
|
| EMOutgoingMessageSidebarShow
|
||||||
|
| EMOutgoingMessageTagWrite
|
||||||
|
| EMOutgoingMessageThemeUpdate;
|
||||||
|
|
||||||
interface EMIncomingMessageRestart {
|
interface EMIncomingMessageRestart {
|
||||||
id: number;
|
id: number;
|
||||||
@ -172,17 +177,39 @@ interface EMIncomingMessageShowAutomationEditor {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EMIncomingMessageQRCodeResponseCanceled {
|
export interface EMIncomingMessageBarCodeScanResult {
|
||||||
action: "canceled";
|
id: number;
|
||||||
|
type: "command";
|
||||||
|
command: "bar_code/scan_result";
|
||||||
|
payload: {
|
||||||
|
// A string decoded from the barcode data.
|
||||||
|
rawValue: string;
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API#supported_barcode_formats
|
||||||
|
format:
|
||||||
|
| "aztec"
|
||||||
|
| "code_128"
|
||||||
|
| "code_39"
|
||||||
|
| "code_93"
|
||||||
|
| "codabar"
|
||||||
|
| "data_matrix"
|
||||||
|
| "ean_13"
|
||||||
|
| "ean_8"
|
||||||
|
| "itf"
|
||||||
|
| "pdf417"
|
||||||
|
| "qr_code"
|
||||||
|
| "upc_a"
|
||||||
|
| "upc_e"
|
||||||
|
| "unknown";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EMIncomingMessageQRCodeResponseAlternativeOptions {
|
export interface EMIncomingMessageBarCodeScanAborted {
|
||||||
action: "alternative_options";
|
id: number;
|
||||||
}
|
type: "command";
|
||||||
|
command: "bar_code/aborted";
|
||||||
export interface EMIncomingMessageQRCodeResponseScanResult {
|
payload: {
|
||||||
action: "scan_result";
|
reason: "canceled" | "alternative_options";
|
||||||
result: string;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export type EMIncomingMessageCommands =
|
export type EMIncomingMessageCommands =
|
||||||
@ -190,7 +217,9 @@ export type EMIncomingMessageCommands =
|
|||||||
| EMIncomingMessageShowNotifications
|
| EMIncomingMessageShowNotifications
|
||||||
| EMIncomingMessageToggleSidebar
|
| EMIncomingMessageToggleSidebar
|
||||||
| EMIncomingMessageShowSidebar
|
| EMIncomingMessageShowSidebar
|
||||||
| EMIncomingMessageShowAutomationEditor;
|
| EMIncomingMessageShowAutomationEditor
|
||||||
|
| EMIncomingMessageBarCodeScanResult
|
||||||
|
| EMIncomingMessageBarCodeScanAborted;
|
||||||
|
|
||||||
type EMIncomingMessage =
|
type EMIncomingMessage =
|
||||||
| EMMessageResultSuccess
|
| EMMessageResultSuccess
|
||||||
@ -207,7 +236,7 @@ export interface ExternalConfig {
|
|||||||
canCommissionMatter: boolean;
|
canCommissionMatter: boolean;
|
||||||
canImportThreadCredentials: boolean;
|
canImportThreadCredentials: boolean;
|
||||||
hasAssist: boolean;
|
hasAssist: boolean;
|
||||||
hasQRScanner: number;
|
hasBarCodeScanner: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ExternalMessaging {
|
export class ExternalMessaging {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user