Avoid rare crash when saving average temps
This commit is contained in:
parent
3b640ac85b
commit
1f1fdfc738
1 changed files with 9 additions and 1 deletions
|
|
@ -158,7 +158,15 @@ class Sensors():
|
||||||
for sources in adapters.values():
|
for sources in adapters.values():
|
||||||
for source_data in sources.values():
|
for source_data in sources.values():
|
||||||
temps = source_data['Temps']
|
temps = source_data['Temps']
|
||||||
|
try:
|
||||||
source_data[temp_label] = sum(temps) / len(temps)
|
source_data[temp_label] = sum(temps) / len(temps)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
# Going to use unrealistic 0°C instead
|
||||||
|
LOG.error(
|
||||||
|
'No temps saved for %s',
|
||||||
|
source_data.get('label', 'UNKNOWN'),
|
||||||
|
)
|
||||||
|
source_data[temp_label] = 0
|
||||||
|
|
||||||
def start_background_monitor(
|
def start_background_monitor(
|
||||||
self, out_path,
|
self, out_path,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue