11 static const char *
const TAG =
"daikin.climate";
26 uint8_t remote_header[8] = {0x11, 0xDA, 0x27, 0x00, 0x84, 0x87, 0x20, 0x00};
29 for (
int i = 0; i <
sizeof(remote_header) - 1; i++) {
30 remote_header[
sizeof(remote_header) - 1] += remote_header[i];
43 for (uint8_t i : remote_header) {
44 for (uint8_t mask = 1; mask > 0; mask <<= 1) {
59 uint8_t remote_header[20] = {0x11, 0xDA, 0x27, 0x00, 0x02, 0xd0, 0x02, 0x03, 0x80, 0x03, 0x82, 0x30, 0x41, 0x1f, 0x82,
63 0x00, 0x24, 0x00, 0x00};
77 uint8_t remote_state[19] = {
78 0x11, 0xDA, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x60, 0x00, 0x0a, 0xC4,
94 static uint8_t last_humidity = 0x66;
96 ESP_LOGD(TAG,
"Set Humditiy: %d, %d\n", (
int) this->
target_humidity, (
int) remote_state[7]);
97 remote_header[9] |= 0x10;
98 last_humidity = remote_state[7];
101 remote_state[8] = fan_speed >> 8;
102 remote_state[9] = fan_speed & 0xff;
105 for (
int i = 0; i <
sizeof(remote_header) - 1; i++) {
106 remote_header[
sizeof(remote_header) - 1] += remote_header[i];
111 remote_state[DAIKIN_STATE_FRAME_SIZE - 1] += remote_state[i];
124 for (uint8_t i : remote_header) {
125 for (uint8_t mask = 1; mask > 0; mask <<= 1) {
137 for (uint8_t i : remote_state) {
138 for (uint8_t mask = 1; mask > 0; mask <<= 1) {
152 switch (this->
mode) {
174 return operating_mode;
213 switch (this->
mode) {
222 return temperature << 1 | (new_temp - temperature > 0 ? 0x01 : 0);
229 }
else if (this->target_humidity <= 40 || this->
target_humidity == 44) {
255 checksum += frame[i];
258 ESP_LOGI(TAG,
"checksum error");
264 sprintf(buf,
"%s%02x ", buf, frame[i]);
266 ESP_LOGD(TAG,
"FRAME %s", buf);
268 uint8_t
mode = frame[5];
270 switch (mode & 0xF0) {
291 if (!(temperature & 0xC0)) {
298 if (fan_mode & 0xF && swing_mode & 0xF) {
300 }
else if (fan_mode & 0xF) {
302 }
else if (swing_mode & 0xF) {
307 switch (fan_mode & 0xF0) {
350 bool valid_daikin_frame =
false;
352 valid_daikin_frame =
true;
353 int bytes_count = data.
size() / 2 / 8;
354 std::unique_ptr<char[]> buf(
new char[bytes_count * 3 + 1]);
356 for (
size_t i = 0; i < bytes_count; i++) {
358 for (int8_t bit = 0; bit < 8; bit++) {
362 valid_daikin_frame =
false;
366 sprintf(buf.get(),
"%s%02x ", buf.get(), byte);
368 ESP_LOGD(TAG,
"WHOLE FRAME %s size: %d", buf.get(), data.
size());
370 if (!valid_daikin_frame) {
371 char sbuf[16 * 10 + 1];
373 for (
size_t j = 0; j < data.
size(); j++) {
374 if ((j - 2) % 16 == 0) {
376 ESP_LOGD(TAG,
"DATA %04x: %s", (j - 16 > 0xffff ? 0 : j - 16), sbuf);
398 if (abs(data[j]) > 100000) {
399 sprintf(sbuf,
"%s%-5d[%c] ", sbuf, data[j] > 0 ? 99999 : -99999, type_ch);
401 sprintf(sbuf,
"%s%-5d[%c] ", sbuf, (
int) (round(data[j] / 10.) * 10), type_ch);
403 if (j == data.
size() - 1) {
404 ESP_LOGD(TAG,
"DATA %04x: %s", (j - 8 > 0xffff ? 0 : j - 8), sbuf);
412 ESP_LOGI(TAG,
"non daikin_arc expect item");
418 for (int8_t bit = 0; bit < 8; bit++) {
422 ESP_LOGI(TAG,
"non daikin_arc expect item pos: %d", pos);
426 state_frame[pos] = byte;
430 ESP_LOGI(TAG,
"non daikin_arc expect pos: %d header: %02x", pos, byte);
433 }
else if (pos == 1) {
436 ESP_LOGI(TAG,
"non daikin_arc expect pos: %d header: %02x", pos, byte);
439 }
else if (pos == 2) {
442 ESP_LOGI(TAG,
"non daikin_arc expect pos: %d header: %02x", pos, byte);
445 }
else if (pos == 3) {
448 ESP_LOGI(TAG,
"non daikin_arc expect pos: %d header: %02x", pos, byte);
451 }
else if (pos == 4) {
454 ESP_LOGI(TAG,
"non daikin_arc expect pos: %d header: %02x", pos, byte);
457 }
else if (pos == 5) {
458 if (data.
size() == 385) {
470 }
else if ((byte & 0x40) != 0x40) {
471 ESP_LOGI(TAG,
"non daikin_arc expect pos: %d header: %02x", pos, byte);
This class is used to encode all control actions on a climate device.
The fan mode is set to Low.
value_type const & value() const
const uint8_t DAIKIN_MODE_HEAT
float current_humidity
The current humidity of the climate device, as reported from the integration.
const uint32_t DAIKIN_MESSAGE_SPACE
ClimateSwingMode swing_mode
The active swing mode of the climate device.
void set_visual_min_humidity(float visual_min_humidity)
uint8_t operation_mode_()
The fan mode is set to Both.
float target_temperature
The target temperature of the climate device.
const uint32_t DAIKIN_ONE_SPACE
void set_carrier_frequency(uint32_t carrier_frequency)
void set_visual_max_humidity(float visual_max_humidity)
void set_supports_target_humidity(bool supports_target_humidity)
void set_supports_current_humidity(bool supports_current_humidity)
This class contains all static data for climate devices.
The climate device is set to heat to reach the target temperature.
ClimateMode mode
The active mode of the climate device.
const uint8_t DAIKIN_MODE_OFF
const uint8_t DAIKIN_TEMP_MAX
const uint8_t DAIKIN_MODE_COOL
float current_temperature
The current temperature of the climate device, as reported from the integration.
The climate device is set to dry/humidity mode.
const uint32_t DAIKIN_BIT_MARK
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
float target_humidity
The target humidity of the climate device.
void control(const climate::ClimateCall &call) override
const uint8_t DAIKIN_MODE_FAN
const uint32_t DAIKIN_HEADER_SPACE
The fan mode is set to Horizontal.
The climate device is set to cool to reach the target temperature.
const uint8_t DAIKIN_FAN_1
The fan mode is set to Auto.
const uint8_t DAIKIN_FAN_5
const uint8_t DAIKIN_TEMP_MIN
const uint32_t DAIKIN_HEADER_MARK
RemoteTransmitterBase * transmitter_
const uint32_t DAIKIN_ARC_PRE_SPACE
The climate device is set to heat/cool to reach the target temperature.
The fan mode is set to Vertical.
bool on_receive(remote_base::RemoteReceiveData data) override
void publish_state()
Publish the state of the climate device, to be called from integrations.
The fan mode is set to High.
RemoteTransmitData * get_data()
The swing mode is set to Off.
The climate device is off.
bool parse_state_frame_(const uint8_t frame[])
const uint8_t DAIKIN_MODE_DRY
const uint8_t DAIKIN_MODE_AUTO
const uint8_t DAIKIN_MODE_ON
climate::ClimateTraits traits() override
Return the traits of this controller.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
const uint8_t DAIKIN_FAN_SILENT
const uint32_t DAIKIN_IR_FREQUENCY
void transmit_state() override
const uint8_t DAIKIN_STATE_FRAME_SIZE
Implementation of SPI Controller mode.
climate::ClimateTraits traits() override
const uint8_t DAIKIN_FAN_4
void set_supports_current_temperature(bool supports_current_temperature)
The fan mode is set to Medium.
const uint32_t DAIKIN_ARC_PRE_MARK
bool expect_item(uint32_t mark, uint32_t space)
The climate device only has the fan enabled, no heating or cooling is taking place.
const uint32_t DAIKIN_ZERO_SPACE
const uint8_t DAIKIN_FAN_2
const optional< float > & get_target_humidity() const
const uint8_t DAIKIN_FAN_3
const uint8_t DAIKIN_FAN_AUTO