Skip to content

Commit

Permalink
Tell mobile app to scan for Improv devices when 'Add Integration' tap (
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoncal authored Jul 19, 2024
1 parent 677cffd commit 7fed4e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/external_app/external_messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ interface EMOutgoingMessageAssistShow extends EMMessage {
start_listening: boolean;
};
}
interface EMOutgoingMessageImprovScan extends EMMessage {
type: "improv/scan";
}

interface EMOutgoingMessageThreadStoreInPlatformKeychain extends EMMessage {
type: "thread/store_in_platform_keychain";
Expand Down Expand Up @@ -156,7 +159,8 @@ type EMOutgoingMessageWithoutAnswer =
| EMOutgoingMessageSidebarShow
| EMOutgoingMessageTagWrite
| EMOutgoingMessageThemeUpdate
| EMOutgoingMessageThreadStoreInPlatformKeychain;
| EMOutgoingMessageThreadStoreInPlatformKeychain
| EMOutgoingMessageImprovScan;

interface EMIncomingMessageRestart {
id: number;
Expand Down Expand Up @@ -252,6 +256,7 @@ export interface ExternalConfig {
canTransferThreadCredentialsToKeychain: boolean;
hasAssist: boolean;
hasBarCodeScanner: number;
canSetupImprov: boolean;
}

export class ExternalMessaging {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
showAddIntegrationDialog(this, {
initialFilter: this._filter,
});
if (this.hass.auth.external?.config.canSetupImprov) {
this.hass.auth.external!.fireMessage({
type: "improv/scan",
});
}
}

private _handleMenuAction(ev: CustomEvent<ActionDetail>) {
Expand Down

0 comments on commit 7fed4e6

Please sign in to comment.