balenair iaq container restarting with RuntimeError: CRC check failed while reading data

Hello @alanb128 i found the logs of the errors I got on the balenair running on my Raspberry Pi 4.

12.01.23 11:51:46 (+0000)  dashboard  Waiting for Influx API
12.01.23 11:51:51 (+0000)  dashboard  Waiting for Influx API
12.01.23 11:51:55 (+0000) Restarting service 'iaq sha256:ad2aefed8b09bd203bc9c2bca8738d424f9da81adc4d14a48a2b0f5bd66bbe98'
12.01.23 11:51:56 (+0000)  dashboard  Waiting for Influx API
12.01.23 11:51:57 (+0000)  iaq  log_level: WARNING
12.01.23 11:51:57 (+0000)  iaq  You will see CRITICAL log entries.
12.01.23 11:51:57 (+0000)  iaq  You will see ERROR log entries.
12.01.23 11:51:57 (+0000)  iaq  You will see WARNING log entries.
12.01.23 11:51:57 (+0000)  iaq  Traceback (most recent call last):
12.01.23 11:51:57 (+0000)  iaq    File "iaq.py", line 184, in <module>
12.01.23 11:51:57 (+0000)  iaq      serial_num = [hex(i) for i in scd4x.serial_number]
12.01.23 11:51:57 (+0000)  iaq    File "/usr/local/lib/python3.8/site-packages/adafruit_scd4x.py", line 222, in serial_number
12.01.23 11:51:57 (+0000)  iaq      self._read_reply(self._buffer, 9)
12.01.23 11:51:57 (+0000)  iaq    File "/usr/local/lib/python3.8/site-packages/adafruit_scd4x.py", line 352, in _read_reply
12.01.23 11:51:57 (+0000)  iaq      self._check_buffer_crc(self._buffer[0:num])
12.01.23 11:51:57 (+0000)  iaq    File "/usr/local/lib/python3.8/site-packages/adafruit_scd4x.py", line 322, in _check_buffer_crc
12.01.23 11:51:57 (+0000)  iaq      raise RuntimeError("CRC check failed while reading data")
12.01.23 11:51:57 (+0000)  iaq  RuntimeError: CRC check failed while reading data
12.01.23 11:51:58 (+0000) Service exited 'iaq sha256:ad2aefed8b09bd203bc9c2bca8738d424f9da81adc4d14a48a2b0f5bd66bbe98'

I will research more!

@mpous do you have an SCD-40 attached? If so, this could be an I2C clock speed issue that happens occasionally, and seems more pronounced on Pi 4 (which very few balenAirs run.) See how can I fix this runtime error when doing crc checking python 3 scd-30 co2 Sensor - Stack Overflow for more info.