sighmon/enviroplus_exporter

Handle ValueError from get_gas()

sighmon opened this issue · 0 comments

  • Handle ValueError
04.03.21 18:06:02 (+1030)  main  Traceback (most recent call last):
04.03.21 18:06:02 (+1030)  main    File "enviroplus_exporter.py", line 506, in <module>
04.03.21 18:06:02 (+1030)  main      get_gas()
04.03.21 18:06:02 (+1030)  main    File "enviroplus_exporter.py", line 165, in get_gas
04.03.21 18:06:02 (+1030)  main      readings = gas.read_all()
04.03.21 18:06:02 (+1030)  main    File "/usr/local/lib/python3.7/site-packages/enviroplus/gas.py", line 80, in read_all
04.03.21 18:06:02 (+1030)  main      ox = adc.get_voltage('in0/gnd')
04.03.21 18:06:03 (+1030)  main    File "/usr/local/lib/python3.7/site-packages/ads1015/__init__.py", line 258, in get_voltage
04.03.21 18:06:03 (+1030)  main      self.wait_for_conversion()
04.03.21 18:06:03 (+1030)  main    File "/usr/local/lib/python3.7/site-packages/ads1015/__init__.py", line 243, in wait_for_conversion
04.03.21 18:06:03 (+1030)  main      while not self.conversion_ready():
04.03.21 18:06:03 (+1030)  main    File "/usr/local/lib/python3.7/site-packages/ads1015/__init__.py", line 112, in conversion_ready
04.03.21 18:06:03 (+1030)  main      return self.get_status() != 'active'
04.03.21 18:06:03 (+1030)  main    File "/usr/local/lib/python3.7/site-packages/ads1015/__init__.py", line 128, in get_status
04.03.21 18:06:03 (+1030)  main      return self._ads1015.get('CONFIG').operational_status
04.03.21 18:06:03 (+1030)  main    File "/usr/local/lib/python3.7/site-packages/i2cdevice/__init__.py", line 232, in get
04.03.21 18:06:03 (+1030)  main      result[field] = self.get_field(register, field)
04.03.21 18:06:03 (+1030)  main    File "/usr/local/lib/python3.7/site-packages/i2cdevice/__init__.py", line 247, in get_field
04.03.21 18:06:03 (+1030)  main      value = field.adapter._decode(value)
04.03.21 18:06:03 (+1030)  main    File "/usr/local/lib/python3.7/site-packages/i2cdevice/adapter.py", line 26, in _decode
04.03.21 18:06:03 (+1030)  main      raise ValueError("{} not in lookup table".format(value))
04.03.21 18:06:03 (+1030)  main  ValueError: 7 not in lookup table
04.03.21 19:19:26 (+1030)  main  2021-03-04 08:49:26.653 WARNING  Exception sending to InfluxDB: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))