mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
parent
545d140dcf
commit
9354ed927b
@ -1016,60 +1016,40 @@ const tryDescribeCondition = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sun condition
|
// Sun condition
|
||||||
if (
|
if (condition.condition === "sun" && (condition.before || condition.after)) {
|
||||||
condition.condition === "sun" &&
|
let afterDuration = "";
|
||||||
("before" in condition || "after" in condition)
|
if (condition.after && condition.after_offset) {
|
||||||
) {
|
if (typeof condition.after_offset === "number") {
|
||||||
let base = "Confirm";
|
afterDuration = secondsToDuration(condition.after_offset)!;
|
||||||
|
} else if (typeof condition.after_offset === "string") {
|
||||||
if (!condition.after && !condition.before) {
|
afterDuration = condition.after_offset;
|
||||||
base += " sun";
|
} else {
|
||||||
return base;
|
afterDuration = JSON.stringify(condition.after_offset);
|
||||||
}
|
|
||||||
|
|
||||||
base += " sun";
|
|
||||||
|
|
||||||
if (condition.after) {
|
|
||||||
let after_duration = "";
|
|
||||||
|
|
||||||
if (condition.after_offset) {
|
|
||||||
if (typeof condition.after_offset === "number") {
|
|
||||||
after_duration = ` offset by ${secondsToDuration(
|
|
||||||
condition.after_offset
|
|
||||||
)!}`;
|
|
||||||
} else if (typeof condition.after_offset === "string") {
|
|
||||||
after_duration = ` offset by ${condition.after_offset}`;
|
|
||||||
} else {
|
|
||||||
after_duration = ` offset by ${JSON.stringify(
|
|
||||||
condition.after_offset
|
|
||||||
)}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base += ` after ${condition.after}${after_duration}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (condition.before) {
|
let beforeDuration = "";
|
||||||
let before_duration = "";
|
if (condition.before && condition.before_offset) {
|
||||||
|
if (typeof condition.before_offset === "number") {
|
||||||
if (condition.before_offset) {
|
beforeDuration = secondsToDuration(condition.before_offset)!;
|
||||||
if (typeof condition.before_offset === "number") {
|
} else if (typeof condition.before_offset === "string") {
|
||||||
before_duration = ` offset by ${secondsToDuration(
|
beforeDuration = condition.before_offset;
|
||||||
condition.before_offset
|
} else {
|
||||||
)!}`;
|
beforeDuration = JSON.stringify(condition.before_offset);
|
||||||
} else if (typeof condition.before_offset === "string") {
|
|
||||||
before_duration = ` offset by ${condition.before_offset}`;
|
|
||||||
} else {
|
|
||||||
before_duration = ` offset by ${JSON.stringify(
|
|
||||||
condition.before_offset
|
|
||||||
)}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base += ` before ${condition.before}${before_duration}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return base;
|
return hass.localize(
|
||||||
|
`${conditionsTranslationBaseKey}.sun.description.full`,
|
||||||
|
{
|
||||||
|
afterChoice: condition.after ?? "other",
|
||||||
|
afterOffsetChoice: afterDuration !== "" ? "offset" : "other",
|
||||||
|
afterOffset: afterDuration,
|
||||||
|
beforeChoice: condition.before ?? "other",
|
||||||
|
beforeOffsetChoice: beforeDuration !== "" ? "offset" : "other",
|
||||||
|
beforeOffset: beforeDuration,
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zone condition
|
// Zone condition
|
||||||
|
@ -2508,7 +2508,9 @@
|
|||||||
"label": "Time and location",
|
"label": "Time and location",
|
||||||
"description": "When someone enters or leaves a zone, or at a specific time."
|
"description": "When someone enters or leaves a zone, or at a specific time."
|
||||||
},
|
},
|
||||||
"other": { "label": "Other triggers" }
|
"other": {
|
||||||
|
"label": "Other triggers"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"type": {
|
"type": {
|
||||||
"calendar": {
|
"calendar": {
|
||||||
@ -2748,7 +2750,9 @@
|
|||||||
"label": "Time and location",
|
"label": "Time and location",
|
||||||
"description": "If someone is in a zone or if the current time is before or after a specified time."
|
"description": "If someone is in a zone or if the current time is before or after a specified time."
|
||||||
},
|
},
|
||||||
"other": { "label": "Other conditions" },
|
"other": {
|
||||||
|
"label": "Other conditions"
|
||||||
|
},
|
||||||
"building_blocks": {
|
"building_blocks": {
|
||||||
"label": "Building blocks",
|
"label": "Building blocks",
|
||||||
"description": "Build more complex conditions."
|
"description": "Build more complex conditions."
|
||||||
@ -2828,7 +2832,8 @@
|
|||||||
"sunrise": "Sunrise",
|
"sunrise": "Sunrise",
|
||||||
"sunset": "Sunset",
|
"sunset": "Sunset",
|
||||||
"description": {
|
"description": {
|
||||||
"picker": "If the sun is above or below the horizon."
|
"picker": "If the sun is above or below the horizon.",
|
||||||
|
"full": "Confirm sun{afterChoice, select, \n sunrise { after sunrise}\n sunset { after sunset}\n other {}\n}{afterOffsetChoice, select, \n offset { offset by {afterOffset}}\n other {}\n}{beforeChoice, select, \n sunrise { before sunrise}\n sunset { before sunset}\n other {}\n}{beforeOffsetChoice, select, \n offset { offset by {beforeOffset}}\n other {}\n}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"template": {
|
"template": {
|
||||||
@ -2912,8 +2917,12 @@
|
|||||||
"type_select": "Action type",
|
"type_select": "Action type",
|
||||||
"continue_on_error": "Continue on error",
|
"continue_on_error": "Continue on error",
|
||||||
"groups": {
|
"groups": {
|
||||||
"helpers": { "label": "Helpers" },
|
"helpers": {
|
||||||
"other": { "label": "Other actions" },
|
"label": "Helpers"
|
||||||
|
},
|
||||||
|
"other": {
|
||||||
|
"label": "Other actions"
|
||||||
|
},
|
||||||
"building_blocks": {
|
"building_blocks": {
|
||||||
"label": "Building blocks",
|
"label": "Building blocks",
|
||||||
"description": "Build more complex sequences of actions."
|
"description": "Build more complex sequences of actions."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user