diff --git a/esphome/components/i2c/i2c.h b/esphome/components/i2c/i2c.h index 8d8e139c61..15f786245b 100644 --- a/esphome/components/i2c/i2c.h +++ b/esphome/components/i2c/i2c.h @@ -139,6 +139,10 @@ class I2CDevice { /// @param address of the device void set_i2c_address(uint8_t address) { address_ = address; } + /// @brief Returns the I2C address of the object. + /// @return the I2C address + uint8_t get_i2c_address() const { return this->address_; } + /// @brief we store the pointer to the I2CBus to use /// @param bus pointer to the I2CBus object void set_i2c_bus(I2CBus *bus) { bus_ = bus; }