diff --git a/CODEOWNERS b/CODEOWNERS index d5ce5e6920..3cb38fce06 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -103,6 +103,7 @@ esphome/components/lilygo_t5_47/touchscreen/* @jesserockz esphome/components/lock/* @esphome/core esphome/components/logger/* @esphome/core esphome/components/ltr390/* @sjtrny +esphome/components/max31865/* @DAVe3283 esphome/components/max44009/* @berfenger esphome/components/max7219digit/* @rspaargaren esphome/components/max9611/* @mckaymatthew diff --git a/esphome/components/max31865/max31865.cpp b/esphome/components/max31865/max31865.cpp index 126915dc15..152d7b340b 100644 --- a/esphome/components/max31865/max31865.cpp +++ b/esphome/components/max31865/max31865.cpp @@ -94,6 +94,14 @@ void MAX31865Sensor::read_data_() { const uint16_t rtd_resistance_register = this->read_register_16_(RTD_RESISTANCE_MSB_REG); this->write_config_(0b11000000, 0b00000000); + // Check for bad connection + if (rtd_resistance_register == 0b0000000000000000 || rtd_resistance_register == 0b1111111111111111) { + ESP_LOGE(TAG, "SPI bus read all 0 or all 1 (0x%04X), check MAX31865 wiring & power.", rtd_resistance_register); + this->publish_state(NAN); + this->status_set_error(); + return; + } + // Check faults const uint8_t faults = this->read_register_(FAULT_STATUS_REG); if ((has_fault_ = faults & 0b00111100)) { diff --git a/esphome/components/max31865/sensor.py b/esphome/components/max31865/sensor.py index 6eb8bd400d..704f945171 100644 --- a/esphome/components/max31865/sensor.py +++ b/esphome/components/max31865/sensor.py @@ -11,6 +11,9 @@ from esphome.const import ( UNIT_CELSIUS, ) +CODEOWNERS = ["@DAVe3283"] +DEPENDENCIES = ["spi"] + max31865_ns = cg.esphome_ns.namespace("max31865") MAX31865Sensor = max31865_ns.class_( "MAX31865Sensor", sensor.Sensor, cg.PollingComponent, spi.SPIDevice