ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
vevor_dtx.h
Go to the documentation of this file.
1#pragma once
2
6#ifdef USE_BINARY_SENSOR
8#endif
9#ifdef USE_SENSOR
11#endif
12#ifdef USE_TEXT_SENSOR
14#endif
15
16#include <array>
17
18namespace esphome::vevor_dtx {
19
21#ifdef USE_SENSOR
22 SUB_SENSOR(temperature)
23 SUB_SENSOR(humidity)
24 SUB_SENSOR(wind_speed)
25 SUB_SENSOR(wind_gust)
26 SUB_SENSOR(wind_direction)
27 SUB_SENSOR(rain)
28 SUB_SENSOR(uv_index)
29 SUB_SENSOR(illuminance)
30 SUB_SENSOR(tx_counter)
31#endif
32#ifdef USE_TEXT_SENSOR
33 SUB_TEXT_SENSOR(sensor_id)
34#endif
35#ifdef USE_BINARY_SENSOR
36 SUB_BINARY_SENSOR(low_battery)
37#endif
38
39 public:
40 void dump_config() override;
41 bool on_receive(remote_base::RemoteReceiveData data) override;
42
43 void set_bit_time_us(uint8_t bit_time_us) { this->bit_time_us_ = bit_time_us; }
44 void set_station_id(uint16_t station_id) { this->station_id_ = station_id; }
45
46 protected:
47 static constexpr uint8_t PAYLOAD_SIZE = 21;
48 static constexpr uint8_t CHECKSUM_INDEX = 19;
49 static constexpr uint8_t TX_COUNTER_INDEX = 18;
50 // The frame ends with the counter echo; trailing zero bits that merge into the receiver's idle entry come
51 // back when that entry is cut to a frame's worth of zeros
52 static constexpr uint16_t FRAME_BITS = PAYLOAD_SIZE * 8;
53
54 using Payload = std::array<uint8_t, PAYLOAD_SIZE>;
55
56 bool decode_timings_(const remote_base::RawTimings &timings, Payload &payload) const;
57 bool publish_(const Payload &payload);
58
59 uint16_t station_id_{0}; // 0 accepts every station in range
60 uint8_t bit_time_us_{88};
61};
62
63} // namespace esphome::vevor_dtx
virtual void dump_config()
bool decode_timings_(const remote_base::RawTimings &timings, Payload &payload) const
Definition vevor_dtx.cpp:68
static constexpr uint8_t PAYLOAD_SIZE
Definition vevor_dtx.h:47
bool publish_(const Payload &payload)
static constexpr uint8_t TX_COUNTER_INDEX
Definition vevor_dtx.h:49
static constexpr uint8_t CHECKSUM_INDEX
Definition vevor_dtx.h:48
static constexpr uint16_t FRAME_BITS
Definition vevor_dtx.h:52
std::array< uint8_t, PAYLOAD_SIZE > Payload
Definition vevor_dtx.h:54
std::vector< int32_t > RawTimings
Definition remote_base.h:20
uint16_t temperature
Definition sun_gtil2.cpp:12