ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
hydreon_rgxx.h
Go to the documentation of this file.
1#pragma once
2
7#ifdef USE_BINARY_SENSOR
9#endif
12
13namespace esphome::hydreon_rgxx {
14
15enum RGModel {
16 RG9 = 1,
17 RG15 = 2,
18};
19
24
25#ifdef HYDREON_RGXX_NUM_SENSORS
26static const uint8_t NUM_SENSORS = HYDREON_RGXX_NUM_SENSORS;
27#else
28static const uint8_t NUM_SENSORS = 1;
29#endif
30
31#ifndef HYDREON_RGXX_PROTOCOL_LIST
32#define HYDREON_RGXX_PROTOCOL_LIST(F, SEP) F("")
33#endif
34
35#define HYDREON_RGXX_IGNORE_LIST(F, SEP) F("Emitters") SEP F("Event") SEP F("Reset")
36
38#ifdef USE_BINARY_SENSOR
39 SUB_BINARY_SENSOR(too_cold)
40 SUB_BINARY_SENSOR(lens_bad)
41 SUB_BINARY_SENSOR(em_sat)
42#endif
43
44 public:
45 void set_sensor(sensor::Sensor *sensor, int index) { this->sensors_[index] = sensor; }
46 void set_model(RGModel model) { model_ = model; }
47 void set_resolution(RG15Resolution resolution) { resolution_ = resolution; }
48 void set_request_temperature(bool b) { request_temperature_ = b; }
49
51 void update() override;
53 void loop() override;
55 void setup() override;
56 void dump_config() override;
57
58 void set_disable_led(bool disable_led) { this->disable_led_ = disable_led; }
59
60 protected:
62 void process_line_(StringRef line);
63 void schedule_reboot_();
65
66 sensor::Sensor *sensors_[NUM_SENSORS] = {nullptr};
67
68 int16_t boot_count_ = 0;
69 int16_t no_response_count_ = 0;
70
73
74 int sw_version_ = 0;
75 bool too_cold_ = false;
76 bool lens_bad_ = false;
77 bool em_sat_ = false;
79 bool disable_led_ = false;
81
82 // bit field showing which sensors we have received data for
84};
85
86} // namespace esphome::hydreon_rgxx
Collects bytes into NUL terminated lines of up to N - 1 characters; IGNORE_CHAR bytes are skipped and...
Definition line_reader.h:15
This class simplifies creating components that periodically check a state.
Definition component.h:532
StringRef is a reference to a string owned by something else.
Definition string_ref.h:31
void process_line_(StringRef line)
line is NUL terminated
void schedule_reboot_()
Communication with the sensor is asynchronous.
sensor::Sensor * sensors_[NUM_SENSORS]
Base-class for all sensors.
Definition sensor.h:48
Resolution resolution
Definition msa3xx.h:1