ESPHome 2025.5.0
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 {
6namespace atm90e32 {
7
8static const char *const TAG = "atm90e32.button";
9
11 if (this->parent_ == nullptr) {
12 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Gain Calibration button [%s]", this->get_name().c_str());
13 return;
14 }
15
16 ESP_LOGI(TAG, "%s", this->get_name().c_str());
17 ESP_LOGI(TAG,
18 "[CALIBRATION] Use gain_ct: & gain_voltage: under each phase_x: in your config file to save these values");
19 this->parent_->run_gain_calibrations();
20}
21
23 if (this->parent_ == nullptr) {
24 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Clear Gain button [%s]", this->get_name().c_str());
25 return;
26 }
27
28 ESP_LOGI(TAG, "%s", this->get_name().c_str());
29 this->parent_->clear_gain_calibrations();
30}
31
33 if (this->parent_ == nullptr) {
34 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Offset Calibration button [%s]", this->get_name().c_str());
35 return;
36 }
37
38 ESP_LOGI(TAG, "%s", this->get_name().c_str());
39 ESP_LOGI(TAG, "[CALIBRATION] **NOTE: CTs and ACVs must be 0 during this process. USB power only**");
40 ESP_LOGI(TAG, "[CALIBRATION] Use offset_voltage: & offset_current: under each phase_x: in your config file to save "
41 "these values");
42 this->parent_->run_offset_calibrations();
43}
44
46 if (this->parent_ == nullptr) {
47 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Clear Offset button [%s]", this->get_name().c_str());
48 return;
49 }
50
51 ESP_LOGI(TAG, "%s", this->get_name().c_str());
52 this->parent_->clear_offset_calibrations();
53}
54
56 if (this->parent_ == nullptr) {
57 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Power Calibration button [%s]", this->get_name().c_str());
58 return;
59 }
60
61 ESP_LOGI(TAG, "%s", this->get_name().c_str());
62 ESP_LOGI(TAG, "[CALIBRATION] **NOTE: CTs must be 0 during this process. Voltage reference should be present**");
63 ESP_LOGI(TAG, "[CALIBRATION] Use offset_active_power: & offset_reactive_power: under each phase_x: in your config "
64 "file to save these values");
65 this->parent_->run_power_offset_calibrations();
66}
67
69 if (this->parent_ == nullptr) {
70 ESP_LOGW(TAG, "[CALIBRATION] No meters assigned to Clear Power button [%s]", this->get_name().c_str());
71 return;
72 }
73
74 ESP_LOGI(TAG, "%s", this->get_name().c_str());
75 this->parent_->clear_power_offset_calibrations();
76}
77
78} // namespace atm90e32
79} // namespace esphome
const StringRef & get_name() const
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7