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