ESPHome 2026.12.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 set_display(bool on) {
30 if (!on && this->even_[5] != PWR_OFF)
31 this->even_[5] |= DISPLAY_OFF;
32 }
33
35 void finalize();
36 const PDPioneerData &odd() const { return this->odd_; }
37 const PDPioneerData &even() const { return this->even_; }
38
40 static float get_temp(const PDPioneerData &even) {
41 const float temp = ((even[12] & 0x04) ? 31.5f : 31.0f) - static_cast<float>(even[7]);
42 return clamp(temp, static_cast<float>(PDPIONEER_TEMPC_MIN), static_cast<float>(PDPIONEER_TEMPC_MAX));
43 }
45 static optional<ClimateMode> get_mode(const PDPioneerData &even);
46 static bool get_eco(const PDPioneerData &even) { return (even[5] & ~DISPLAY_OFF) == PWR_ECO; }
47 static bool get_display(const PDPioneerData &even) { return (even[5] & DISPLAY_OFF) == 0; }
51 static climate::ClimateSwingMode get_swing_mode(const PDPioneerData &even, bool horizontal);
52
53 protected:
54 static constexpr uint8_t MODE_HEAT = 0x01;
55 static constexpr uint8_t MODE_DRY = 0x02;
56 static constexpr uint8_t MODE_COOL = 0x03;
57 static constexpr uint8_t MODE_FAN_ONLY = 0x07;
58 static constexpr uint8_t MODE_AUTO = 0x08;
59
60 static constexpr uint8_t PWR_ON = 0x24;
61 static constexpr uint8_t PWR_ECO = 0x25;
62 static constexpr uint8_t PWR_OFF = 0xA0;
64 static constexpr uint8_t DISPLAY_OFF = 0x40;
65
66 static constexpr uint8_t SWING_VERTICAL = 0x08;
67 static constexpr uint8_t SWING_HORIZONTAL = 0x90;
69 static constexpr uint8_t SWING_VERTICAL_EVEN_MASK = 0x38;
70
75 uint8_t swing_{0};
76};
77
78} // namespace esphome::pd_pioneer_ir
BedjetMode mode
BedJet operating mode.
static constexpr uint8_t MODE_HEAT
static constexpr uint8_t MODE_AUTO
void set_display(bool on)
The display flag shares the power byte, so call this after set_eco()
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
static constexpr uint8_t DISPLAY_OFF
Set on even position 5, next to PWR_ON or PWR_ECO, to turn the unit's display off.
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 bool get_display(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