mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Support for timestamp sensors in time trigger automation UI (#15292)
* Support for timestamp sensors in time trigger automation UI * rename var * simply filter function Co-authored-by: Paul Bottein <paul.bottein@gmail.com> * rename var * use new entity filter options --------- Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
This commit is contained in:
parent
8754947133
commit
d5fb924cb4
@ -63,7 +63,14 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
||||
{
|
||||
name: "after",
|
||||
selector: inputModeAfter
|
||||
? { entity: { domain: "input_datetime" } }
|
||||
? {
|
||||
entity: {
|
||||
filter: [
|
||||
{ domain: "input_datetime" },
|
||||
{ domain: "sensor", device_class: "timestamp" },
|
||||
],
|
||||
},
|
||||
}
|
||||
: { time: {} },
|
||||
},
|
||||
{
|
||||
@ -88,7 +95,14 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
||||
{
|
||||
name: "before",
|
||||
selector: inputModeBefore
|
||||
? { entity: { domain: "input_datetime" } }
|
||||
? {
|
||||
entity: {
|
||||
filter: [
|
||||
{ domain: "input_datetime" },
|
||||
{ domain: "sensor", device_class: "timestamp" },
|
||||
],
|
||||
},
|
||||
}
|
||||
: { time: {} },
|
||||
},
|
||||
{
|
||||
@ -111,10 +125,12 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
||||
protected render() {
|
||||
const inputModeBefore =
|
||||
this._inputModeBefore ??
|
||||
this.condition.before?.startsWith("input_datetime.");
|
||||
(this.condition.before?.startsWith("input_datetime.") ||
|
||||
this.condition.before?.startsWith("sensor."));
|
||||
const inputModeAfter =
|
||||
this._inputModeAfter ??
|
||||
this.condition.after?.startsWith("input_datetime.");
|
||||
(this.condition.after?.startsWith("input_datetime.") ||
|
||||
this.condition.after?.startsWith("sensor."));
|
||||
|
||||
const schema = this._schema(
|
||||
this.hass.localize,
|
||||
|
@ -26,7 +26,14 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
||||
private _schema = memoizeOne(
|
||||
(localize: LocalizeFunc, inputMode?: boolean) => {
|
||||
const atSelector = inputMode
|
||||
? { entity: { domain: "input_datetime" } }
|
||||
? {
|
||||
entity: {
|
||||
filter: [
|
||||
{ domain: "input_datetime" },
|
||||
{ domain: "sensor", device_class: "timestamp" },
|
||||
],
|
||||
},
|
||||
}
|
||||
: { time: {} };
|
||||
|
||||
return [
|
||||
|
@ -2131,7 +2131,7 @@
|
||||
},
|
||||
"time": {
|
||||
"type_value": "Fixed time",
|
||||
"type_input": "Value of a date/time helper",
|
||||
"type_input": "Value of a date/time helper or timestamp-class sensor",
|
||||
"label": "Time",
|
||||
"at": "At time",
|
||||
"mode": "Mode"
|
||||
|
Loading…
x
Reference in New Issue
Block a user