Add webhook trigger to automation editor (#2252)

This commit is contained in:
Paulus Schoutsen 2018-12-10 19:45:48 +01:00 committed by GitHub
parent b0c68e58c5
commit 46a9b90ed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 0 deletions

View File

@ -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,
};

View 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: "",
};

View File

@ -614,6 +614,10 @@
"label": "Time",
"at": "At"
},
"webhook": {
"label": "Webhook",
"webhook_id": "Webhook ID"
},
"zone": {
"label": "Zone",
"entity": "Entity with location",