kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
3k stars 500 forks source link

sensors stop giving readings after an hour or two and wont reinitialize without a power cycle #1350

Closed glass-monkey closed 1 month ago

glass-monkey commented 1 year ago

sensors stop giving readings after a couple hours and wont reinitialize without a power cycle. system is a pi5 running bookworm. Sensors are a bme280 and an scd30 on i2c. everything works fine on power up, after an hour or so readings stop with errors 101 and 110. system restart from within mycodo fails to reinitialize them. power cycle restores functionality

Versions:

mycodo log from the moment it stopped working:

2023-11-06 11:51:47,339 - DEBUG - mycodo.influx - Write point success: b'F,channel=0,device_id=d8859db6-b3ca-417e-b9ac-2a66c64a8f7c value=84.53656\npercent,channel=1,device_id=d8859db6-b3ca-417e-b9ac-2a66c64a8f7c,measure=humidity value=62.87744153238559\nPa,channel=2,device_id=d8859db6-b3ca-417e-b9ac-2a66c64a8f7c,measure=pressure value=101922.23379\nC,channel=3,device_id=d8859db6-b3ca-417e-b9ac-2a66c64a8f7c,measure=dewpoint value=21.38564047683823\nm,channel=4,device_id=d8859db6-b3ca-417e-b9ac-2a66c64a8f7c,measure=altitude value=-49.604\nPa,channel=5,device_id=d8859db6-b3ca-417e-b9ac-2a66c64a8f7c,measure=vapor_pressure_deficit value=1502.8063563004873' 2023-11-06 11:52:02,012 - DEBUG - mycodo.influx - Write point success: b'ppm,channel=0,device_id=2f12c12f-ee51-46e9-ac6b-6e66b0ec30c7,measure=co2 value=829.56640625\nF,channel=1,device_id=2f12c12f-ee51-46e9-ac6b-6e66b0ec30c7 value=87.60334\npercent,channel=2,device_id=2f12c12f-ee51-46e9-ac6b-6e66b0ec30c7,measure=humidity value=59.2681884765625\nF,channel=3,device_id=2f12c12f-ee51-46e9-ac6b-6e66b0ec30c7 value=71.63462\nPa,channel=4,device_id=2f12c12f-ee51-46e9-ac6b-6e66b0ec30c7,measure=vapor_pressure_deficit value=1818.1372211638372'

stops working here

2023-11-06 11:52:03,278 - ERROR - mycodo.inputs.bme280_rpi_bme280_d8859db6 - TimeoutError: [Errno 110] Connection timed out 2023-11-06 11:52:17,806 - ERROR - mycodo.inputs.scd30_2f12c12f - TimeoutError: [Errno 110] Connection timed out 2023-11-06 11:52:18,830 - ERROR - mycodo.inputs.bme280_rpi_bme280_d8859db6 - TimeoutError: [Errno 110] Connection timed out 2023-11-06 11:52:32,846 - ERROR - mycodo.inputs.scd30_2f12c12f - TimeoutError: [Errno 110] Connection timed out

mycodo log from when i try to restart from within mycodo:

2023-11-06 14:26:18,894 - ERROR - mycodo.controllers.controller_input_d8859db6 - StopIteration raised 3 times. Possibly could not read input. Ensure it's connected properly and detected. 2023-11-06 14:26:32,910 - ERROR - mycodo.inputs.scd30_2f12c12f - TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:26:32,910 - ERROR - mycodo.controllers.controller_input_2f12c12f - StopIteration raised 3 times. Possibly could not read input. Ensure it's connected properly and detected. 2023-11-06 14:26:33,934 - ERROR - mycodo.inputs.bme280_rpi_bme280_d8859db6 - TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:26:45,218 - INFO - mycodo.controllers.controller_input_2f12c12f - Deactivated in 17.0 ms 2023-11-06 14:26:45,218 - DEBUG - mycodo - Input controller with ID 2f12c12f-ee51-46e9-ac6b-6e66b0ec30c7 deactivated. 2023-11-06 14:26:47,144 - INFO - mycodo.controllers.controller_input_d8859db6 - Deactivated in 59.9 ms 2023-11-06 14:26:47,144 - DEBUG - mycodo - Input controller with ID d8859db6-b3ca-417e-b9ac-2a66c64a8f7c deactivated. 2023-11-06 14:26:50,766 - ERROR - mycodo.inputs.scd30_2f12c12f - Error initializing, trying again in 5 seconds: [Errno 110] Connection timed out Traceback (most recent call last): File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize self.initialize() File "/home/myco/Mycodo/mycodo/inputs/scd30.py", line 113, in initialize self.sensor.set_auto_self_calibration(self.enable_self_calibration) File "/var/mycodo-root/env/lib/python3.11/site-packages/scd30_i2c/init.py", line 262, in set_auto_self_calibration self._send_command(0x5306, num_response_words=0, arguments=[arg]) File "/var/mycodo-root/env/lib/python3.11/site-packages/scd30_i2c/init.py", line 122, in _send_command self._i2c.i2c_rdwr(write_txn) File "/var/mycodo-root/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 637, in i2c_rdwr ioctl(self.fd, I2C_RDWR, ioctl_data) TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:26:56,782 - ERROR - mycodo.inputs.scd30_2f12c12f - Error initializing, trying again in 5 seconds: [Errno 110] Connection timed out Traceback (most recent call last): File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize self.initialize() File "/home/myco/Mycodo/mycodo/inputs/scd30.py", line 113, in initialize self.sensor.set_auto_self_calibration(self.enable_self_calibration) File "/var/mycodo-root/env/lib/python3.11/site-packages/scd30_i2c/init.py", line 262, in set_auto_self_calibration self._send_command(0x5306, num_response_words=0, arguments=[arg]) File "/var/mycodo-root/env/lib/python3.11/site-packages/scd30_i2c/init.py", line 122, in _send_command self._i2c.i2c_rdwr(write_txn) File "/var/mycodo-root/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 637, in i2c_rdwr ioctl(self.fd, I2C_RDWR, ioctl_data) TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:27:02,798 - ERROR - mycodo.inputs.scd30_2f12c12f - Initialization errored 3 times; giving up. Maybe the following traceback can help diagnose the issue. Traceback (most recent call last): File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize self.initialize() File "/home/myco/Mycodo/mycodo/inputs/scd30.py", line 113, in initialize self.sensor.set_auto_self_calibration(self.enable_self_calibration) File "/var/mycodo-root/env/lib/python3.11/site-packages/scd30_i2c/init.py", line 262, in set_auto_self_calibration self._send_command(0x5306, num_response_words=0, arguments=[arg]) File "/var/mycodo-root/env/lib/python3.11/site-packages/scd30_i2c/init.py", line 122, in _send_command self._i2c.i2c_rdwr(write_txn) File "/var/mycodo-root/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 637, in i2c_rdwr ioctl(self.fd, I2C_RDWR, ioctl_data) TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:27:02,799 - INFO - mycodo.controllers.controller_input_2f12c12f - Activated in 13245.9 ms 2023-11-06 14:27:02,799 - DEBUG - mycodo - Input controller with ID 2f12c12f-ee51-46e9-ac6b-6e66b0ec30c7 activated. 2023-11-06 14:27:03,822 - ERROR - mycodo.inputs.scd30_2f12c12f - TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:27:05,550 - ERROR - mycodo.inputs.bme280_rpi_bme280_d8859db6 - Error initializing, trying again in 5 seconds: [Errno 110] Connection timed out Traceback (most recent call last): File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize self.initialize() File "/home/myco/Mycodo/mycodo/inputs/bme280_rpi_bme280.py", line 98, in initialize self.calibration_params = bme280.load_calibration_params(self.bus, self.i2c_address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme280/init.py", line 153, in load_calibration_params compensation_params.dig_T1 = read.unsigned_short(0x88) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme280/reader.py", line 40, in unsigned_short return self._bus.read_word_data(self._address, register) & 0xffff ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 453, in read_word_data ioctl(self.fd, I2C_SMBUS, msg) TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:27:06,574 - ERROR - mycodo.inputs.scd30_2f12c12f - TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:27:11,566 - ERROR - mycodo.inputs.bme280_rpi_bme280_d8859db6 - Error initializing, trying again in 5 seconds: [Errno 110] Connection timed out Traceback (most recent call last): File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize self.initialize() File "/home/myco/Mycodo/mycodo/inputs/bme280_rpi_bme280.py", line 98, in initialize self.calibration_params = bme280.load_calibration_params(self.bus, self.i2c_address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme280/init.py", line 153, in load_calibration_params compensation_params.dig_T1 = read.unsigned_short(0x88) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme280/reader.py", line 40, in unsigned_short return self._bus.read_word_data(self._address, register) & 0xffff ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 453, in read_word_data ioctl(self.fd, I2C_SMBUS, msg) TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:27:17,582 - ERROR - mycodo.inputs.bme280_rpi_bme280_d8859db6 - Initialization errored 3 times; giving up. Maybe the following traceback can help diagnose the issue. Traceback (most recent call last): File "/var/mycodo-root/mycodo/abstract_base_controller.py", line 57, in try_initialize self.initialize() File "/home/myco/Mycodo/mycodo/inputs/bme280_rpi_bme280.py", line 98, in initialize self.calibration_params = bme280.load_calibration_params(self.bus, self.i2c_address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme280/init.py", line 153, in load_calibration_params compensation_params.dig_T1 = read.unsigned_short(0x88) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/bme280/reader.py", line 40, in unsigned_short return self._bus.read_word_data(self._address, register) & 0xffff ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/mycodo-root/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 453, in read_word_data ioctl(self.fd, I2C_SMBUS, msg) TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:27:17,583 - INFO - mycodo.controllers.controller_input_d8859db6 - Activated in 13108.5 ms 2023-11-06 14:27:17,583 - ERROR - mycodo.inputs.bme280_rpi_bme280_d8859db6 - Error 101: Device not set up. See https://kizniche.github.io/Mycodo/Error-Codes#error-101 for more info. 2023-11-06 14:27:17,583 - DEBUG - mycodo - Input controller with ID d8859db6-b3ca-417e-b9ac-2a66c64a8f7c activated. 2023-11-06 14:27:19,584 - ERROR - mycodo.inputs.bme280_rpi_bme280_d8859db6 - Error 101: Device not set up. See https://kizniche.github.io/Mycodo/Error-Codes#error-101 for more info. 2023-11-06 14:27:20,814 - ERROR - mycodo.inputs.scd30_2f12c12f - TimeoutError: [Errno 110] Connection timed out 2023-11-06 14:27:20,814 - ERROR - mycodo.controllers.controller_input_2f12c12f - StopIteration raised 3 times. Possibly could not read input. Ensure it's connected properly and detected.

kizniche commented 1 year ago

This issue has been mentioned on Radical DIY Forum. There might be relevant details there:

https://forum.radicaldiy.com/t/sensors-stop-giving-readings-after-an-hour-or-so-wont-reinitialize/1682/1

kizniche commented 1 year ago

Have you disconnected all devices and connected each device by itself on the shortest wires possible?