esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
292 stars 36 forks source link

SCD30 ignoring update_interval #2870

Open marcofl opened 2 years ago

marcofl commented 2 years ago

The problem

It seems that https://github.com/esphome/esphome/pull/2308 broke update_interval for the SCD30. The interval is written to the SCD30 sensor, but it doesn't have an effect on how often the sensor is read. It seems that this change initially worked, or it depends on the firmware of SCD30 (my SCD30 Firmware v3.66) - I don't know how to verify this. It does not work for my SCD30s, and I've multiple of them.

The data sheet of the sensor doesn't say that you can't read the sensor faster than the configured update interval. I think the update interval of the sensor is more like "this is when I have valid data ready".

So as the component is no longer a PollingComponent, updating happens as quickly as possible, which is 2s (as this is the minimum interval of the sensor).

I'm very new to ESPHome, but my best guess is, that this should actually be a PollingComponent, as we need to schedule updates according to update_interval.

Overall, this doesn't seem to be a big issue, but it feels wrong:

I'm happy to help with testing.

Which version of ESPHome has the issue?

2021.12.2

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP32

Board

wemos_d1_mini32

Component causing the issue

scd30

Example YAML snippet

i2c:
sensor:
  - platform: scd30
    co2:
      name: "Office CO2"
      accuracy_decimals: 0
    temperature:
      name: "Office Temperature"
      accuracy_decimals: 1
    humidity:
      name: "Office Humidity"
      accuracy_decimals: 0
    update_interval: 5s
    automatic_self_calibration: false

Anything in the logs that might be useful for us?

[11:46:22][D][scd30:187]: Got CO2=784.98ppm temperature=28.22°C humidity=22.87%
[11:46:22][D][sensor:113]: 'Office CO2': Sending state 784.98077 ppm with 0 decimals of accuracy
[11:46:22][D][sensor:113]: 'Office Temperature': Sending state 28.21774 °C with 1 decimals of accuracy
[11:46:22][D][sensor:113]: 'Office Humidity': Sending state 22.86530 % with 0 decimals of accuracy
[11:46:25][D][scd30:187]: Got CO2=789.33ppm temperature=28.20°C humidity=22.82%
[11:46:25][D][sensor:113]: 'Office CO2': Sending state 789.32886 ppm with 0 decimals of accuracy
[11:46:25][D][sensor:113]: 'Office Temperature': Sending state 28.20439 °C with 1 decimals of accuracy
[11:46:25][D][sensor:113]: 'Office Humidity': Sending state 22.81952 % with 0 decimals of accuracy
[11:46:27][D][scd30:187]: Got CO2=786.83ppm temperature=28.26°C humidity=22.85%
[11:46:27][D][sensor:113]: 'Office CO2': Sending state 786.83038 ppm with 0 decimals of accuracy
[11:46:27][D][sensor:113]: 'Office Temperature': Sending state 28.26048 °C with 1 decimals of accuracy
[11:46:27][D][sensor:113]: 'Office Humidity': Sending state 22.85156 % with 0 decimals of accuracy
[11:46:29][D][scd30:187]: Got CO2=776.98ppm temperature=28.27°C humidity=22.87%
[11:46:29][D][sensor:113]: 'Office CO2': Sending state 776.98114 ppm with 0 decimals of accuracy
[11:46:29][D][sensor:113]: 'Office Temperature': Sending state 28.27383 °C with 1 decimals of accuracy
[11:46:29][D][sensor:113]: 'Office Humidity': Sending state 22.86987 % with 0 decimals of accuracy
[11:46:32][D][scd30:187]: Got CO2=750.66ppm temperature=28.35°C humidity=22.61%
[11:46:32][D][sensor:113]: 'Office CO2': Sending state 750.66168 ppm with 0 decimals of accuracy
[11:46:32][D][sensor:113]: 'Office Temperature': Sending state 28.34859 °C with 1 decimals of accuracy
[11:46:32][D][sensor:113]: 'Office Humidity': Sending state 22.60590 % with 0 decimals of accuracy

Additional information

No response

yazz007 commented 2 days ago

Hi, this is still an issue for me, could you please add the SCD30 component to PollingComponent