1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00
Files
frontend/js/panel-config/trigger/mqtt.js
Paulus Schoutsen 912969111f Move all of hassUtil to JS (#1153)
* Move all of hassUtil to JS

* Fix tests
2018-05-09 21:33:31 -04:00

37 lines
880 B
JavaScript

import { h, Component } from 'preact';
import { onChangeEvent } from '../../common/preact/event.js';
export default class MQTTTrigger extends Component {
constructor() {
super();
this.onChange = onChangeEvent.bind(this, 'trigger');
}
/* eslint-disable camelcase */
render({ trigger, localize }) {
const { topic, payload } = trigger;
return (
<div>
<paper-input
label={localize('ui.panel.config.automation.editor.triggers.type.mqtt.topic')}
name="topic"
value={topic}
onvalue-changed={this.onChange}
/>
<paper-input
label={localize('ui.panel.config.automation.editor.triggers.type.mqtt.payload')}
name="payload"
value={payload}
onvalue-changed={this.onChange}
/>
</div>
);
}
}
MQTTTrigger.defaultConfig = {
topic: ''
};