1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 15:18:16 +00:00

#550 Proactive fix for STS3x component reporting WARNING status and reinitialzing similar to SHT3xd

This commit is contained in:
valordk 2019-07-26 02:38:09 +02:00
parent 584b7fef69
commit 4ac8ec255e

View File

@ -42,8 +42,14 @@ void STS3XComponent::dump_config() {
}
float STS3XComponent::get_setup_priority() const { return setup_priority::DATA; }
void STS3XComponent::update() {
if (!this->write_command_(STS3X_COMMAND_POLLING_H))
if (this->status_has_warning()){
ESP_LOGD(TAG, "Retrying to reconnect the sensor.");
this->write_command_(STS3X_COMMAND_SOFT_RESET);
}
if (!this->write_command_(STS3X_COMMAND_POLLING_H)){
this->status_set_warning();
return;
}
this->set_timeout(50, [this]() {
uint16_t raw_data[1];