From 3f2d9abfe6434cfbfc32a8b7de7c100acb95b6ae Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Sat, 9 Oct 2021 01:30:21 -0700 Subject: [PATCH] Correct I2C read() return val check in bh1750 component. (#2465) Co-authored-by: Maurice Makaay --- esphome/components/bh1750/bh1750.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/bh1750/bh1750.cpp b/esphome/components/bh1750/bh1750.cpp index 3645a45bf9..951fe3670c 100644 --- a/esphome/components/bh1750/bh1750.cpp +++ b/esphome/components/bh1750/bh1750.cpp @@ -71,7 +71,7 @@ void BH1750Sensor::update() { float BH1750Sensor::get_setup_priority() const { return setup_priority::DATA; } void BH1750Sensor::read_data_() { uint16_t raw_value; - if (!this->read(reinterpret_cast(&raw_value), 2)) { + if (this->read(reinterpret_cast(&raw_value), 2) != i2c::ERROR_OK) { this->status_set_warning(); return; }