-
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.
Add
set_conversation_response
action (#19512)
- Loading branch information
1 parent
88f6723
commit cc4cfe1
Showing
7 changed files
with
85 additions
and
109 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
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
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
54 changes: 54 additions & 0 deletions
54
src/panels/config/automation/action/types/ha-automation-action-set_conversation_response.ts
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { html, LitElement } from "lit"; | ||
import { customElement, property } from "lit/decorators"; | ||
import "../../../../../components/ha-form/ha-form"; | ||
import type { SetConversationResponseAction } from "../../../../../data/script"; | ||
import type { HomeAssistant } from "../../../../../types"; | ||
import type { ActionElement } from "../ha-automation-action-row"; | ||
|
||
const SCHEMA = [ | ||
{ | ||
name: "set_conversation_response", | ||
selector: { | ||
template: {}, | ||
}, | ||
}, | ||
] as const; | ||
|
||
@customElement("ha-automation-action-set_conversation_response") | ||
export class HaSetConversationResponseAction | ||
extends LitElement | ||
implements ActionElement | ||
{ | ||
@property({ attribute: false }) public hass!: HomeAssistant; | ||
|
||
@property({ attribute: false }) public action!: SetConversationResponseAction; | ||
|
||
@property({ type: Boolean }) public disabled = false; | ||
|
||
public static get defaultConfig() { | ||
return { set_conversation_response: "" }; | ||
} | ||
|
||
protected render() { | ||
return html` | ||
<ha-form | ||
.hass=${this.hass} | ||
.data=${this.action} | ||
.schema=${SCHEMA} | ||
.disabled=${this.disabled} | ||
.computeLabel=${this._computeLabelCallback} | ||
></ha-form> | ||
`; | ||
} | ||
|
||
private _computeLabelCallback = (): string => | ||
this.hass.localize( | ||
"ui.panel.config.automation.editor.actions.type.set_conversation_response.label" | ||
); | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"ha-automation-action-set_conversation_response": HaSetConversationResponseAction; | ||
} | ||
} |
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