mirror of
https://github.com/esphome/esphome.git
synced 2025-01-19 04:20:56 +00:00
Improve SHT3xD reconnect handling (#675)
* Add support for Sensirion STS3x Temperature sensors * Removed humidty reading from STS3x sensor * Fixed line error and operand error * Fixed syntax * Add test snippet for STS3x sensor * Clean up * #550 Fix STH3x component reporting WARNING status and reinitialzing the sensor upon reconnecting. * #550 Fix lint issues * Delete __init__.py * Delete sensor.py * Delete sts3x.cpp * Delete sts3x.h * Delete test1.yaml * Revert "Delete test1.yaml" This reverts commit 33e69fb703d9e97d6308ab7d93bf22494e7b1a5b. * Removed leaked STS3x changes from test
This commit is contained in:
parent
b2388b6fe7
commit
0eadda77b0
@ -43,8 +43,14 @@ void SHT3XDComponent::dump_config() {
|
||||
}
|
||||
float SHT3XDComponent::get_setup_priority() const { return setup_priority::DATA; }
|
||||
void SHT3XDComponent::update() {
|
||||
if (!this->write_command_(SHT3XD_COMMAND_POLLING_H))
|
||||
if (this->status_has_warning()) {
|
||||
ESP_LOGD(TAG, "Retrying to reconnect the sensor.");
|
||||
this->write_command_(SHT3XD_COMMAND_SOFT_RESET);
|
||||
}
|
||||
if (!this->write_command_(SHT3XD_COMMAND_POLLING_H)) {
|
||||
this->status_set_warning();
|
||||
return;
|
||||
}
|
||||
|
||||
this->set_timeout(50, [this]() {
|
||||
uint16_t raw_data[2];
|
||||
|
Loading…
x
Reference in New Issue
Block a user