ESPHome  2024.10.2
sun_gtil2.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/defines.h"
5 
6 #ifdef USE_SENSOR
8 #endif
9 #ifdef USE_TEXT_SENSOR
11 #endif
13 
14 namespace esphome {
15 namespace sun_gtil2 {
16 
17 class SunGTIL2 : public Component, public uart::UARTDevice {
18  public:
19  float get_setup_priority() const override { return setup_priority::LATE; }
20  void setup() override;
21  void loop() override;
22  void dump_config() override;
23 
24 #ifdef USE_SENSOR
31 #endif
32 #ifdef USE_TEXT_SENSOR
33  void set_state(text_sensor::TextSensor *text_sensor) { state_ = text_sensor; }
34  void set_serial_number(text_sensor::TextSensor *text_sensor) { serial_number_ = text_sensor; }
35 #endif
36 
37  protected:
38  std::string state_to_string_(uint8_t state);
39 #ifdef USE_SENSOR
46 #endif
47 #ifdef USE_TEXT_SENSOR
50 #endif
51 
52  float calculate_temperature_(uint16_t adc_value);
53  void handle_char_(uint8_t c);
54  std::vector<uint8_t> rx_message_;
55 };
56 
57 } // namespace sun_gtil2
58 } // namespace esphome
sensor::Sensor * ac_voltage_
Definition: sun_gtil2.h:40
text_sensor::TextSensor * serial_number_
Definition: sun_gtil2.h:49
void set_dc_power(sensor::Sensor *sensor)
Definition: sun_gtil2.h:28
void set_dc_voltage(sensor::Sensor *sensor)
Definition: sun_gtil2.h:26
void dump_config() override
Definition: sun_gtil2.cpp:119
sensor::Sensor * dc_power_
Definition: sun_gtil2.h:43
sensor::Sensor * ac_power_
Definition: sun_gtil2.h:42
const float LATE
For components that should be initialized at the very end of the setup process.
Definition: component.cpp:28
void set_temperature(sensor::Sensor *sensor)
Definition: sun_gtil2.h:30
sensor::Sensor * dc_voltage_
Definition: sun_gtil2.h:41
void set_ac_voltage(sensor::Sensor *sensor)
Definition: sun_gtil2.h:25
std::string state_to_string_(uint8_t state)
Definition: sun_gtil2.cpp:50
sensor::Sensor * temperature_
Definition: sun_gtil2.h:45
std::vector< uint8_t > rx_message_
Definition: sun_gtil2.h:54
void set_limiter_power(sensor::Sensor *sensor)
Definition: sun_gtil2.h:29
void handle_char_(uint8_t c)
Definition: sun_gtil2.cpp:72
float get_setup_priority() const override
Definition: sun_gtil2.h:19
float calculate_temperature_(uint16_t adc_value)
Definition: sun_gtil2.cpp:61
void set_serial_number(text_sensor::TextSensor *text_sensor)
Definition: sun_gtil2.h:34
sensor::Sensor * limiter_power_
Definition: sun_gtil2.h:44
text_sensor::TextSensor * state_
Definition: sun_gtil2.h:48
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_ac_power(sensor::Sensor *sensor)
Definition: sun_gtil2.h:27
Base-class for all sensors.
Definition: sensor.h:57
esphome::sensor::Sensor * sensor
Definition: statsd.h:37
bool state
Definition: fan.h:34
void set_state(text_sensor::TextSensor *text_sensor)
Definition: sun_gtil2.h:33