mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 21:06:34 +00:00
Support time entities in automation time conditions/triggers selectors (#21069)
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
This commit is contained in:
parent
bd0bfc1fbe
commit
39b00f1063
@ -67,6 +67,7 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
||||
entity: {
|
||||
filter: [
|
||||
{ domain: "input_datetime" },
|
||||
{ domain: "time" },
|
||||
{ domain: "sensor", device_class: "timestamp" },
|
||||
],
|
||||
},
|
||||
@ -99,6 +100,7 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
||||
entity: {
|
||||
filter: [
|
||||
{ domain: "input_datetime" },
|
||||
{ domain: "time" },
|
||||
{ domain: "sensor", device_class: "timestamp" },
|
||||
],
|
||||
},
|
||||
@ -126,10 +128,12 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
||||
const inputModeBefore =
|
||||
this._inputModeBefore ??
|
||||
(this.condition.before?.startsWith("input_datetime.") ||
|
||||
this.condition.before?.startsWith("time.") ||
|
||||
this.condition.before?.startsWith("sensor."));
|
||||
const inputModeAfter =
|
||||
this._inputModeAfter ??
|
||||
(this.condition.after?.startsWith("input_datetime.") ||
|
||||
this.condition.after?.startsWith("time.") ||
|
||||
this.condition.after?.startsWith("sensor."));
|
||||
|
||||
const schema = this._schema(
|
||||
|
@ -65,6 +65,7 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
||||
entity: {
|
||||
filter: [
|
||||
{ domain: "input_datetime" },
|
||||
{ domain: "time" },
|
||||
{ domain: "sensor", device_class: "timestamp" },
|
||||
],
|
||||
},
|
||||
@ -106,7 +107,9 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
||||
const entity =
|
||||
typeof at === "object"
|
||||
? at.entity_id
|
||||
: at?.startsWith("input_datetime.") || at?.startsWith("sensor.")
|
||||
: at?.startsWith("input_datetime.") ||
|
||||
at?.startsWith("time.") ||
|
||||
at?.startsWith("sensor.")
|
||||
? at
|
||||
: undefined;
|
||||
const time = entity ? undefined : (at as string | undefined);
|
||||
@ -127,6 +130,7 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
||||
if (Array.isArray(at)) {
|
||||
return nothing;
|
||||
}
|
||||
|
||||
const data = this._data(this._inputMode, at);
|
||||
const showOffset =
|
||||
data.mode === MODE_ENTITY && data.entity?.startsWith("sensor.");
|
||||
|
@ -3145,7 +3145,7 @@
|
||||
},
|
||||
"time": {
|
||||
"type_value": "Fixed time",
|
||||
"type_input": "Value of a date/time helper or timestamp-class sensor",
|
||||
"type_input": "Value of a date/time helper, time entity or timestamp-class sensor",
|
||||
"label": "Time",
|
||||
"at": "At time",
|
||||
"offset": "[%key:ui::panel::config::automation::editor::triggers::type::sun::offset%]",
|
||||
|
Loading…
x
Reference in New Issue
Block a user