mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
add "for" input field to numeric_state in trigger editor (#2081)
This commit is contained in:
parent
6885abd234
commit
785ed6f9db
@ -24,7 +24,18 @@ export default class NumericStateTrigger extends Component {
|
||||
/* eslint-disable camelcase */
|
||||
render({ trigger, hass, localize }) {
|
||||
const { value_template, entity_id, below, above } = trigger;
|
||||
let trgFor = trigger.for;
|
||||
|
||||
if (trgFor && (trgFor.hours || trgFor.minutes || trgFor.seconds)) {
|
||||
// If the trigger was defined using the yaml dict syntax, convert it to
|
||||
// the equivalent string format
|
||||
let { hours = 0, minutes = 0, seconds = 0 } = trgFor;
|
||||
hours = hours.toString();
|
||||
minutes = minutes.toString().padStart(2, "0");
|
||||
seconds = seconds.toString().padStart(2, "0");
|
||||
|
||||
trgFor = `${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<ha-entity-picker
|
||||
@ -57,6 +68,14 @@ export default class NumericStateTrigger extends Component {
|
||||
value={value_template}
|
||||
onvalue-changed={this.onChange}
|
||||
/>
|
||||
<paper-input
|
||||
label={localize(
|
||||
"ui.panel.config.automation.editor.triggers.type.state.for"
|
||||
)}
|
||||
name="for"
|
||||
value={trgFor}
|
||||
onvalue-changed={this.onChange}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user