mqtt-io: 1Wire Sensor IndexError: list index out of range

We are use an RPi Zero and get often this index error

 Jan 23 14:26:55 serverraum python[18640]: Exception in thread pi-mqtt-gpio_SensorReader:
Jan 23 14:26:55 serverraum python[18640]: Traceback (most recent call last):
Jan 23 14:26:55 serverraum python[18640]:   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
Jan 23 14:26:55 serverraum python[18640]:     self.run()
Jan 23 14:26:55 serverraum python[18640]:   File "/usr/lib/python2.7/threading.py", line 754, in run
Jan 23 14:26:55 serverraum python[18640]:     self.__target(*self.__args, **self.__kwargs)
Jan 23 14:26:55 serverraum python[18640]:   File "/usr/local/lib/python2.7/dist-packages/pi_mqtt_gpio/server.py", line 598, in sensor_timer_thread
Jan 23 14:26:55 serverraum python[18640]:     value = sensor.get_value(sens_conf)
Jan 23 14:26:55 serverraum python[18640]:   File "/usr/local/lib/python2.7/dist-packages/pi_mqtt_gpio/modules/ds18b.py", line 39, in get_value
Jan 23 14:26:55 serverraum python[18640]:     temperature = self.sensor.get_temperature()
Jan 23 14:26:55 serverraum python[18640]:   File "/usr/local/lib/python2.7/dist-packages/w1thermsensor/core.py", line 328, in get_temperature
Jan 23 14:26:55 serverraum python[18640]:     value = self.raw_sensor_count
Jan 23 14:26:55 serverraum python[18640]:   File "/usr/local/lib/python2.7/dist-packages/w1thermsensor/core.py", line 264, in raw_sensor_count
Jan 23 14:26:55 serverraum python[18640]:     bytes = self.raw_sensor_strings[1].split()
Jan 23 14:26:55 serverraum python[18640]:   File "/usr/local/lib/python2.7/dist-packages/w1thermsensor/core.py", line 243, in raw_sensor_strings
Jan 23 14:26:55 serverraum python[18640]:     if data[0].strip()[-3:] != "YES":
Jan 23 14:26:55 serverraum python[18640]: IndexError: list index out of range

it works for a view hours an then this error we get! after the restart the same one!

sometimes it works for 1 hour and other for 6 hours

we have set in the /usr/local/lib/python2.7/dist-packages/w1thermsensor/core.py file the RETRY_DELAY_SECONDS from 1 sec to 2 sec and then to 3 sec !

the result was better but we get then the error later it do not save the problem

Kind regards

Jknill

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Hi, I think this error was already fixed in w1thermsensor. https://github.com/timofurrer/w1thermsensor/issues/96 Maybe you can update your Python bibs?