mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Properly handle thresholds of zero (#12175)
Explicitly test for thresholds to be None rather than truth value testing (which for number types returns False for zero values).
This commit is contained in:
committed by
Paulus Schoutsen
parent
0fd17a7c35
commit
844337ca42
@@ -126,11 +126,12 @@ class ThresholdSensor(BinarySensorDevice):
|
||||
@property
|
||||
def threshold_type(self):
|
||||
"""Return the type of threshold this sensor represents."""
|
||||
if self._threshold_lower and self._threshold_upper:
|
||||
if self._threshold_lower is not None and \
|
||||
self._threshold_upper is not None:
|
||||
return TYPE_RANGE
|
||||
elif self._threshold_lower:
|
||||
elif self._threshold_lower is not None:
|
||||
return TYPE_LOWER
|
||||
elif self._threshold_upper:
|
||||
elif self._threshold_upper is not None:
|
||||
return TYPE_UPPER
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user