11static 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];
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) {
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) {
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);
480 if (
call.get_target_humidity().has_value()) {
This class is used to encode all control actions on a climate device.
const optional< float > & get_target_humidity() const
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.
float current_humidity
The current humidity of the climate device, as reported from the integration.
ClimateSwingMode swing_mode
The active swing mode of the climate device.
float current_temperature
The current temperature of the climate device, as reported from the integration.
void publish_state()
Publish the state of the climate device, to be called from integrations.
float target_humidity
The target humidity of the climate device.
This class contains all static data for climate devices.
void set_supports_current_humidity(bool supports_current_humidity)
void set_visual_min_humidity(float visual_min_humidity)
void set_supports_target_humidity(bool supports_target_humidity)
void set_visual_max_humidity(float visual_max_humidity)
void set_supports_current_temperature(bool supports_current_temperature)
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
climate::ClimateTraits traits() override
Return the traits of this controller.
void transmit_state() override
void control(const climate::ClimateCall &call) override
bool parse_state_frame_(const uint8_t frame[])
climate::ClimateTraits traits() override
uint8_t operation_mode_()
bool on_receive(remote_base::RemoteReceiveData data) override
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_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_HIGH
The fan mode is set to High.
const uint32_t DAIKIN_ZERO_SPACE
const uint32_t DAIKIN_HEADER_SPACE
const uint32_t DAIKIN_ARC_PRE_SPACE
const uint8_t DAIKIN_MODE_AUTO
const uint32_t DAIKIN_ARC_PRE_MARK
const uint32_t DAIKIN_MESSAGE_SPACE
const uint8_t DAIKIN_TEMP_MIN
const uint32_t DAIKIN_HEADER_MARK
const uint8_t DAIKIN_FAN_2
const uint8_t DAIKIN_FAN_5
const uint32_t DAIKIN_ONE_SPACE
const uint8_t DAIKIN_MODE_COOL
const uint32_t DAIKIN_BIT_MARK
const uint8_t DAIKIN_FAN_3
const uint8_t DAIKIN_FAN_4
const uint8_t DAIKIN_FAN_1
const uint32_t DAIKIN_IR_FREQUENCY
const uint8_t DAIKIN_MODE_FAN
const uint8_t DAIKIN_TEMP_MAX
const uint8_t DAIKIN_MODE_HEAT
const uint8_t DAIKIN_MODE_DRY
const uint8_t DAIKIN_STATE_FRAME_SIZE
const uint8_t DAIKIN_MODE_OFF
const uint8_t DAIKIN_FAN_SILENT
const uint8_t DAIKIN_FAN_AUTO
const uint8_t DAIKIN_MODE_ON
Providing packet encoding functions for exchanging data with a remote host.
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)