Make dummy probe use tighter pattern for random readings
to make for a more reasonable-looking graph
This commit is contained in:
parent
44d012b3fd
commit
1f8507508a
2 changed files with 23 additions and 1 deletions
|
@ -181,7 +181,18 @@ class TempmonClient(Daemon):
|
|||
return therm_file.readlines()
|
||||
|
||||
def random_temp(self, probe):
|
||||
temp = random.uniform(probe.critical_temp_min - 5, probe.critical_temp_max + 5)
|
||||
last_reading = probe.last_reading()
|
||||
if last_reading:
|
||||
volatility = 2
|
||||
# try to keep somewhat of a tight pattern, so graphs look reasonable
|
||||
last_degrees = float(last_reading.degrees_f)
|
||||
temp = random.uniform(last_degrees - volatility * 3, last_degrees + volatility * 3)
|
||||
if temp > (probe.critical_temp_max + volatility * 2):
|
||||
temp -= volatility
|
||||
elif temp < (probe.critical_temp_min - volatility * 2):
|
||||
temp += volatility
|
||||
else:
|
||||
temp = random.uniform(probe.critical_temp_min - 5, probe.critical_temp_max + 5)
|
||||
return round(temp, 4)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue