Fix automation describeCondition for number state type (#21052)

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.
This commit is contained in:
koostamas 2024-06-10 19:19:26 +02:00 committed by GitHub
parent 562bc084f0
commit c54acc9369
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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