Skip to content

Commit

Permalink
add formatter for unknown state
Browse files Browse the repository at this point in the history
  • Loading branch information
benbancroft committed Sep 14, 2024
1 parent 31ac99b commit 317c775
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zha/application/platforms/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,12 @@ class Flow(Sensor):
_divisor = 10
_attr_native_unit_of_measurement = UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR

def formatter(self, value: int) -> int | None:
"""Handle unknown value state."""
if value == 0xFFFF:
return None
return super().formatter(value)

Check warning on line 1134 in zha/application/platforms/sensor/__init__.py

View check run for this annotation

Codecov / codecov/patch

zha/application/platforms/sensor/__init__.py#L1132-L1134

Added lines #L1132 - L1134 were not covered by tests


@MULTI_MATCH(cluster_handler_names=CLUSTER_HANDLER_TEMPERATURE)
class Temperature(Sensor):
Expand Down

0 comments on commit 317c775

Please sign in to comment.