mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 22:07:10 +00:00
Guard IPP against negative ink levels (#33931)
This commit is contained in:
parent
a000af5c03
commit
2edfa82237
@ -116,7 +116,12 @@ class IPPMarkerSensor(IPPSensor):
|
|||||||
@property
|
@property
|
||||||
def state(self) -> Union[None, str, int, float]:
|
def state(self) -> Union[None, str, int, float]:
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return self.coordinator.data.markers[self.marker_index].level
|
level = self.coordinator.data.markers[self.marker_index].level
|
||||||
|
|
||||||
|
if level >= 0:
|
||||||
|
return level
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class IPPPrinterSensor(IPPSensor):
|
class IPPPrinterSensor(IPPSensor):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user