diff --git a/esphome/components/sen0501/sen0501.cpp b/esphome/components/sen0501/sen0501.cpp index 00b20df71c..62eb767203 100644 --- a/esphome/components/sen0501/sen0501.cpp +++ b/esphome/components/sen0501/sen0501.cpp @@ -1,6 +1,7 @@ #include "sen0501.h" #include "esphome/core/log.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" namespace esphome { namespace sen0501 { @@ -161,7 +162,7 @@ void Sen0501Component::read_atmospheric_pressure_() { this->atmospheric_pressure_->publish_state(atmosphere); if (this->elevation_ == nullptr) return; - float elevation = 44330 * (1.0 - this->pow(atmosphere / 1015.0f, 0.1903)); + float elevation = 44330 * (1.0 - pow(atmosphere / 1015.0f, 0.1903)); this->elevation_->publish_state(elevation); } diff --git a/esphome/components/sen0501/sen0501.h b/esphome/components/sen0501/sen0501.h index b470cda5a4..2d69cae52f 100644 --- a/esphome/components/sen0501/sen0501.h +++ b/esphome/components/sen0501/sen0501.h @@ -16,7 +16,9 @@ class Sen0501Component : public PollingComponent, public i2c::I2CDevice { void set_humidity(sensor::Sensor *humidity) { this->humidity_ = humidity; } void set_uv_intensity(sensor::Sensor *uv_intensity) { this->uv_intensity_ = uv_intensity; } void set_luminous_intensity(sensor::Sensor *luminous_intensity) { this->luminous_intensity_ = luminous_intensity; } - void set_atmospheric_pressure(sensor::Sensor *atmospheric_pressure) { this->atmospheric_pressure_ = atmospheric_pressure; } + void set_atmospheric_pressure(sensor::Sensor *atmospheric_pressure) { + this->atmospheric_pressure_ = atmospheric_pressure; + } void set_elevation(sensor::Sensor *elevation) { this->elevation_ = elevation; } void setup() override; @@ -44,7 +46,7 @@ class Sen0501Component : public PollingComponent, public i2c::I2CDevice { COMMUNICATION_FAILED, WRONG_DEVICE_ID, WRONG_VENDOR_ID, - } this->error_code_{NONE}; + } error_code_{NONE}; }; } // namespace sen0501