mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 07:58:09 +01:00
Update HLW8032 formatting
This commit is contained in:
parent
746ecc56d1
commit
ebf2eb4fc6
2 changed files with 23 additions and 24 deletions
|
@ -10,7 +10,6 @@ namespace hlw8032 {
|
||||||
static const char *const TAG = "hlw8032";
|
static const char *const TAG = "hlw8032";
|
||||||
|
|
||||||
void HLW8032Component::loop() {
|
void HLW8032Component::loop() {
|
||||||
|
|
||||||
if (!this->available())
|
if (!this->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -112,7 +111,6 @@ void HLW8032Component::parse_data_() {
|
||||||
|
|
||||||
float voltage = 0.0f;
|
float voltage = 0.0f;
|
||||||
if (have_voltage) {
|
if (have_voltage) {
|
||||||
|
|
||||||
voltage = float(voltage_parameter) * this->voltage_divider_ / float(voltage_reg);
|
voltage = float(voltage_parameter) * this->voltage_divider_ / float(voltage_reg);
|
||||||
if (this->voltage_sensor_ != nullptr) {
|
if (this->voltage_sensor_ != nullptr) {
|
||||||
this->voltage_sensor_->publish_state(voltage);
|
this->voltage_sensor_->publish_state(voltage);
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace hlw8032 {
|
||||||
|
|
||||||
class HLW8032Component : public Component, public uart::UARTDevice {
|
class HLW8032Component : public Component, public uart::UARTDevice {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void loop() override;
|
void loop() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
|
|
||||||
|
@ -21,7 +20,9 @@ class HLW8032Component : public Component, public uart::UARTDevice {
|
||||||
void set_voltage_sensor(sensor::Sensor *voltage_sensor) { voltage_sensor_ = voltage_sensor; }
|
void set_voltage_sensor(sensor::Sensor *voltage_sensor) { voltage_sensor_ = voltage_sensor; }
|
||||||
void set_current_sensor(sensor::Sensor *current_sensor) { current_sensor_ = current_sensor; }
|
void set_current_sensor(sensor::Sensor *current_sensor) { current_sensor_ = current_sensor; }
|
||||||
void set_power_sensor(sensor::Sensor *power_sensor) { power_sensor_ = power_sensor; }
|
void set_power_sensor(sensor::Sensor *power_sensor) { power_sensor_ = power_sensor; }
|
||||||
void set_apparent_power_sensor(sensor::Sensor *apparent_power_sensor) { apparent_power_sensor_ = apparent_power_sensor; }
|
void set_apparent_power_sensor(sensor::Sensor *apparent_power_sensor) {
|
||||||
|
apparent_power_sensor_ = apparent_power_sensor;
|
||||||
|
}
|
||||||
void set_power_factor_sensor(sensor::Sensor *power_factor_sensor) { power_factor_sensor_ = power_factor_sensor; }
|
void set_power_factor_sensor(sensor::Sensor *power_factor_sensor) { power_factor_sensor_ = power_factor_sensor; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue