ayeks / bme680_to_influxdb

Simple script that sends your BME680 temp, pressure, humidity and gas sensor data to InfluxDB.
MIT License
23 stars 16 forks source link

senddata.py crashes after a while #13

Closed romton843 closed 3 years ago

romton843 commented 3 years ago

Hi, thank you for your nice work. After running for a while (I did several tries for a little more than an hour), senddata.py crashes and gives me this message: Error: .get_sensor_data() or heat_stable failed. Then I have to type the command again and wait for the gas resistance burn-in data. Does anyone know where this error comes from and if there is a way to avoid it to prevent the crash? Would it be possible to acknowledge the error but to avoid the crash? Or to automatically start it again when it crashes and maybe avoid the burn-in process again? Best regards and happy new year. Romain

romton843 commented 3 years ago

Hi, I created a service (systemd) which restarts automatically which sort of fixes my issue. However it's still stopping every now and then and the restart process creates some fluctuations in the readings of the temperature and humidity and IAQ of course. Let me know how I can help diagnose the issue. Best regards. Romain

ayeks commented 3 years ago

Hey @romton843,

thanks for raising the issue. I did not experience the issue myself.

I let the program fail with this error when sensor.get_sensor_data() returns not true. You could wait some seconds and try to get the sensor data a second time to fix this problem. To do so, just try to get the sensor data - store the result in a variable, and try to get the sensor data a second time if the first time failed. If the result is okay, then proceed with the analysis.

Feel free to push a pull request when you implemented it. I do not have the setup running, so I cannot test it myself.

Cheers Lars

romton843 commented 3 years ago

Hi, Thank you for your answer. I added five attempts before breaking in case of an get_sensor_data() failure. I hope you'll be ok with the way I did it. So far it's working, I'll let you know if the the problem reappears which shouldn't be the case. Thanks again for your work. Best regards. Romain