21 auto publish = [&](
sensor::Sensor *sensor, uint16_t reg,
float unit) ->
void {
22 if (sensor ==
nullptr)
28 publish(this->total_active_energy_sensor_, SELEC_TOTAL_ACTIVE_ENERGY, NO_DEC_UNIT);
29 publish(this->import_active_energy_sensor_, SELEC_IMPORT_ACTIVE_ENERGY, NO_DEC_UNIT);
30 publish(this->export_active_energy_sensor_, SELEC_EXPORT_ACTIVE_ENERGY, NO_DEC_UNIT);
31 publish(this->total_reactive_energy_sensor_, SELEC_TOTAL_REACTIVE_ENERGY, NO_DEC_UNIT);
32 publish(this->import_reactive_energy_sensor_, SELEC_IMPORT_REACTIVE_ENERGY, NO_DEC_UNIT);
33 publish(this->export_reactive_energy_sensor_, SELEC_EXPORT_REACTIVE_ENERGY, NO_DEC_UNIT);
34 publish(this->apparent_energy_sensor_, SELEC_APPARENT_ENERGY, NO_DEC_UNIT);
35 publish(this->active_power_sensor_, SELEC_ACTIVE_POWER, MULTIPLY_THOUSAND_UNIT);
36 publish(this->reactive_power_sensor_, SELEC_REACTIVE_POWER, MULTIPLY_THOUSAND_UNIT);
37 publish(this->apparent_power_sensor_, SELEC_APPARENT_POWER, MULTIPLY_THOUSAND_UNIT);
38 publish(this->voltage_sensor_, SELEC_VOLTAGE, NO_DEC_UNIT);
39 publish(this->current_sensor_, SELEC_CURRENT, NO_DEC_UNIT);
40 publish(this->power_factor_sensor_, SELEC_POWER_FACTOR, NO_DEC_UNIT);
41 publish(this->frequency_sensor_, SELEC_FREQUENCY, NO_DEC_UNIT);
42 publish(this->maximum_demand_active_power_sensor_, SELEC_MAXIMUM_DEMAND_ACTIVE_POWER, MULTIPLY_THOUSAND_UNIT);
43 publish(this->maximum_demand_reactive_power_sensor_, SELEC_MAXIMUM_DEMAND_REACTIVE_POWER, MULTIPLY_THOUSAND_UNIT);
44 publish(this->maximum_demand_apparent_power_sensor_, SELEC_MAXIMUM_DEMAND_APPARENT_POWER, MULTIPLY_THOUSAND_UNIT);
53 LOG_SENSOR(
" ",
"Total Active Energy", this->total_active_energy_sensor_);
54 LOG_SENSOR(
" ",
"Import Active Energy", this->import_active_energy_sensor_);
55 LOG_SENSOR(
" ",
"Export Active Energy", this->export_active_energy_sensor_);
56 LOG_SENSOR(
" ",
"Total Reactive Energy", this->total_reactive_energy_sensor_);
57 LOG_SENSOR(
" ",
"Import Reactive Energy", this->import_reactive_energy_sensor_);
58 LOG_SENSOR(
" ",
"Export Reactive Energy", this->export_reactive_energy_sensor_);
59 LOG_SENSOR(
" ",
"Apparent Energy", this->apparent_energy_sensor_);
60 LOG_SENSOR(
" ",
"Active Power", this->active_power_sensor_);
61 LOG_SENSOR(
" ",
"Reactive Power", this->reactive_power_sensor_);
62 LOG_SENSOR(
" ",
"Apparent Power", this->apparent_power_sensor_);
63 LOG_SENSOR(
" ",
"Voltage", this->voltage_sensor_);
64 LOG_SENSOR(
" ",
"Current", this->current_sensor_);
65 LOG_SENSOR(
" ",
"Power Factor", this->power_factor_sensor_);
66 LOG_SENSOR(
" ",
"Frequency", this->frequency_sensor_);
67 LOG_SENSOR(
" ",
"Maximum Demand Active Power", this->maximum_demand_active_power_sensor_);
68 LOG_SENSOR(
" ",
"Maximum Demand Reactive Power", this->maximum_demand_reactive_power_sensor_);
69 LOG_SENSOR(
" ",
"Maximum Demand Apparent Power", this->maximum_demand_apparent_power_sensor_);