mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +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",
|
name: "after",
|
||||||
selector: inputModeAfter
|
selector: inputModeAfter
|
||||||
? { entity: { domain: "input_datetime" } }
|
? {
|
||||||
|
entity: {
|
||||||
|
filter: [
|
||||||
|
{ domain: "input_datetime" },
|
||||||
|
{ domain: "sensor", device_class: "timestamp" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
: { time: {} },
|
: { time: {} },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -88,7 +95,14 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
|||||||
{
|
{
|
||||||
name: "before",
|
name: "before",
|
||||||
selector: inputModeBefore
|
selector: inputModeBefore
|
||||||
? { entity: { domain: "input_datetime" } }
|
? {
|
||||||
|
entity: {
|
||||||
|
filter: [
|
||||||
|
{ domain: "input_datetime" },
|
||||||
|
{ domain: "sensor", device_class: "timestamp" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
: { time: {} },
|
: { time: {} },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -111,10 +125,12 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
|||||||
protected render() {
|
protected render() {
|
||||||
const inputModeBefore =
|
const inputModeBefore =
|
||||||
this._inputModeBefore ??
|
this._inputModeBefore ??
|
||||||
this.condition.before?.startsWith("input_datetime.");
|
(this.condition.before?.startsWith("input_datetime.") ||
|
||||||
|
this.condition.before?.startsWith("sensor."));
|
||||||
const inputModeAfter =
|
const inputModeAfter =
|
||||||
this._inputModeAfter ??
|
this._inputModeAfter ??
|
||||||
this.condition.after?.startsWith("input_datetime.");
|
(this.condition.after?.startsWith("input_datetime.") ||
|
||||||
|
this.condition.after?.startsWith("sensor."));
|
||||||
|
|
||||||
const schema = this._schema(
|
const schema = this._schema(
|
||||||
this.hass.localize,
|
this.hass.localize,
|
||||||
|
@ -26,7 +26,14 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
|||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(localize: LocalizeFunc, inputMode?: boolean) => {
|
(localize: LocalizeFunc, inputMode?: boolean) => {
|
||||||
const atSelector = inputMode
|
const atSelector = inputMode
|
||||||
? { entity: { domain: "input_datetime" } }
|
? {
|
||||||
|
entity: {
|
||||||
|
filter: [
|
||||||
|
{ domain: "input_datetime" },
|
||||||
|
{ domain: "sensor", device_class: "timestamp" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
: { time: {} };
|
: { time: {} };
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -2131,7 +2131,7 @@
|
|||||||
},
|
},
|
||||||
"time": {
|
"time": {
|
||||||
"type_value": "Fixed 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",
|
"label": "Time",
|
||||||
"at": "At time",
|
"at": "At time",
|
||||||
"mode": "Mode"
|
"mode": "Mode"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user