ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
atm90e32_button.cpp
Go to the documentation of this file.
1#include "atm90e32_button.h"
3#include "esphome/core/log.h"
4
5namespace esphome::atm90e32 {
6
7static const char *const TAG = "atm90e32.button";
8
10 if (this->parent_ == nullptr) {
11 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Gain Calibration button [%s]", this->get_name().c_str());
12 return;
13 }
14
15 ESP_LOGI(TAG, "%s", this->get_name().c_str());
16 ESP_LOGI(TAG,
17 "[CALIBRATION] Use gain_ct: & gain_voltage: under each phase_x: in your config file to save these values");
18 this->parent_->run_gain_calibrations();
19}
20
22 if (this->parent_ == nullptr) {
23 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Clear Gain button [%s]", this->get_name().c_str());
24 return;
25 }
26
27 ESP_LOGI(TAG, "%s", this->get_name().c_str());
28 this->parent_->clear_gain_calibrations();
29}
30
32 if (this->parent_ == nullptr) {
33 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Offset Calibration button [%s]", this->get_name().c_str());
34 return;
35 }
36
37 ESP_LOGI(TAG, "%s", this->get_name().c_str());
38 ESP_LOGI(TAG, "[CALIBRATION] **NOTE: CTs and ACVs must be 0 during this process. USB power only**");
39 ESP_LOGI(TAG, "[CALIBRATION] Use offset_voltage: & offset_current: under each phase_x: in your config file to save "
40 "these values");
41 this->parent_->run_offset_calibrations();
42}
43
45 if (this->parent_ == nullptr) {
46 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Clear Offset button [%s]", this->get_name().c_str());
47 return;
48 }
49
50 ESP_LOGI(TAG, "%s", this->get_name().c_str());
51 this->parent_->clear_offset_calibrations();
52}
53
55 if (this->parent_ == nullptr) {
56 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Power Calibration button [%s]", this->get_name().c_str());
57 return;
58 }
59
60 ESP_LOGI(TAG, "%s", this->get_name().c_str());
61 ESP_LOGI(TAG, "[CALIBRATION] **NOTE: CTs must be 0 during this process. Voltage reference should be present**");
62 ESP_LOGI(TAG, "[CALIBRATION] Use offset_active_power: & offset_reactive_power: under each phase_x: in your config "
63 "file to save these values");
64 this->parent_->run_power_offset_calibrations();
65}
66
68 if (this->parent_ == nullptr) {
69 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Clear Power button [%s]", this->get_name().c_str());
70 return;
71 }
72
73 ESP_LOGI(TAG, "%s", this->get_name().c_str());
74 this->parent_->clear_power_offset_calibrations();
75}
76
77} // namespace esphome::atm90e32
const StringRef & get_name() const
Definition entity_base.h:71