ESPHome  2022.12.8
pzemdc.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include <vector>
8 
9 namespace esphome {
10 namespace pzemdc {
11 
13  public:
14  void set_voltage_sensor(sensor::Sensor *voltage_sensor) { voltage_sensor_ = voltage_sensor; }
15  void set_current_sensor(sensor::Sensor *current_sensor) { current_sensor_ = current_sensor; }
16  void set_power_sensor(sensor::Sensor *power_sensor) { power_sensor_ = power_sensor; }
17  void set_frequency_sensor(sensor::Sensor *frequency_sensor) { frequency_sensor_ = frequency_sensor; }
18  void set_powerfactor_sensor(sensor::Sensor *powerfactor_sensor) { power_factor_sensor_ = powerfactor_sensor; }
19 
20  void update() override;
21 
22  void on_modbus_data(const std::vector<uint8_t> &data) override;
23 
24  void dump_config() override;
25 
26  protected:
32 };
33 
34 } // namespace pzemdc
35 } // namespace esphome
void dump_config() override
Definition: pzemdc.cpp:50
sensor::Sensor * power_sensor_
Definition: pzemdc.h:29
void set_power_sensor(sensor::Sensor *power_sensor)
Definition: pzemdc.h:16
void set_voltage_sensor(sensor::Sensor *voltage_sensor)
Definition: pzemdc.h:14
void set_current_sensor(sensor::Sensor *current_sensor)
Definition: pzemdc.h:15
void set_frequency_sensor(sensor::Sensor *frequency_sensor)
Definition: pzemdc.h:17
sensor::Sensor * current_sensor_
Definition: pzemdc.h:28
This class simplifies creating components that periodically check a state.
Definition: component.h:267
sensor::Sensor * frequency_sensor_
Definition: pzemdc.h:30
void set_powerfactor_sensor(sensor::Sensor *powerfactor_sensor)
Definition: pzemdc.h:18
Definition: a4988.cpp:4
void on_modbus_data(const std::vector< uint8_t > &data) override
Definition: pzemdc.cpp:12
sensor::Sensor * power_factor_sensor_
Definition: pzemdc.h:31
Base-class for all sensors.
Definition: sensor.h:50
sensor::Sensor * voltage_sensor_
Definition: pzemdc.h:27
void update() override
Definition: pzemdc.cpp:49