Guard IPP against negative ink levels (#33931)
This commit is contained in:
parent
3100e852ce
commit
8259a5a71f
1 changed files with 6 additions and 1 deletions
|
@ -116,7 +116,12 @@ class IPPMarkerSensor(IPPSensor):
|
|||
@property
|
||||
def state(self) -> Union[None, str, int, float]:
|
||||
"""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):
|
||||
|
|
Loading…
Add table
Reference in a new issue