20 auto publish_1_register = [&](
sensor::Sensor *sensor, uint16_t reg,
float unit) ->
void {
21 if (sensor ==
nullptr)
27 auto publish_2_registers = [&](
sensor::Sensor *sensor, uint16_t reg,
float unit) ->
void {
28 if (sensor ==
nullptr)
34 for (uint8_t i = 0; i < 3; i++) {
38 publish_1_register(phase.voltage_sensor_, HAVELLS_PHASE_1_VOLTAGE + i * 2, ONE_DEC_UNIT);
39 publish_1_register(phase.current_sensor_, HAVELLS_PHASE_1_CURRENT + i * 2, TWO_DEC_UNIT);
42 for (uint8_t i = 0; i < 2; i++) {
43 auto &pv = this->
pvs_[i];
46 publish_1_register(pv.voltage_sensor_, HAVELLS_PV_1_VOLTAGE + i * 2, ONE_DEC_UNIT);
47 publish_1_register(pv.current_sensor_, HAVELLS_PV_1_CURRENT + i * 2, TWO_DEC_UNIT);
48 publish_1_register(pv.active_power_sensor_, HAVELLS_PV_1_POWER + i, MULTIPLY_TEN_UNIT);
49 publish_1_register(pv.voltage_sampled_by_secondary_cpu_sensor_, HAVELLS_PV1_VOLTAGE_SAMPLED_BY_SECONDARY_CPU + i,
51 publish_1_register(pv.insulation_of_p_to_ground_sensor_, HAVELLS_PV1_INSULATION_OF_P_TO_GROUND + i, NO_DEC_UNIT);
54 publish_1_register(this->
frequency_sensor_, HAVELLS_GRID_FREQUENCY, TWO_DEC_UNIT);