Skip to content

Commit

Permalink
Fix automation describeCondition for number state type (#21052)
Browse files Browse the repository at this point in the history
When using a number state condition in an automation, the UI used an incorrect evaluation when trying to describe the condition which made the label default to the default value.
To fix this, I just changed the evaluation to check directly for `undefined` value.
  • Loading branch information
koostamas authored Jun 10, 2024
1 parent 562bc08 commit c54acc9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/data/automation_i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ const tryDescribeCondition = (
)
: undefined;

if (condition.above && condition.below) {
if (condition.above !== undefined && condition.below !== undefined) {
return hass.localize(
`${conditionsTranslationBaseKey}.numeric_state.description.above-below`,
{
Expand All @@ -912,7 +912,7 @@ const tryDescribeCondition = (
}
);
}
if (condition.above) {
if (condition.above !== undefined) {
return hass.localize(
`${conditionsTranslationBaseKey}.numeric_state.description.above`,
{
Expand All @@ -922,7 +922,7 @@ const tryDescribeCondition = (
}
);
}
if (condition.below) {
if (condition.below !== undefined) {
return hass.localize(
`${conditionsTranslationBaseKey}.numeric_state.description.below`,
{
Expand Down

0 comments on commit c54acc9

Please sign in to comment.