7static const char *
const TAG =
"mitsubishi.climate";
113 uint8_t remote_state[18] = {0x23, 0xCB, 0x26, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00,
114 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
116 switch (this->
mode) {
153 remote_state[7] = (uint8_t) roundf(
207 ESP_LOGD(TAG,
"fan: %02x state: %02x", this->
fan_mode.
value(), remote_state[9]);
245 for (
int i = 0; i < 17; i++) {
246 remote_state[17] += remote_state[i];
249 ESP_LOGD(TAG,
"sending: %02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X",
250 remote_state[0], remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5],
251 remote_state[6], remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11],
252 remote_state[12], remote_state[13], remote_state[14], remote_state[15], remote_state[16], remote_state[17]);
259 for (uint8_t r = 0; r < 2; r++) {
264 for (uint8_t i : remote_state) {
265 for (uint8_t j = 0; j < 8; j++) {
267 bool bit = i & (1 << j);
285 uint8_t state_frame[18] = {};
288 ESP_LOGV(TAG,
"Header fail");
292 for (uint8_t pos = 0; pos < 18; pos++) {
294 for (int8_t bit = 0; bit < 8; bit++) {
298 ESP_LOGV(TAG,
"Byte %d bit %d fail", pos, bit);
302 state_frame[pos] = byte;
309 ESP_LOGV(TAG,
"Bytes 0,1,2,3,4,13 or 16 fail - invalid value");
318 switch (state_frame[6]) {
341 uint8_t fan = state_frame[9] & 0x07;
356 this->
fan_mode = modes_mapping[fan];
359 uint8_t wide_vane = state_frame[8] & 0xF0;
370 uint8_t vertical_vane = state_frame[9] & 0x38;
371 switch (vertical_vane) {
381 switch (state_frame[14]) {
ClimateMode mode
The active mode of the climate device.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
float target_temperature
The target temperature of the climate device.
ClimateSwingMode swing_mode
The active swing mode of the climate device.
void publish_state()
Publish the state of the climate device, to be called from integrations.
optional< ClimatePreset > preset
The active preset of the climate device.
This class contains all static data for climate devices.
void set_visual_max_temperature(float visual_max_temperature)
void set_supported_modes(std::set< ClimateMode > modes)
void add_supported_fan_mode(ClimateFanMode mode)
void set_supports_action(bool supports_action)
void set_visual_temperature_step(float temperature_step)
void set_visual_min_temperature(float visual_min_temperature)
void set_supported_swing_modes(std::set< ClimateSwingMode > modes)
void set_supported_presets(std::set< ClimatePreset > presets)
void add_supported_mode(ClimateMode mode)
void set_supported_fan_modes(std::set< ClimateFanMode > modes)
void set_supports_current_temperature(bool supports_current_temperature)
climate::ClimateTraits traits() override
void transmit_state() override
bool on_receive(remote_base::RemoteReceiveData data) override
VerticalDirection default_vertical_direction_
HorizontalDirection default_horizontal_direction_
bool parse_state_frame_(const uint8_t frame[])
value_type const & value() const
bool expect_item(uint32_t mark, uint32_t space)
void set_carrier_frequency(uint32_t carrier_frequency)
RemoteTransmitterBase * transmitter_
RemoteTransmitData * get_data()
@ CLIMATE_PRESET_NONE
No preset is active.
@ CLIMATE_PRESET_BOOST
Device is in boost preset.
@ CLIMATE_PRESET_SLEEP
Device is prepared for sleep.
@ CLIMATE_PRESET_ECO
Device is running an energy-saving preset.
@ 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.
@ CLIMATE_MODE_DRY
The climate device is set to dry/humidity mode.
@ CLIMATE_MODE_FAN_ONLY
The climate device only has the fan enabled, no heating or cooling is taking place.
@ CLIMATE_MODE_HEAT
The climate device is set to heat to reach the target temperature.
@ CLIMATE_MODE_COOL
The climate device is set to cool to reach the target temperature.
@ CLIMATE_MODE_HEAT_COOL
The climate device is set to heat/cool to reach the target temperature.
@ CLIMATE_MODE_OFF
The climate device is off.
@ 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_MIDDLE
The fan mode is set to Middle.
@ CLIMATE_FAN_QUIET
The fan mode is set to Quiet.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
const uint8_t MITSUBISHI_POWERFUL
const uint16_t MITSUBISHI_ONE_SPACE
const uint16_t MITSUBISHI_MIN_GAP
const uint8_t MITSUBISHI_MODE_AUTO
const uint8_t MITSUBISHI_MODE_COOL
const uint16_t MITSUBISHI_ZERO_SPACE
const uint8_t MITSUBISHI_FAN_AUTO
const uint8_t MITSUBISHI_BYTE00
const uint16_t MITSUBISHI_HEADER_MARK
const uint8_t MITSUBISHI_BYTE13
const uint8_t MITSUBISHI_BYTE01
const uint8_t MITSUBISHI_MODE_A_HEAT
const uint8_t MITSUBISHI_BYTE04
const uint8_t MITSUBISHI_BYTE03
const uint8_t MITSUBISHI_BYTE02
const uint8_t MITSUBISHI_TEMP_MAX
const uint8_t MITSUBISHI_NIGHTMODE
const uint8_t MITSUBISHI_TEMP_MIN
const uint8_t MITSUBISHI_WIDE_VANE_SWING
const uint16_t MITSUBISHI_HEADER_SPACE
const uint8_t MITSUBISHI_VERTICAL_VANE_SWING
const uint8_t MITSUBISHI_MODE_A_DRY
const uint8_t MITSUBISHI_OTHERWISE
const uint8_t MITSUBISHI_ECONOCOOL
const uint8_t MITSUBISHI_OFF
const uint8_t MITSUBISHI_MODE_A_COOL
const uint8_t MITSUBISHI_MODE_DRY
const uint8_t MITSUBISHI_BYTE16
const uint8_t MITSUBISHI_MODE_FAN_ONLY
const uint8_t MITSUBISHI_MODE_A_AUTO
const uint16_t MITSUBISHI_BIT_MARK
const uint8_t MITSUBISHI_MODE_HEAT
Providing packet encoding functions for exchanging data with a remote host.
std::string format_hex_pretty(const uint8_t *data, size_t length)
Format the byte array data of length len in pretty-printed, human-readable hex.