mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
[sensor] Guard NaN specialization against explicit empty value list
Preserves the prior behavior of `value: []` (behaves like plain throttle, no NaN bypass) by requiring a non-empty list before treating the config as NaN-only — `all([])` is vacuously true otherwise.
This commit is contained in:
@@ -666,7 +666,7 @@ async def throttle_with_priority_filter_to_code(config, filter_id):
|
||||
# omits `value:`) to avoid the TemplatableFn<float> array + NaN lambda the
|
||||
# generic ValueListFilter path requires. Behavior is identical: NaN sensor
|
||||
# readings always bypass the throttle.
|
||||
if all(isinstance(v, float) and math.isnan(v) for v in values):
|
||||
if values and all(isinstance(v, float) and math.isnan(v) for v in values):
|
||||
filter_id = filter_id.copy()
|
||||
filter_id.type = ThrottleWithPriorityNanFilter
|
||||
return cg.new_Pvariable(filter_id, config[CONF_TIMEOUT])
|
||||
|
||||
Reference in New Issue
Block a user