[sgp30] Set default update interval to 60s (#7952)

This commit is contained in:
Jesse Hills 2024-12-12 22:37:51 +13:00
parent 4e1ff31342
commit 0fbe6c0d8b
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
2 changed files with 11 additions and 16 deletions

View file

@ -1,23 +1,22 @@
import esphome.codegen as cg import esphome.codegen as cg
from esphome.components import i2c, sensirion_common, sensor
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.components import i2c, sensor, sensirion_common
from esphome.const import ( from esphome.const import (
CONF_COMPENSATION,
CONF_ID,
CONF_BASELINE, CONF_BASELINE,
CONF_COMPENSATION,
CONF_ECO2, CONF_ECO2,
CONF_ID,
CONF_STORE_BASELINE, CONF_STORE_BASELINE,
CONF_TEMPERATURE_SOURCE, CONF_TEMPERATURE_SOURCE,
CONF_TVOC, CONF_TVOC,
ICON_RADIATOR,
DEVICE_CLASS_CARBON_DIOXIDE, DEVICE_CLASS_CARBON_DIOXIDE,
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS, DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS,
STATE_CLASS_MEASUREMENT,
UNIT_PARTS_PER_MILLION,
UNIT_PARTS_PER_BILLION,
ICON_MOLECULE_CO2,
ENTITY_CATEGORY_DIAGNOSTIC, ENTITY_CATEGORY_DIAGNOSTIC,
ICON_MOLECULE_CO2,
ICON_RADIATOR,
STATE_CLASS_MEASUREMENT,
UNIT_PARTS_PER_BILLION,
UNIT_PARTS_PER_MILLION,
) )
DEPENDENCIES = ["i2c"] DEPENDENCIES = ["i2c"]
@ -77,7 +76,7 @@ CONFIG_SCHEMA = (
), ),
} }
) )
.extend(cv.polling_component_schema("1s")) .extend(cv.polling_component_schema("60s"))
.extend(i2c.i2c_device_schema(0x58)) .extend(i2c.i2c_device_schema(0x58))
) )

View file

@ -1,8 +1,8 @@
#include "sgp30.h" #include "sgp30.h"
#include <cinttypes>
#include "esphome/core/application.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/application.h"
#include <cinttypes>
namespace esphome { namespace esphome {
namespace sgp30 { namespace sgp30 {
@ -295,10 +295,6 @@ void SGP30Component::update() {
if (this->tvoc_sensor_ != nullptr) if (this->tvoc_sensor_ != nullptr)
this->tvoc_sensor_->publish_state(tvoc); this->tvoc_sensor_->publish_state(tvoc);
if (this->get_update_interval() != 1000) {
ESP_LOGW(TAG, "Update interval for SGP30 sensor must be set to 1s for optimized readout");
}
this->status_clear_warning(); this->status_clear_warning();
this->send_env_data_(); this->send_env_data_();
this->read_iaq_baseline_(); this->read_iaq_baseline_();