7#ifdef USE_GREE_FEATURE_SWITCH
15static constexpr uint8_t GREE_TEMP_MIN = 16;
16static constexpr uint8_t GREE_TEMP_MAX = 30;
19static constexpr uint8_t GREE_MODE_AUTO = 0x00;
20static constexpr uint8_t GREE_MODE_COOL = 0x01;
21static constexpr uint8_t GREE_MODE_HEAT = 0x04;
22static constexpr uint8_t GREE_MODE_DRY = 0x02;
23static constexpr uint8_t GREE_MODE_FAN = 0x03;
25static constexpr uint8_t GREE_MODE_OFF = 0x00;
26static constexpr uint8_t GREE_MODE_ON = 0x08;
29static constexpr uint8_t GREE_FAN_AUTO = 0x00;
30static constexpr uint8_t GREE_FAN_1 = 0x10;
31static constexpr uint8_t GREE_FAN_2 = 0x20;
32static constexpr uint8_t GREE_FAN_3 = 0x30;
35static constexpr uint32_t GREE_IR_FREQUENCY = 38000;
36static constexpr uint32_t GREE_HEADER_MARK = 9000;
37static constexpr uint32_t GREE_HEADER_SPACE = 4000;
38static constexpr uint32_t GREE_BIT_MARK = 620;
39static constexpr uint32_t GREE_ONE_SPACE = 1600;
40static constexpr uint32_t GREE_ZERO_SPACE = 540;
41static constexpr uint32_t GREE_MESSAGE_SPACE = 19000;
44static constexpr uint32_t GREE_YAC_HEADER_MARK = 6000;
45static constexpr uint32_t GREE_YAC_HEADER_SPACE = 3000;
46static constexpr uint32_t GREE_YAC_BIT_MARK = 650;
49static constexpr uint32_t GREE_YAC1FB9_HEADER_SPACE = 4500;
50static constexpr uint32_t GREE_YAC1FB9_MESSAGE_SPACE = 19980;
52static constexpr uint32_t GREE_YAW1F_FOLLOWUP_SPACE = 40000;
55static constexpr uint8_t GREE_STATE_FRAME_SIZE = 8;
58static constexpr uint8_t GREE_VDIR_AUTO = 0x00;
59static constexpr uint8_t GREE_VDIR_MANUAL = 0x00;
60static constexpr uint8_t GREE_VDIR_SWING = 0x01;
61static constexpr uint8_t GREE_VDIR_UP = 0x02;
62static constexpr uint8_t GREE_VDIR_MUP = 0x03;
63static constexpr uint8_t GREE_VDIR_MIDDLE = 0x04;
64static constexpr uint8_t GREE_VDIR_MDOWN = 0x05;
65static constexpr uint8_t GREE_VDIR_DOWN = 0x06;
67static constexpr uint8_t GREE_YX1FF_VANE_SWING = 0x11;
68static constexpr uint8_t GREE_VDIR_SWING_DOWN = 0x07;
69static constexpr uint8_t GREE_VDIR_SWING_MIDDLE = 0x09;
70static constexpr uint8_t GREE_VDIR_SWING_UP = 0x0B;
74static constexpr uint8_t GREE_HDIR_AUTO = 0x00;
75static constexpr uint8_t GREE_HDIR_MANUAL = 0x00;
76static constexpr uint8_t GREE_HDIR_SWING = 0x01;
77static constexpr uint8_t GREE_HDIR_LEFT = 0x02;
78static constexpr uint8_t GREE_HDIR_MLEFT = 0x03;
79static constexpr uint8_t GREE_HDIR_MIDDLE = 0x04;
80static constexpr uint8_t GREE_HDIR_MRIGHT = 0x05;
81static constexpr uint8_t GREE_HDIR_RIGHT = 0x06;
84static constexpr uint8_t GREE_MODE_BIT_TURBO = 0x10;
85static constexpr uint8_t GREE_MODE_BIT_LIGHT = 0x20;
86static constexpr uint8_t GREE_MODE_BIT_HEALTH = 0x40;
87static constexpr uint8_t GREE_MODE_BIT_XFAN = 0x80;
90static constexpr uint8_t GREE_FAHRENHEIT_BIT = 0x08;
91static constexpr uint8_t GREE_TEMP_HALF_DEGREE_BIT = 0x04;
93#ifdef USE_GREE_FAHRENHEIT
100static constexpr uint8_t GREE_FAN_TURBO_BIT = 0x10;
101static constexpr uint8_t GREE_MODEL_A_BIT = 0x40;
105static constexpr uint8_t GREE_PRESET_NONE = 0x00;
106static constexpr uint8_t GREE_PRESET_SLEEP = 0x01;
107static constexpr uint8_t GREE_PRESET_SLEEP_BIT = 0x80;
129static constexpr uint8_t gree_feature_bit(
GreeFeature feature) {
return GREE_MODE_BIT_TURBO << feature; }
131using GreeState = std::array<uint8_t, GREE_STATE_FRAME_SIZE>;
150#ifdef USE_GREE_RECEIVER
155#ifdef USE_GREE_RECEIVER
166#ifdef USE_GREE_RECEIVER
176#ifdef USE_GREE_RECEIVER
185 : climate_ir::ClimateIR(GREE_TEMP_MIN, GREE_TEMP_MAX, 1.0f, true, true,
191#ifdef USE_GREE_FEATURE_SWITCH
192 void setup()
override;
195#ifdef USE_GREE_FAHRENHEIT
200#ifdef USE_GREE_FEATURE_SWITCH
208#ifdef USE_GREE_RECEIVER
212#ifdef USE_GREE_FEATURE_SWITCH
214#ifdef USE_GREE_RECEIVER
223#ifdef USE_GREE_FAHRENHEIT
BedjetMode mode
BedJet operating mode.
This class is used to encode all control actions on a climate device.
static optional< GreeClimateData > decode_legacy(Model model, const GreeState &state)
static GreeState encode(Model model, const GreeClimateData &data)
static uint8_t encode_fan_mode(Model model, climate::ClimateFanMode fan_mode)
static uint8_t encode_operation_mode(climate::ClimateMode mode)
static uint8_t encode_vertical_swing(climate::ClimateSwingMode swing_mode)
static uint8_t encode_horizontal_swing(climate::ClimateSwingMode swing_mode)
static optional< GreeClimateData > decode_model_a(Model model, const GreeState &state)
static optional< GreeClimateData > decode(Model model, const GreeState &state)
Decode a frame whose checksum the protocol layer already checked.
void set_use_fahrenheit(bool use_fahrenheit)
void publish_feature_states_()
void publish_feature_state_(GreeFeature feature)
std::array< switch_::Switch *, 4 > feature_switches_
void control(const climate::ClimateCall &call) override
bool on_receive(remote_base::RemoteReceiveData data) override
void register_feature_switch(GreeFeature feature, switch_::Switch *feature_switch)
void set_feature_state(GreeFeature feature, bool enabled)
void set_model(Model model)
bool get_feature_state(GreeFeature feature) const
void transmit_state() override
static bool valid_checksum(const GreeState &state)
static uint8_t calculate_checksum(const GreeState &state)
void encode(remote_base::RemoteTransmitData *data, const GreeState &state) const
GreeProtocol(Model model)
optional< GreeState > decode(remote_base::RemoteReceiveData data) const
Base class for all switches.
ClimateSwingMode swing_mode
ClimatePreset
Enum for all preset modes NOTE: If adding values, update ClimatePresetMask in climate_traits....
ClimateSwingMode
Enum for all modes a climate swing can be in NOTE: If adding values, update ClimateSwingModeMask in c...
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_HORIZONTAL
The fan mode is set to Horizontal.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ CLIMATE_SWING_BOTH
The fan mode is set to Both.
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_MEDIUM
The fan mode is set to Medium.
@ CLIMATE_FAN_AUTO
The fan mode is set to Auto.
@ CLIMATE_FAN_LOW
The fan mode is set to Low.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
std::array< uint8_t, GREE_STATE_FRAME_SIZE > GreeState
uint8_t fahrenheit_half_steps(float target_celsius)
Return k = 2 * temp_field + half_degree_bit (0..28) for a Celsius target.
climate::ClimateMode mode
climate::ClimateSwingMode swing_mode
uint8_t target_temperature
climate::ClimateFanMode fan_mode
climate::ClimatePreset preset