mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-09 10:26:35 +00:00
Add webhook trigger to automation editor (#2252)
This commit is contained in:
parent
b0c68e58c5
commit
46a9b90ed0
@ -12,6 +12,7 @@ import StateTrigger from "./state";
|
||||
import SunTrigger from "./sun";
|
||||
import TemplateTrigger from "./template";
|
||||
import TimeTrigger from "./time";
|
||||
import WebhookTrigger from "./webhook";
|
||||
import ZoneTrigger from "./zone";
|
||||
|
||||
const TYPES = {
|
||||
@ -23,6 +24,7 @@ const TYPES = {
|
||||
sun: SunTrigger,
|
||||
template: TemplateTrigger,
|
||||
time: TimeTrigger,
|
||||
webhook: WebhookTrigger,
|
||||
zone: ZoneTrigger,
|
||||
};
|
||||
|
||||
|
32
src/panels/config/js/trigger/webhook.js
Normal file
32
src/panels/config/js/trigger/webhook.js
Normal file
@ -0,0 +1,32 @@
|
||||
import { h, Component } from "preact";
|
||||
import "@polymer/paper-input/paper-input";
|
||||
|
||||
import { onChangeEvent } from "../../../../common/preact/event";
|
||||
|
||||
export default class WebhookTrigger extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.onChange = onChangeEvent.bind(this, "trigger");
|
||||
}
|
||||
|
||||
render({ trigger, localize }) {
|
||||
const { webhook_id: webhookId } = trigger;
|
||||
return (
|
||||
<div>
|
||||
<paper-input
|
||||
label={localize(
|
||||
"ui.panel.config.automation.editor.triggers.type.webhook.webhook_id"
|
||||
)}
|
||||
name="webhook_id"
|
||||
value={webhookId}
|
||||
onvalue-changed={this.onChange}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
WebhookTrigger.defaultConfig = {
|
||||
webhook_id: "",
|
||||
};
|
@ -614,6 +614,10 @@
|
||||
"label": "Time",
|
||||
"at": "At"
|
||||
},
|
||||
"webhook": {
|
||||
"label": "Webhook",
|
||||
"webhook_id": "Webhook ID"
|
||||
},
|
||||
"zone": {
|
||||
"label": "Zone",
|
||||
"entity": "Entity with location",
|
||||
|
Loading…
x
Reference in New Issue
Block a user