diff --git a/esphome/components/ain4_20ma/ain4_20ma.cpp b/esphome/components/ain4_20ma/ain4_20ma.cpp index 754f7c4ca7..106001adf4 100644 --- a/esphome/components/ain4_20ma/ain4_20ma.cpp +++ b/esphome/components/ain4_20ma/ain4_20ma.cpp @@ -1,6 +1,5 @@ #include "ain4_20ma.h" #include "esphome/core/log.h" -#include "esphome/components/i2c/i2c_bus.h" namespace esphome { namespace ain4_20ma { @@ -17,8 +16,8 @@ void Ain4_20maComponent::dump_config() { void Ain4_20maComponent::update() { uint8_t data[2]; - i2c::I2CDevice::ErrorCode err = this->read_register(0x20, ¤t, 2, true); - if (err != i2c::I2CDevice::ERROR_OK) { + i2c::ErrorCode err = this->read_register(0x20, ¤t, 2, true); + if (err != i2c::ERROR_OK) { ESP_LOGE(TAG, "Error reading data from AIN4-20mA"); this->publish_state(NAN); } else { diff --git a/esphome/components/ain4_20ma/ain4_20ma.h b/esphome/components/ain4_20ma/ain4_20ma.h index 5d1a873cea..88cf534048 100644 --- a/esphome/components/ain4_20ma/ain4_20ma.h +++ b/esphome/components/ain4_20ma/ain4_20ma.h @@ -16,5 +16,5 @@ class Ain4_20maComponent : public i2c::I2CDevice, public PollingComponent, publi void update() override; }; -} // namespace ain4_20ma +} // namespace ain4_20ma } // namespace esphome