18 IR_NOBLEX_MODE_AUTO = 0b000,
19 IR_NOBLEX_MODE_COOL = 0b100,
20 IR_NOBLEX_MODE_DRY = 0b010,
21 IR_NOBLEX_MODE_FAN = 0b110,
22 IR_NOBLEX_MODE_HEAT = 0b001,
26 IR_NOBLEX_FAN_AUTO = 0b00,
27 IR_NOBLEX_FAN_LOW = 0b10,
28 IR_NOBLEX_FAN_MEDIUM = 0b01,
29 IR_NOBLEX_FAN_HIGH = 0b11,
34 uint8_t remote_state[8] = {0x80, 0x10, 0x00, 0x0A, 0x50, 0x00, 0x20, 0x00};
38 remote_state[0] |= 0x10;
39 remote_state[2] = 0x02;
49 remote_state[0] |= (IRNoblexMode::IR_NOBLEX_MODE_AUTO << 5);
50 remote_state[1] = 0x90;
53 remote_state[0] |= (IRNoblexMode::IR_NOBLEX_MODE_COOL << 5);
56 remote_state[0] |= (IRNoblexMode::IR_NOBLEX_MODE_DRY << 5);
59 remote_state[0] |= (IRNoblexMode::IR_NOBLEX_MODE_FAN << 5);
62 remote_state[0] |= (IRNoblexMode::IR_NOBLEX_MODE_HEAT << 5);
68 remote_state[0] &= 0xEF;
69 remote_state[2] = 0x00;
75 remote_state[0] |= (IRNoblexFan::IR_NOBLEX_FAN_LOW << 2);
78 remote_state[0] |= (IRNoblexFan::IR_NOBLEX_FAN_MEDIUM << 2);
81 remote_state[0] |= (IRNoblexFan::IR_NOBLEX_FAN_HIGH << 2);
85 remote_state[0] |= (IRNoblexFan::IR_NOBLEX_FAN_AUTO << 2);
91 remote_state[0] |= 0x02;
92 remote_state[4] = 0x58;
96 remote_state[0] &= 0xFD;
97 remote_state[4] = 0x50;
102 for (uint8_t i : remote_state) {
107 ESP_LOGD_HEX(TAG, remote_state,
sizeof(remote_state),
sizeof(remote_state),
"Sending noblex code: %s");
109 ESP_LOGV(TAG,
"CRC: %01X", crc);
112 auto *data = transmit.get_data();
113 data->set_carrier_frequency(38000);
119 for (
int byte_idx = 0; byte_idx < 8; byte_idx++) {
120 for (int8_t bit_idx = 7; bit_idx >= 0; bit_idx--) {
121 if ((byte_idx == 4) && (bit_idx == 4)) {
127 bool bit = remote_state[byte_idx] & (1 << bit_idx);
133 for (int8_t i = 3; i >= 0; i--) {
135 bool bit = crc & (1 << i);
149 ESP_LOGV(TAG,
"Header");
152 for (
int i = 0; i < 5; i++) {
153 for (
int j = 7; j >= 0; j--) {
154 if ((i == 4) && (j == 4)) {
156 ESP_LOGVV(TAG,
"GAP");
162 ESP_LOGVV(TAG,
"Byte %d bit %d fail", i, j);
176 for (
int i = 4; i < 8; i++) {
177 for (
int j = 7; j >= 0; j--) {
178 if ((i == 4) && (j >= 4)) {
183 ESP_LOGVV(TAG,
"Byte %d bit %d fail", i, j);
192 for (
int i = 3; i >= 0; i--) {
196 ESP_LOGVV(TAG,
"Bit %d CRC fail", i);
200 ESP_LOGV(TAG,
"CRC %02X", crc);
204 ESP_LOGV(TAG,
"Footer fail");
209 uint8_t crc_calculated = 0;
212 crc_calculated =
reverse_bits(uint8_t(crc_calculated & 0x0F)) >> 4;
213 ESP_LOGVV(TAG,
"CRC calc %02X", crc_calculated);
215 if (crc != crc_calculated) {
216 ESP_LOGV(TAG,
"CRC fail");
220 ESP_LOGD_HEX(TAG, this->remote_state_,
sizeof(this->remote_state_),
sizeof(this->remote_state_),
221 "Received noblex code: %s");
223 auto powered_on =
false;
233 ESP_LOGV(TAG,
"Power: %01X", powered_on);
237 auto mode = (this->remote_state_[0] & 0xE0) >> 5;
238 ESP_LOGV(TAG,
"Mode: %02X",
mode);
240 case IRNoblexMode::IR_NOBLEX_MODE_AUTO:
243 case IRNoblexMode::IR_NOBLEX_MODE_COOL:
246 case IRNoblexMode::IR_NOBLEX_MODE_DRY:
249 case IRNoblexMode::IR_NOBLEX_MODE_FAN:
252 case IRNoblexMode::IR_NOBLEX_MODE_HEAT:
261 uint8_t temp = this->remote_state_[1];
262 ESP_LOGVV(TAG,
"Temperature Raw: %02X", temp);
266 ESP_LOGV(TAG,
"Temperature Climate: %u", temp);
270 auto fan = (this->remote_state_[0] & 0x0C) >> 2;
271 ESP_LOGV(TAG,
"Fan: %02X", fan);
273 case IRNoblexFan::IR_NOBLEX_FAN_HIGH:
276 case IRNoblexFan::IR_NOBLEX_FAN_MEDIUM:
279 case IRNoblexFan::IR_NOBLEX_FAN_LOW:
282 case IRNoblexFan::IR_NOBLEX_FAN_AUTO:
289 if (this->remote_state_[0] & 0x02) {
290 ESP_LOGV(TAG,
"Swing vertical");
293 ESP_LOGV(TAG,
"Swing OFF");
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.
void transmit_state() override
Transmit via IR the state of this climate controller.
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
bool expect_item(uint32_t mark, uint32_t space)
RemoteTransmitterBase * transmitter_
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ 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_ON
The fan mode is set to On.
@ 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.
const uint16_t NOBLEX_ONE_SPACE
const uint16_t NOBLEX_HEADER_SPACE
const uint8_t NOBLEX_POWER
const uint16_t NOBLEX_ZERO_SPACE
const uint32_t NOBLEX_GAP
const uint16_t NOBLEX_HEADER_MARK
ESPHOME_LOG_TAG(TAG, "noblex.climate")
const uint16_t NOBLEX_BIT_MARK
enum IRNoblexMode { IR_NOBLEX_MODE_AUTO=0b000, IR_NOBLEX_MODE_COOL=0b100, IR_NOBLEX_MODE_DRY=0b010, IR_NOBLEX_MODE_FAN=0b110, IR_NOBLEX_MODE_HEAT=0b001, } IRNoblexMode
const uint8_t NOBLEX_TEMP_MIN
const uint8_t NOBLEX_TEMP_MAX
enum IRNoblexFan { IR_NOBLEX_FAN_AUTO=0b00, IR_NOBLEX_FAN_LOW=0b10, IR_NOBLEX_FAN_MEDIUM=0b01, IR_NOBLEX_FAN_HIGH=0b11, } IRNoblexFan
uint8_t reverse_bits(uint8_t x)
Reverse the order of 8 bits.