try some dedupe

Signed-off-by: Matthew Thode <mthode@mthode.org>
This commit is contained in:
2026-07-11 21:15:52 -05:00
parent 14a7c2ef82
commit d81fb918d0
4 changed files with 45 additions and 136 deletions
+6 -30
View File
@@ -30,24 +30,8 @@ class ATM90E36Component : public PollingComponent,
void set_power_sensor(int phase, sensor::Sensor *obj) { this->phase_[phase].power_sensor_ = obj; }
void set_reactive_power_sensor(int phase, sensor::Sensor *obj) { this->phase_[phase].reactive_power_sensor_ = obj; }
void set_apparent_power_sensor(int phase, sensor::Sensor *obj) { this->phase_[phase].apparent_power_sensor_ = obj; }
void set_thd_voltage_a_sensor(sensor::Sensor *thd_voltage_a_sensor) {
thd_voltage_a_sensor_ = thd_voltage_a_sensor;
}
void set_thd_current_a_sensor(sensor::Sensor *thd_current_a_sensor) {
thd_current_a_sensor_ = thd_current_a_sensor;
}
void set_thd_voltage_b_sensor(sensor::Sensor *thd_voltage_b_sensor) {
thd_voltage_b_sensor_ = thd_voltage_b_sensor;
}
void set_thd_current_b_sensor(sensor::Sensor *thd_current_b_sensor) {
thd_current_b_sensor_ = thd_current_b_sensor;
}
void set_thd_voltage_c_sensor(sensor::Sensor *thd_voltage_c_sensor) {
thd_voltage_c_sensor_ = thd_voltage_c_sensor;
}
void set_thd_current_c_sensor(sensor::Sensor *thd_current_c_sensor) {
thd_current_c_sensor_ = thd_current_c_sensor;
}
void set_thd_voltage_sensor(int phase, sensor::Sensor *obj) { this->phase_[phase].thd_voltage_sensor_ = obj; }
void set_thd_current_sensor(int phase, sensor::Sensor *obj) { this->phase_[phase].thd_current_sensor_ = obj; }
void set_forward_active_energy_sensor(int phase, sensor::Sensor *obj) {
this->phase_[phase].forward_active_energy_sensor_ = obj;
}
@@ -122,6 +106,8 @@ class ATM90E36Component : public PollingComponent,
float get_local_phase_reverse_active_energy_(uint8_t phase);
float get_local_phase_angle_(uint8_t phase);
float get_local_phase_harmonic_active_power_(uint8_t phase);
float get_local_phase_thd_voltage_(uint8_t phase);
float get_local_phase_thd_current_(uint8_t phase);
float get_phase_voltage_(uint8_t phase);
float get_phase_voltage_avg_(uint8_t phase);
float get_phase_current_(uint8_t phase);
@@ -134,12 +120,6 @@ class ATM90E36Component : public PollingComponent,
float get_phase_reverse_active_energy_(uint8_t phase);
float get_phase_angle_(uint8_t phase);
float get_phase_harmonic_active_power_(uint8_t phase);
float get_thd_voltage_a();
float get_thd_current_a();
float get_thd_voltage_b();
float get_thd_current_b();
float get_thd_voltage_c();
float get_thd_current_c();
float get_frequency_();
float get_chip_temperature_();
bool get_publish_interval_flag_() { return publish_interval_flag_; };
@@ -184,6 +164,8 @@ class ATM90E36Component : public PollingComponent,
sensor::Sensor *reverse_active_energy_sensor_{nullptr};
sensor::Sensor *phase_angle_sensor_{nullptr};
sensor::Sensor *harmonic_active_power_sensor_{nullptr};
sensor::Sensor *thd_voltage_sensor_{nullptr};
sensor::Sensor *thd_current_sensor_{nullptr};
uint32_t cumulative_forward_active_energy_{0};
uint32_t cumulative_reverse_active_energy_{0};
} phase_[3];
@@ -238,12 +220,6 @@ class ATM90E36Component : public PollingComponent,
std::string cs_summary_;
sensor::Sensor *freq_sensor_{nullptr};
sensor::Sensor *thd_voltage_a_sensor_{nullptr};
sensor::Sensor *thd_current_a_sensor_{nullptr};
sensor::Sensor *thd_voltage_b_sensor_{nullptr};
sensor::Sensor *thd_current_b_sensor_{nullptr};
sensor::Sensor *thd_voltage_c_sensor_{nullptr};
sensor::Sensor *thd_current_c_sensor_{nullptr};
#ifdef USE_TEXT_SENSOR
text_sensor::TextSensor *phase_status_text_sensor_{nullptr};
text_sensor::TextSensor *freq_status_text_sensor_{nullptr};