mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 17:56:46 +00:00
Fix time trigger (#11841)
This commit is contained in:
parent
48355aa98e
commit
151f8d5524
@ -23,9 +23,9 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(localize: LocalizeFunc, inputMode?: boolean): HaFormSchema[] => {
|
(localize: LocalizeFunc, inputMode?: boolean): HaFormSchema[] => {
|
||||||
const modeSchema = inputMode
|
const atSelector = inputMode
|
||||||
? { name: "at", selector: { entity: { domain: "input_datetime" } } }
|
? { entity: { domain: "input_datetime" } }
|
||||||
: { name: "at", selector: { time: {} } };
|
: { time: {} };
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -47,7 +47,7 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
modeSchema,
|
{ name: "at", selector: atSelector },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -80,7 +80,7 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
|||||||
const schema: HaFormSchema[] = this._schema(this.hass.localize, inputMode);
|
const schema: HaFormSchema[] = this._schema(this.hass.localize, inputMode);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
mode: "value",
|
mode: inputMode ? "input" : "value",
|
||||||
...this.trigger,
|
...this.trigger,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -99,7 +99,8 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
|||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
const newValue = ev.detail.value;
|
const newValue = ev.detail.value;
|
||||||
|
|
||||||
this._inputMode = newValue.mode.value === "input";
|
this._inputMode = newValue.mode === "input";
|
||||||
|
delete newValue.mode;
|
||||||
|
|
||||||
Object.keys(newValue).forEach((key) =>
|
Object.keys(newValue).forEach((key) =>
|
||||||
newValue[key] === undefined || newValue[key] === ""
|
newValue[key] === undefined || newValue[key] === ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user