-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make config flow previews more generic
- Loading branch information
Showing
7 changed files
with
21 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
import { UnsubscribeFunc } from "home-assistant-js-websocket"; | ||
import { HomeAssistant } from "../types"; | ||
|
||
export interface ThresholdPreview { | ||
export interface GenericPreview { | ||
state: string; | ||
attributes: Record<string, any>; | ||
} | ||
|
||
export const subscribePreviewThreshold = ( | ||
export const subscribePreviewGeneric = ( | ||
hass: HomeAssistant, | ||
domain: string, | ||
flow_id: string, | ||
flow_type: "config_flow" | "options_flow", | ||
user_input: Record<string, any>, | ||
callback: (preview: ThresholdPreview) => void | ||
callback: (preview: GenericPreview) => void | ||
): Promise<UnsubscribeFunc> => | ||
hass.connection.subscribeMessage(callback, { | ||
type: "threshold/start_preview", | ||
type: `${domain}/start_preview`, | ||
flow_id, | ||
flow_type, | ||
user_input, | ||
}); | ||
|
||
export const previewModule = (domain: string): string => | ||
["template"].includes(domain) ? domain : "generic"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
94 changes: 0 additions & 94 deletions
94
src/dialogs/config-flow/previews/flow-preview-time_date.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters