temperature_sensor: report min/max measured temp via get_status
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
d37374974d
commit
3143e31aca
|
@ -19,12 +19,21 @@ class PrinterSensorGeneric:
|
||||||
self.sensor.setup_callback(self.temperature_callback)
|
self.sensor.setup_callback(self.temperature_callback)
|
||||||
pheaters.register_sensor(config, self)
|
pheaters.register_sensor(config, self)
|
||||||
self.last_temp = 0.
|
self.last_temp = 0.
|
||||||
|
self.measured_min = 99999999.
|
||||||
|
self.measured_max = 0.
|
||||||
def temperature_callback(self, read_time, temp):
|
def temperature_callback(self, read_time, temp):
|
||||||
self.last_temp = temp
|
self.last_temp = temp
|
||||||
|
if temp:
|
||||||
|
self.measured_min = min(self.measured_min, temp)
|
||||||
|
self.measured_max = max(self.measured_max, temp)
|
||||||
def get_temp(self, eventtime):
|
def get_temp(self, eventtime):
|
||||||
return self.last_temp, 0.
|
return self.last_temp, 0.
|
||||||
def get_status(self, eventtime):
|
def get_status(self, eventtime):
|
||||||
return {'temperature': self.last_temp}
|
return {
|
||||||
|
'temperature': self.last_temp,
|
||||||
|
'measured_min_temp': self.measured_min,
|
||||||
|
'measured_max_temp': self.measured_max
|
||||||
|
}
|
||||||
|
|
||||||
def load_config_prefix(config):
|
def load_config_prefix(config):
|
||||||
return PrinterSensorGeneric(config)
|
return PrinterSensorGeneric(config)
|
||||||
|
|
Loading…
Reference in New Issue