vladak / workmon

Work environment monitoring and alerting
10 stars 0 forks source link

handle failures to read from us100.distance #9

Closed vladak closed 2 years ago

vladak commented 2 years ago

When touching the US-100 sensor by hand I must have accidentally shorted it or caused other kind of trouble because the workmon service was restarted after:

Feb 16 10:27:23 workmon workmon[20386]: Traceback (most recent call last):
Feb 16 10:27:23 workmon workmon[20386]:   File "/srv/workmon/env/bin/workmon", line 11, in <module>
Feb 16 10:27:23 workmon workmon[20386]:     load_entry_point('workmon==0.1', 'console_scripts', 'workmon')()
Feb 16 10:27:23 workmon workmon[20386]:   File "/srv/workmon/env/lib/python3.9/site-packages/workmon-0.1-py3.9.egg/workmon/main.py", line 79, in run_main
Feb 16 10:27:23 workmon workmon[20386]:   File "/srv/workmon/env/lib/python3.9/site-packages/workmon-0.1-py3.9.egg/workmon/main.py", line 65, in main
Feb 16 10:27:23 workmon workmon[20386]:   File "/srv/workmon/env/lib/python3.9/site-packages/workmon-0.1-py3.9.egg/workmon/workmon.py", line 147, in sensor_loop
Feb 16 10:27:23 workmon workmon[20386]:   File "/srv/workmon/env/lib/python3.9/site-packages/workmon-0.1-py3.9.egg/workmon/workmon.py", line 92, in get_sensor_values
Feb 16 10:27:23 workmon workmon[20386]:   File "/srv/workmon/env/lib/python3.9/site-packages/workmon-0.1-py3.9.egg/workmon/table.py", line 47, in is_up
Feb 16 10:27:23 workmon workmon[20386]: TypeError: '>' not supported between instances of 'NoneType' and 'int'

The failure should be handled gracefully.