1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 07:08:20 +00:00
This commit is contained in:
valordk 2019-08-03 17:56:12 +02:00
parent 7c90da0255
commit 9245af7a1b
2 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ CONF_UPTIME = 'uptime'
CONFIG_SCHEMA = cv.Schema({ CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(SGP30Component), cv.GenerateID(): cv.declare_id(SGP30Component),
cv.Required(CONF_ECO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, \ cv.Required(CONF_ECO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION,
ICON_PERIODIC_TABLE_CO2, 0), ICON_PERIODIC_TABLE_CO2, 0),
cv.Required(CONF_TVOC): sensor.sensor_schema(UNIT_PARTS_PER_BILLION, ICON_RADIATOR, 0), cv.Required(CONF_TVOC): sensor.sensor_schema(UNIT_PARTS_PER_BILLION, ICON_RADIATOR, 0),
cv.Optional(CONF_BASELINE): cv.hex_uint16_t, cv.Optional(CONF_BASELINE): cv.hex_uint16_t,

View File

@ -106,13 +106,13 @@ void SGP30Component::read_iaq_baseline(){
uint8_t eco2baseline = (raw_data[0]); uint8_t eco2baseline = (raw_data[0]);
uint8_t tvocbaseline = (raw_data[1]); uint8_t tvocbaseline = (raw_data[1]);
ESP_LOGI(TAG, "Current eCO2 & TVOC baseline: 0x%04X", \ ESP_LOGI(TAG, "Current eCO2 & TVOC baseline: 0x%04X",
uint16_t((eco2baseline << 8) | (tvocbaseline & 0xFF))); uint16_t((eco2baseline << 8) | (tvocbaseline & 0xFF)));
this->status_clear_warning(); this->status_clear_warning();
}); });
} else { } else {
if (!isnan(id(uptime_sensor_).state)) if (!isnan(id(uptime_sensor_).state))
ESP_LOGD(TAG, "Baseline reading not available for: %.0fs", \ ESP_LOGD(TAG, "Baseline reading not available for: %.0fs",
(this->required_warm_up_time - id(uptime_sensor_).state)); (this->required_warm_up_time - id(uptime_sensor_).state));
} }
} }
@ -197,7 +197,7 @@ void SGP30Component::dump_config() {
} }
} else { } else {
ESP_LOGCONFIG(TAG, " Serial number: %llu", this->serial_number_); ESP_LOGCONFIG(TAG, " Serial number: %llu", this->serial_number_);
ESP_LOGCONFIG(TAG, " Baseline: 0x%04X%s", this->baseline_, \ ESP_LOGCONFIG(TAG, " Baseline: 0x%04X%s", this->baseline_,
((this->baseline_ != 0x0000) ? " (enabled)":" (disabled)")); ((this->baseline_ != 0x0000) ? " (enabled)":" (disabled)"));
ESP_LOGCONFIG(TAG, " Warm up time: %lds", this->required_warm_up_time); ESP_LOGCONFIG(TAG, " Warm up time: %lds", this->required_warm_up_time);
} }