ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
pd_pioneer_data.h
Go to the documentation of this file.
1#pragma once
2
6
8
9constexpr uint8_t PDPIONEER_TEMPC_MIN = 16;
10constexpr uint8_t PDPIONEER_TEMPC_MAX = 31;
11
15
17 public:
19 void set_temp(float temp_c);
23 void set_eco(bool enabled) {
24 if (enabled)
25 this->even_[5] = PWR_ECO;
26 }
27
29 void finalize();
30 const PDPioneerData &odd() const { return this->odd_; }
31 const PDPioneerData &even() const { return this->even_; }
32
34 static float get_temp(const PDPioneerData &even) {
35 const float temp = ((even[12] & 0x04) ? 31.5f : 31.0f) - static_cast<float>(even[7]);
36 return clamp(temp, static_cast<float>(PDPIONEER_TEMPC_MIN), static_cast<float>(PDPIONEER_TEMPC_MAX));
37 }
39 static optional<ClimateMode> get_mode(const PDPioneerData &even);
40 static bool get_eco(const PDPioneerData &even) { return even[5] == PWR_ECO; }
44 static climate::ClimateSwingMode get_swing_mode(const PDPioneerData &even, bool horizontal);
45
46 protected:
47 static constexpr uint8_t MODE_HEAT = 0x01;
48 static constexpr uint8_t MODE_DRY = 0x02;
49 static constexpr uint8_t MODE_COOL = 0x03;
50 static constexpr uint8_t MODE_FAN_ONLY = 0x07;
51 static constexpr uint8_t MODE_AUTO = 0x08;
52
53 static constexpr uint8_t PWR_ON = 0x24;
54 static constexpr uint8_t PWR_ECO = 0x25;
55 static constexpr uint8_t PWR_OFF = 0xA0;
56
57 static constexpr uint8_t SWING_VERTICAL = 0x08;
58 static constexpr uint8_t SWING_HORIZONTAL = 0x90;
60 static constexpr uint8_t SWING_VERTICAL_EVEN_MASK = 0x38;
61
66 uint8_t swing_{0};
67};
68
69} // namespace esphome::pd_pioneer_ir
BedjetMode mode
BedJet operating mode.
static constexpr uint8_t MODE_HEAT
static constexpr uint8_t MODE_AUTO
static optional< ClimateMode > get_mode(const PDPioneerData &even)
Empty for a mode byte this remote does not use.
static constexpr uint8_t MODE_DRY
static float get_temp(const PDPioneerData &even)
Clamped to the set point range, so a frame from a sibling remote cannot publish an impossible value.
void set_swing_mode(climate::ClimateSwingMode mode)
static bool get_horizontal_swing(const PDPioneerData &odd)
Only the odd burst carries horizontal swing; the even burst carries vertical swing.
static ClimateFanMode get_fan_mode(const PDPioneerData &even)
static constexpr uint8_t SWING_VERTICAL_EVEN_MASK
Vertical swing also sets this mask on even frame position 8 (fan sub-code).
void finalize()
Write the fan and swing positions, which share bytes, then the checksums.
static constexpr uint8_t MODE_FAN_ONLY
static constexpr uint8_t MODE_COOL
uint8_t swing_
Odd-burst position 7: SWING_VERTICAL and SWING_HORIZONTAL flags.
static constexpr uint8_t SWING_VERTICAL
static constexpr uint8_t PWR_OFF
const PDPioneerData & even() const
static constexpr uint8_t PWR_ON
static bool get_eco(const PDPioneerData &even)
static constexpr uint8_t PWR_ECO
static climate::ClimateSwingMode get_swing_mode(const PDPioneerData &even, bool horizontal)
const PDPioneerData & odd() const
static constexpr uint8_t SWING_HORIZONTAL
void set_fan_mode(ClimateFanMode mode)
ClimateSwingMode
Enum for all modes a climate swing can be in NOTE: If adding values, update ClimateSwingModeMask in c...
ClimateMode
Enum for all modes a climate device can be in.
ClimateFanMode
NOTE: If adding values, update ClimateFanModeMask in climate_traits.h to use the new last value.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
constexpr uint8_t PDPIONEER_TEMPC_MAX
constexpr uint8_t PDPIONEER_TEMPC_MIN