ESPHome  2024.3.2
cse7766.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace cse7766 {
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_energy_sensor(sensor::Sensor *energy_sensor) { energy_sensor_ = energy_sensor; }
16  void set_apparent_power_sensor(sensor::Sensor *apparent_power_sensor) {
17  apparent_power_sensor_ = apparent_power_sensor;
18  }
19  void set_power_factor_sensor(sensor::Sensor *power_factor_sensor) { power_factor_sensor_ = power_factor_sensor; }
20 
21  void loop() override;
22  float get_setup_priority() const override;
23  void dump_config() override;
24 
25  protected:
26  bool check_byte_();
27  void parse_data_();
28  uint32_t get_24_bit_uint_(uint8_t start_index);
29 
30  uint8_t raw_data_[24];
31  uint8_t raw_data_index_{0};
32  uint32_t last_transmission_{0};
39  uint32_t cf_pulses_total_{0};
40  uint16_t cf_pulses_last_{0};
41 };
42 
43 } // namespace cse7766
44 } // namespace esphome
sensor::Sensor * power_sensor_
Definition: cse7766.h:35
void set_current_sensor(sensor::Sensor *current_sensor)
Definition: cse7766.h:13
sensor::Sensor * power_factor_sensor_
Definition: cse7766.h:38
uint32_t get_24_bit_uint_(uint8_t start_index)
Definition: cse7766.cpp:223
void set_voltage_sensor(sensor::Sensor *voltage_sensor)
Definition: cse7766.h:12
sensor::Sensor * energy_sensor_
Definition: cse7766.h:36
void set_power_factor_sensor(sensor::Sensor *power_factor_sensor)
Definition: cse7766.h:19
void set_apparent_power_sensor(sensor::Sensor *apparent_power_sensor)
Definition: cse7766.h:16
void set_energy_sensor(sensor::Sensor *energy_sensor)
Definition: cse7766.h:15
void set_power_sensor(sensor::Sensor *power_sensor)
Definition: cse7766.h:14
float get_setup_priority() const override
Definition: cse7766.cpp:40
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
sensor::Sensor * current_sensor_
Definition: cse7766.h:34
Base-class for all sensors.
Definition: sensor.h:57
sensor::Sensor * apparent_power_sensor_
Definition: cse7766.h:37
sensor::Sensor * voltage_sensor_
Definition: cse7766.h:33