Guard IPP against negative ink levels (#33931)

This commit is contained in:
Chris Talkington 2020-04-09 19:44:04 -05:00 committed by Paulus Schoutsen
parent 3100e852ce
commit 8259a5a71f

View file

@ -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):