esphome 2024.11.2__py3-none-any.whl → 2024.12.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. esphome/__main__.py +1 -1
  2. esphome/components/adc/adc_sensor.h +7 -8
  3. esphome/components/adc/adc_sensor_common.cpp +24 -0
  4. esphome/components/adc/{adc_sensor.cpp → adc_sensor_esp32.cpp} +10 -179
  5. esphome/components/adc/adc_sensor_esp8266.cpp +58 -0
  6. esphome/components/adc/adc_sensor_libretiny.cpp +48 -0
  7. esphome/components/adc/adc_sensor_rp2040.cpp +93 -0
  8. esphome/components/alarm_control_panel/alarm_control_panel_call.cpp +3 -4
  9. esphome/components/animation/__init__.py +1 -2
  10. esphome/components/apds9306/apds9306.cpp +2 -1
  11. esphome/components/audio/audio.h +1 -1
  12. esphome/components/bk72xx/__init__.py +1 -1
  13. esphome/components/cse7766/cse7766.cpp +1 -1
  14. esphome/components/datetime/datetime_entity.cpp +1 -3
  15. esphome/components/deep_sleep/deep_sleep_esp32.cpp +2 -2
  16. esphome/components/dht/dht.cpp +2 -1
  17. esphome/components/display/display.cpp +10 -6
  18. esphome/components/display/display.h +14 -0
  19. esphome/components/display_menu_base/__init__.py +0 -2
  20. esphome/components/display_menu_base/display_menu_base.cpp +1 -1
  21. esphome/components/dsmr/dsmr.cpp +1 -1
  22. esphome/components/esp32/__init__.py +100 -22
  23. esphome/components/esp32/boards.py +222 -14
  24. esphome/components/esp32_ble/__init__.py +22 -2
  25. esphome/components/esp32_ble/ble.cpp +39 -12
  26. esphome/components/esp32_ble/ble.h +2 -0
  27. esphome/components/esp32_ble/ble_advertising.cpp +1 -1
  28. esphome/components/esp32_ble/ble_uuid.cpp +9 -10
  29. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +4 -1
  30. esphome/components/esp32_camera_web_server/camera_web_server.h +1 -1
  31. esphome/components/esp32_rmt_led_strip/light.py +3 -3
  32. esphome/components/esp8266/__init__.py +5 -7
  33. esphome/components/ezo/ezo.cpp +14 -26
  34. esphome/components/font/__init__.py +10 -25
  35. esphome/components/font/font.cpp +5 -3
  36. esphome/components/graphical_display_menu/__init__.py +2 -0
  37. esphome/components/haier/hon_climate.cpp +79 -80
  38. esphome/components/hbridge/switch/__init__.py +44 -0
  39. esphome/components/hbridge/switch/hbridge_switch.cpp +95 -0
  40. esphome/components/hbridge/switch/hbridge_switch.h +50 -0
  41. esphome/components/hitachi_ac344/hitachi_ac344.cpp +4 -2
  42. esphome/components/hitachi_ac424/hitachi_ac424.cpp +4 -2
  43. esphome/components/homeassistant/number/homeassistant_number.cpp +3 -0
  44. esphome/components/hx711/hx711.cpp +1 -1
  45. esphome/components/hx711/hx711.h +1 -1
  46. esphome/components/i2c/i2c_bus_esp_idf.cpp +2 -2
  47. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +61 -59
  48. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -17
  49. esphome/components/ili9xxx/display.py +1 -2
  50. esphome/components/ili9xxx/ili9xxx_display.cpp +3 -2
  51. esphome/components/image/__init__.py +1 -2
  52. esphome/components/logger/logger.cpp +1 -1
  53. esphome/components/ltr501/ltr501.cpp +1 -1
  54. esphome/components/lvgl/defines.py +9 -2
  55. esphome/components/lvgl/lv_validation.py +8 -3
  56. esphome/components/lvgl/lvgl_esphome.cpp +1 -1
  57. esphome/components/lvgl/lvgl_esphome.h +19 -0
  58. esphome/components/lvgl/widgets/animimg.py +12 -17
  59. esphome/components/lvgl/widgets/img.py +1 -3
  60. esphome/components/lvgl/widgets/line.py +6 -0
  61. esphome/components/lvgl/widgets/msgbox.py +2 -1
  62. esphome/components/matrix_keypad/__init__.py +15 -3
  63. esphome/components/matrix_keypad/matrix_keypad.cpp +4 -0
  64. esphome/components/matrix_keypad/matrix_keypad.h +5 -0
  65. esphome/components/max31865/max31865.cpp +4 -2
  66. esphome/components/modbus_controller/modbus_controller.cpp +24 -24
  67. esphome/components/modbus_controller/modbus_controller.h +22 -22
  68. esphome/components/modbus_controller/number/modbus_number.cpp +8 -8
  69. esphome/components/modbus_controller/number/modbus_number.h +4 -4
  70. esphome/components/modbus_controller/output/modbus_output.cpp +7 -6
  71. esphome/components/modbus_controller/output/modbus_output.h +5 -5
  72. esphome/components/modbus_controller/select/modbus_select.cpp +4 -3
  73. esphome/components/modbus_controller/select/modbus_select.h +4 -4
  74. esphome/components/modbus_controller/switch/modbus_switch.cpp +5 -5
  75. esphome/components/modbus_controller/switch/modbus_switch.h +2 -2
  76. esphome/components/mqtt/__init__.py +4 -0
  77. esphome/components/mqtt/mqtt_alarm_control_panel.cpp +2 -5
  78. esphome/components/mqtt/mqtt_backend_esp32.cpp +3 -3
  79. esphome/components/mqtt/mqtt_client.cpp +4 -0
  80. esphome/components/mqtt/mqtt_client.h +6 -0
  81. esphome/components/mqtt/mqtt_climate.cpp +13 -3
  82. esphome/components/mqtt/mqtt_sensor.cpp +2 -0
  83. esphome/components/network/ip_address.h +1 -1
  84. esphome/components/nextion/__init__.py +2 -0
  85. esphome/components/nextion/automation.h +76 -0
  86. esphome/components/nextion/base_component.py +1 -0
  87. esphome/components/nextion/binary_sensor/__init__.py +43 -2
  88. esphome/components/nextion/display.py +15 -0
  89. esphome/components/nextion/nextion.cpp +8 -5
  90. esphome/components/nextion/nextion.h +7 -0
  91. esphome/components/nextion/nextion_upload_idf.cpp +2 -2
  92. esphome/components/nextion/sensor/__init__.py +38 -5
  93. esphome/components/nextion/switch/__init__.py +38 -2
  94. esphome/components/nextion/text_sensor/__init__.py +37 -2
  95. esphome/components/nfc/ndef_record.cpp +3 -3
  96. esphome/components/online_image/__init__.py +1 -0
  97. esphome/components/online_image/png_image.cpp +4 -0
  98. esphome/components/opentherm/hub.cpp +6 -7
  99. esphome/components/opentherm/opentherm.cpp +18 -34
  100. esphome/components/opentherm/opentherm.h +4 -5
  101. esphome/components/ota/automation.h +1 -1
  102. esphome/components/output/float_output.cpp +1 -1
  103. esphome/components/pca6416a/pca6416a.cpp +5 -3
  104. esphome/components/pca9554/pca9554.cpp +4 -4
  105. esphome/components/pipsolar/pipsolar.cpp +2 -2
  106. esphome/components/pipsolar/switch/pipsolar_switch.cpp +2 -2
  107. esphome/components/pn532/pn532_mifare_ultralight.cpp +2 -2
  108. esphome/components/pn7150/pn7150_mifare_ultralight.cpp +2 -2
  109. esphome/components/pn7160/pn7160_mifare_ultralight.cpp +2 -2
  110. esphome/components/qmc5883l/qmc5883l.cpp +45 -19
  111. esphome/components/qmc5883l/qmc5883l.h +1 -1
  112. esphome/components/qspi_dbi/qspi_dbi.cpp +2 -1
  113. esphome/components/remote_base/raw_protocol.cpp +1 -1
  114. esphome/components/remote_receiver/__init__.py +5 -6
  115. esphome/components/rotary_encoder/rotary_encoder.cpp +3 -1
  116. esphome/components/rp2040/__init__.py +1 -1
  117. esphome/components/rtl87xx/__init__.py +1 -1
  118. esphome/components/safe_mode/automation.h +1 -1
  119. esphome/components/seeed_mr60bha2/__init__.py +41 -0
  120. esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +173 -0
  121. esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +61 -0
  122. esphome/components/seeed_mr60bha2/sensor.py +57 -0
  123. esphome/components/seeed_mr60fda2/__init__.py +41 -0
  124. esphome/components/seeed_mr60fda2/binary_sensor.py +33 -0
  125. esphome/components/seeed_mr60fda2/button/__init__.py +45 -0
  126. esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.cpp +9 -0
  127. esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.h +18 -0
  128. esphome/components/seeed_mr60fda2/button/reset_radar_button.cpp +9 -0
  129. esphome/components/seeed_mr60fda2/button/reset_radar_button.h +18 -0
  130. esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp +368 -0
  131. esphome/components/seeed_mr60fda2/seeed_mr60fda2.h +101 -0
  132. esphome/components/seeed_mr60fda2/select/__init__.py +59 -0
  133. esphome/components/seeed_mr60fda2/select/height_threshold_select.cpp +15 -0
  134. esphome/components/seeed_mr60fda2/select/height_threshold_select.h +18 -0
  135. esphome/components/seeed_mr60fda2/select/install_height_select.cpp +15 -0
  136. esphome/components/seeed_mr60fda2/select/install_height_select.h +18 -0
  137. esphome/components/seeed_mr60fda2/select/sensitivity_select.cpp +15 -0
  138. esphome/components/seeed_mr60fda2/select/sensitivity_select.h +18 -0
  139. esphome/components/sen5x/sensor.py +5 -6
  140. esphome/components/sgp30/sensor.py +8 -9
  141. esphome/components/sgp30/sgp30.cpp +2 -6
  142. esphome/components/shelly_dimmer/shelly_dimmer.cpp +1 -1
  143. esphome/components/sim800l/sim800l.cpp +1 -1
  144. esphome/components/sntp/sntp_component.cpp +14 -20
  145. esphome/components/sntp/sntp_component.h +6 -9
  146. esphome/components/sntp/time.py +4 -7
  147. esphome/components/sprinkler/sprinkler.cpp +2 -2
  148. esphome/components/st7735/st7735.cpp +1 -1
  149. esphome/components/st7789v/st7789v.cpp +1 -1
  150. esphome/components/st7920/st7920.cpp +2 -3
  151. esphome/components/stepper/stepper.h +0 -1
  152. esphome/components/sun_gtil2/sun_gtil2.cpp +1 -1
  153. esphome/components/switch/binary_sensor/__init__.py +31 -0
  154. esphome/components/switch/binary_sensor/switch_binary_sensor.cpp +17 -0
  155. esphome/components/switch/binary_sensor/switch_binary_sensor.h +22 -0
  156. esphome/components/sx1509/sx1509_gpio_pin.cpp +2 -1
  157. esphome/components/sx1509/sx1509_gpio_pin.h +5 -5
  158. esphome/components/uart/uart.h +1 -1
  159. esphome/components/udp/udp_component.cpp +32 -16
  160. esphome/components/ufire_ec/sensor.py +4 -4
  161. esphome/components/uln2003/uln2003.cpp +4 -1
  162. esphome/components/waveshare_epaper/display.py +8 -0
  163. esphome/components/waveshare_epaper/waveshare_epaper.cpp +191 -0
  164. esphome/components/waveshare_epaper/waveshare_epaper.h +56 -0
  165. esphome/components/wiegand/__init__.py +3 -4
  166. esphome/components/wifi/__init__.py +42 -0
  167. esphome/components/wifi/wifi_component.cpp +2 -2
  168. esphome/components/wifi/wifi_component.h +82 -1
  169. esphome/components/wifi/wifi_component_esp32_arduino.cpp +1 -1
  170. esphome/components/wifi/wifi_component_esp8266.cpp +1 -1
  171. esphome/components/wifi/wifi_component_esp_idf.cpp +1 -1
  172. esphome/components/wifi/wifi_component_libretiny.cpp +1 -1
  173. esphome/components/wifi/wifi_component_pico_w.cpp +1 -1
  174. esphome/components/wireguard/wireguard.cpp +2 -2
  175. esphome/components/xiaomi_ble/xiaomi_ble.cpp +1 -1
  176. esphome/config_validation.py +15 -11
  177. esphome/const.py +11 -1
  178. esphome/core/component.cpp +1 -1
  179. esphome/core/config.py +1 -2
  180. esphome/core/defines.h +3 -1
  181. esphome/core/helpers.cpp +20 -2
  182. esphome/core/helpers.h +10 -1
  183. esphome/core/optional.h +2 -2
  184. esphome/core/time.cpp +19 -15
  185. esphome/core/time.h +1 -3
  186. esphome/dashboard/web_server.py +6 -0
  187. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/METADATA +4 -4
  188. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/RECORD +192 -162
  189. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/LICENSE +0 -0
  190. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/WHEEL +0 -0
  191. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/entry_points.txt +0 -0
  192. {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/top_level.txt +0 -0
@@ -34,7 +34,7 @@ ESPBTUUID ESPBTUUID::from_raw(const uint8_t *data) {
34
34
  ESPBTUUID ESPBTUUID::from_raw_reversed(const uint8_t *data) {
35
35
  ESPBTUUID ret;
36
36
  ret.uuid_.len = ESP_UUID_LEN_128;
37
- for (int i = 0; i < ESP_UUID_LEN_128; i++)
37
+ for (uint8_t i = 0; i < ESP_UUID_LEN_128; i++)
38
38
  ret.uuid_.uuid.uuid128[ESP_UUID_LEN_128 - 1 - i] = data[i];
39
39
  return ret;
40
40
  }
@@ -43,30 +43,30 @@ ESPBTUUID ESPBTUUID::from_raw(const std::string &data) {
43
43
  if (data.length() == 4) {
44
44
  ret.uuid_.len = ESP_UUID_LEN_16;
45
45
  ret.uuid_.uuid.uuid16 = 0;
46
- for (int i = 0; i < data.length();) {
46
+ for (uint i = 0; i < data.length(); i += 2) {
47
47
  uint8_t msb = data.c_str()[i];
48
48
  uint8_t lsb = data.c_str()[i + 1];
49
+ uint8_t lsb_shift = i <= 2 ? (2 - i) * 4 : 0;
49
50
 
50
51
  if (msb > '9')
51
52
  msb -= 7;
52
53
  if (lsb > '9')
53
54
  lsb -= 7;
54
- ret.uuid_.uuid.uuid16 += (((msb & 0x0F) << 4) | (lsb & 0x0F)) << (2 - i) * 4;
55
- i += 2;
55
+ ret.uuid_.uuid.uuid16 += (((msb & 0x0F) << 4) | (lsb & 0x0F)) << lsb_shift;
56
56
  }
57
57
  } else if (data.length() == 8) {
58
58
  ret.uuid_.len = ESP_UUID_LEN_32;
59
59
  ret.uuid_.uuid.uuid32 = 0;
60
- for (int i = 0; i < data.length();) {
60
+ for (uint i = 0; i < data.length(); i += 2) {
61
61
  uint8_t msb = data.c_str()[i];
62
62
  uint8_t lsb = data.c_str()[i + 1];
63
+ uint8_t lsb_shift = i <= 6 ? (6 - i) * 4 : 0;
63
64
 
64
65
  if (msb > '9')
65
66
  msb -= 7;
66
67
  if (lsb > '9')
67
68
  lsb -= 7;
68
- ret.uuid_.uuid.uuid32 += (((msb & 0x0F) << 4) | (lsb & 0x0F)) << (6 - i) * 4;
69
- i += 2;
69
+ ret.uuid_.uuid.uuid32 += (((msb & 0x0F) << 4) | (lsb & 0x0F)) << lsb_shift;
70
70
  }
71
71
  } else if (data.length() == 16) { // how we can have 16 byte length string reprezenting 128 bit uuid??? needs to be
72
72
  // investigated (lack of time)
@@ -77,7 +77,7 @@ ESPBTUUID ESPBTUUID::from_raw(const std::string &data) {
77
77
  // UUID format.
78
78
  ret.uuid_.len = ESP_UUID_LEN_128;
79
79
  int n = 0;
80
- for (int i = 0; i < data.length();) {
80
+ for (uint i = 0; i < data.length(); i += 2) {
81
81
  if (data.c_str()[i] == '-')
82
82
  i++;
83
83
  uint8_t msb = data.c_str()[i];
@@ -88,7 +88,6 @@ ESPBTUUID ESPBTUUID::from_raw(const std::string &data) {
88
88
  if (lsb > '9')
89
89
  lsb -= 7;
90
90
  ret.uuid_.uuid.uuid128[15 - n++] = ((msb & 0x0F) << 4) | (lsb & 0x0F);
91
- i += 2;
92
91
  }
93
92
  } else {
94
93
  ESP_LOGE(TAG, "ERROR: UUID value not 2, 4, 16 or 36 bytes - %s", data.c_str());
@@ -155,7 +154,7 @@ bool ESPBTUUID::operator==(const ESPBTUUID &uuid) const {
155
154
  }
156
155
  break;
157
156
  case ESP_UUID_LEN_128:
158
- for (int i = 0; i < ESP_UUID_LEN_128; i++) {
157
+ for (uint8_t i = 0; i < ESP_UUID_LEN_128; i++) {
159
158
  if (uuid.uuid_.uuid.uuid128[i] != this->uuid_.uuid.uuid128[i]) {
160
159
  return false;
161
160
  }
@@ -432,7 +432,7 @@ void ESPBTDevice::parse_scan_rst(const esp_ble_gap_cb_param_t::ble_scan_result_e
432
432
 
433
433
  #ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
434
434
  ESP_LOGVV(TAG, "Parse Result:");
435
- const char *address_type = "";
435
+ const char *address_type;
436
436
  switch (this->address_type_) {
437
437
  case BLE_ADDR_TYPE_PUBLIC:
438
438
  address_type = "PUBLIC";
@@ -446,6 +446,9 @@ void ESPBTDevice::parse_scan_rst(const esp_ble_gap_cb_param_t::ble_scan_result_e
446
446
  case BLE_ADDR_TYPE_RPA_RANDOM:
447
447
  address_type = "RPA_RANDOM";
448
448
  break;
449
+ default:
450
+ address_type = "UNKNOWN";
451
+ break;
449
452
  }
450
453
  ESP_LOGVV(TAG, " Address: %02X:%02X:%02X:%02X:%02X:%02X (%s)", this->address_[0], this->address_[1],
451
454
  this->address_[2], this->address_[3], this->address_[4], this->address_[5], address_type);
@@ -11,7 +11,7 @@
11
11
  #include "esphome/core/helpers.h"
12
12
  #include "esphome/core/preferences.h"
13
13
 
14
- struct httpd_req;
14
+ struct httpd_req; // NOLINT(readability-identifier-naming)
15
15
 
16
16
  namespace esphome {
17
17
  namespace esp32_camera_web_server {
@@ -1,9 +1,9 @@
1
1
  from dataclasses import dataclass
2
2
 
3
- import esphome.codegen as cg
4
- import esphome.config_validation as cv
5
3
  from esphome import pins
4
+ import esphome.codegen as cg
6
5
  from esphome.components import esp32_rmt, light
6
+ import esphome.config_validation as cv
7
7
  from esphome.const import (
8
8
  CONF_CHIPSET,
9
9
  CONF_IS_RGBW,
@@ -103,7 +103,7 @@ CONFIG_SCHEMA = cv.All(
103
103
  default="0 us",
104
104
  ): cv.positive_time_period_nanoseconds,
105
105
  }
106
- ),
106
+ ).extend(cv.COMPONENT_SCHEMA),
107
107
  cv.has_exactly_one_key(CONF_CHIPSET, CONF_BIT0_HIGH),
108
108
  )
109
109
 
@@ -1,10 +1,13 @@
1
1
  import logging
2
2
  import os
3
3
 
4
+ import esphome.codegen as cg
5
+ import esphome.config_validation as cv
4
6
  from esphome.const import (
5
7
  CONF_BOARD,
6
8
  CONF_BOARD_FLASH_MODE,
7
9
  CONF_FRAMEWORK,
10
+ CONF_PLATFORM_VERSION,
8
11
  CONF_SOURCE,
9
12
  CONF_VERSION,
10
13
  KEY_CORE,
@@ -12,27 +15,22 @@ from esphome.const import (
12
15
  KEY_TARGET_FRAMEWORK,
13
16
  KEY_TARGET_PLATFORM,
14
17
  PLATFORM_ESP8266,
15
- CONF_PLATFORM_VERSION,
16
18
  )
17
19
  from esphome.core import CORE, coroutine_with_priority
18
- import esphome.config_validation as cv
19
- import esphome.codegen as cg
20
20
  from esphome.helpers import copy_file_if_changed
21
21
 
22
+ from .boards import BOARDS, ESP8266_LD_SCRIPTS
22
23
  from .const import (
23
- CONF_RESTORE_FROM_FLASH,
24
24
  CONF_EARLY_PIN_INIT,
25
+ CONF_RESTORE_FROM_FLASH,
25
26
  KEY_BOARD,
26
27
  KEY_ESP8266,
27
28
  KEY_FLASH_SIZE,
28
29
  KEY_PIN_INITIAL_STATES,
29
30
  esp8266_ns,
30
31
  )
31
- from .boards import BOARDS, ESP8266_LD_SCRIPTS
32
-
33
32
  from .gpio import PinInitialState, add_pin_initial_states_array
34
33
 
35
-
36
34
  CODEOWNERS = ["@esphome/core"]
37
35
  _LOGGER = logging.getLogger(__name__)
38
36
  AUTO_LOAD = ["preferences"]
@@ -111,11 +111,11 @@ void EZOSensor::loop() {
111
111
  if (buf[0] == 1) {
112
112
  std::string payload = reinterpret_cast<char *>(&buf[1]);
113
113
  if (!payload.empty()) {
114
+ auto start_location = payload.find(',');
114
115
  switch (to_run->command_type) {
115
116
  case EzoCommandType::EZO_READ: {
116
117
  // some sensors return multiple comma-separated values, terminate string after first one
117
- int start_location = 0;
118
- if ((start_location = payload.find(',')) != std::string::npos) {
118
+ if (start_location != std::string::npos) {
119
119
  payload.erase(start_location);
120
120
  }
121
121
  auto val = parse_number<float>(payload);
@@ -126,49 +126,37 @@ void EZOSensor::loop() {
126
126
  }
127
127
  break;
128
128
  }
129
- case EzoCommandType::EZO_LED: {
129
+ case EzoCommandType::EZO_LED:
130
130
  this->led_callback_.call(payload.back() == '1');
131
131
  break;
132
- }
133
- case EzoCommandType::EZO_DEVICE_INFORMATION: {
134
- int start_location = 0;
135
- if ((start_location = payload.find(',')) != std::string::npos) {
132
+ case EzoCommandType::EZO_DEVICE_INFORMATION:
133
+ if (start_location != std::string::npos) {
136
134
  this->device_infomation_callback_.call(payload.substr(start_location + 1));
137
135
  }
138
136
  break;
139
- }
140
- case EzoCommandType::EZO_SLOPE: {
141
- int start_location = 0;
142
- if ((start_location = payload.find(',')) != std::string::npos) {
137
+ case EzoCommandType::EZO_SLOPE:
138
+ if (start_location != std::string::npos) {
143
139
  this->slope_callback_.call(payload.substr(start_location + 1));
144
140
  }
145
141
  break;
146
- }
147
- case EzoCommandType::EZO_CALIBRATION: {
148
- int start_location = 0;
149
- if ((start_location = payload.find(',')) != std::string::npos) {
142
+ case EzoCommandType::EZO_CALIBRATION:
143
+ if (start_location != std::string::npos) {
150
144
  this->calibration_callback_.call(payload.substr(start_location + 1));
151
145
  }
152
146
  break;
153
- }
154
- case EzoCommandType::EZO_T: {
155
- int start_location = 0;
156
- if ((start_location = payload.find(',')) != std::string::npos) {
147
+ case EzoCommandType::EZO_T:
148
+ if (start_location != std::string::npos) {
157
149
  this->t_callback_.call(payload.substr(start_location + 1));
158
150
  }
159
151
  break;
160
- }
161
- case EzoCommandType::EZO_CUSTOM: {
152
+ case EzoCommandType::EZO_CUSTOM:
162
153
  this->custom_callback_.call(payload);
163
154
  break;
164
- }
165
- default: {
155
+ default:
166
156
  break;
167
- }
168
157
  }
169
158
  }
170
159
  }
171
-
172
160
  this->commands_.pop_front();
173
161
  }
174
162
 
@@ -178,7 +166,7 @@ void EZOSensor::add_command_(const std::string &command, EzoCommandType command_
178
166
  ezo_command->command_type = command_type;
179
167
  ezo_command->delay_ms = delay_ms;
180
168
  this->commands_.push_back(std::move(ezo_command));
181
- };
169
+ }
182
170
 
183
171
  void EZOSensor::set_calibration_point_(EzoCalibrationType type, float value) {
184
172
  std::string payload = str_sprintf("Cal,%s,%0.2f", EZO_CALIBRATION_TYPE_STRINGS[type], value);
@@ -1,4 +1,3 @@
1
- from collections.abc import Iterable
2
1
  import functools
3
2
  import hashlib
4
3
  import logging
@@ -8,7 +7,6 @@ import re
8
7
 
9
8
  import freetype
10
9
  import glyphsets
11
- from packaging import version
12
10
  import requests
13
11
 
14
12
  from esphome import core, external_files
@@ -53,8 +51,11 @@ CONF_IGNORE_MISSING_GLYPHS = "ignore_missing_glyphs"
53
51
  # Cache loaded freetype fonts
54
52
  class FontCache(dict):
55
53
  def __missing__(self, key):
56
- res = self[key] = freetype.Face(key)
57
- return res
54
+ try:
55
+ res = self[key] = freetype.Face(key)
56
+ return res
57
+ except freetype.FT_Exception as e:
58
+ raise cv.Invalid(f"Could not load Font file {key}: {e}") from e
58
59
 
59
60
 
60
61
  FONT_CACHE = FontCache()
@@ -88,7 +89,7 @@ def flatten(lists) -> list:
88
89
  return list(chain.from_iterable(lists))
89
90
 
90
91
 
91
- def check_missing_glyphs(file, codepoints: Iterable, warning: bool = False):
92
+ def check_missing_glyphs(file, codepoints, warning: bool = False):
92
93
  """
93
94
  Check that the given font file actually contains the requested glyphs
94
95
  :param file: A Truetype font file
@@ -177,24 +178,6 @@ def validate_glyphs(config):
177
178
  return config
178
179
 
179
180
 
180
- def validate_pillow_installed(value):
181
- try:
182
- import PIL
183
- except ImportError as err:
184
- raise cv.Invalid(
185
- "Please install the pillow python package to use this feature. "
186
- '(pip install "pillow==10.4.0")'
187
- ) from err
188
-
189
- if version.parse(PIL.__version__) != version.parse("10.4.0"):
190
- raise cv.Invalid(
191
- "Please update your pillow installation to 10.4.0. "
192
- '(pip install "pillow==10.4.0")'
193
- )
194
-
195
- return value
196
-
197
-
198
181
  FONT_EXTENSIONS = (".ttf", ".woff", ".otf")
199
182
 
200
183
 
@@ -393,7 +376,9 @@ def font_file_schema(value):
393
376
  # Default if no glyphs or glyphsets are provided
394
377
  DEFAULT_GLYPHSET = "GF_Latin_Kernel"
395
378
  # default for bitmap fonts
396
- DEFAULT_GLYPHS = ' !"%()+=,-.:/?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz<C2><B0>'
379
+ DEFAULT_GLYPHS = (
380
+ ' !"%()+=,-.:/?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz°'
381
+ )
397
382
 
398
383
  CONF_RAW_GLYPH_ID = "raw_glyph_id"
399
384
 
@@ -421,7 +406,7 @@ FONT_SCHEMA = cv.Schema(
421
406
  },
422
407
  )
423
408
 
424
- CONFIG_SCHEMA = cv.All(validate_pillow_installed, FONT_SCHEMA, validate_glyphs)
409
+ CONFIG_SCHEMA = cv.All(FONT_SCHEMA, validate_glyphs)
425
410
 
426
411
 
427
412
  # PIL doesn't provide a consistent interface for both TrueType and bitmap
@@ -133,9 +133,11 @@ void Font::print(int x_start, int y_start, display::Display *display, Color colo
133
133
  auto diff_r = (float) color.r - (float) background.r;
134
134
  auto diff_g = (float) color.g - (float) background.g;
135
135
  auto diff_b = (float) color.b - (float) background.b;
136
+ auto diff_w = (float) color.w - (float) background.w;
136
137
  auto b_r = (float) background.r;
137
138
  auto b_g = (float) background.g;
138
- auto b_b = (float) background.g;
139
+ auto b_b = (float) background.b;
140
+ auto b_w = (float) background.w;
139
141
  for (int glyph_y = y_start + scan_y1; glyph_y != max_y; glyph_y++) {
140
142
  for (int glyph_x = x_at + scan_x1; glyph_x != max_x; glyph_x++) {
141
143
  uint8_t pixel = 0;
@@ -153,8 +155,8 @@ void Font::print(int x_start, int y_start, display::Display *display, Color colo
153
155
  display->draw_pixel_at(glyph_x, glyph_y, color);
154
156
  } else if (pixel != 0) {
155
157
  auto on = (float) pixel / (float) bpp_max;
156
- auto blended =
157
- Color((uint8_t) (diff_r * on + b_r), (uint8_t) (diff_g * on + b_g), (uint8_t) (diff_b * on + b_b));
158
+ auto blended = Color((uint8_t) (diff_r * on + b_r), (uint8_t) (diff_g * on + b_g),
159
+ (uint8_t) (diff_b * on + b_b), (uint8_t) (diff_w * on + b_w));
158
160
  display->draw_pixel_at(glyph_x, glyph_y, blended);
159
161
  }
160
162
  }
@@ -36,6 +36,8 @@ CODEOWNERS = ["@MrMDavidson"]
36
36
 
37
37
  AUTO_LOAD = ["display_menu_base"]
38
38
 
39
+ MULTI_CONF = True
40
+
39
41
  CONFIG_SCHEMA = DISPLAY_MENU_BASE_SCHEMA.extend(
40
42
  cv.Schema(
41
43
  {
@@ -35,7 +35,9 @@ void HonClimate::set_beeper_state(bool state) {
35
35
  if (state != this->settings_.beeper_state) {
36
36
  this->settings_.beeper_state = state;
37
37
  #ifdef USE_SWITCH
38
- this->beeper_switch_->publish_state(state);
38
+ if (this->beeper_switch_ != nullptr) {
39
+ this->beeper_switch_->publish_state(state);
40
+ }
39
41
  #endif
40
42
  this->hon_rtc_.save(&this->settings_);
41
43
  }
@@ -45,10 +47,17 @@ bool HonClimate::get_beeper_state() const { return this->settings_.beeper_state;
45
47
 
46
48
  void HonClimate::set_quiet_mode_state(bool state) {
47
49
  if (state != this->get_quiet_mode_state()) {
48
- this->quiet_mode_state_ = state ? SwitchState::PENDING_ON : SwitchState::PENDING_OFF;
50
+ if ((this->mode != ClimateMode::CLIMATE_MODE_OFF) && (this->mode != ClimateMode::CLIMATE_MODE_FAN_ONLY)) {
51
+ this->quiet_mode_state_ = state ? SwitchState::PENDING_ON : SwitchState::PENDING_OFF;
52
+ this->force_send_control_ = true;
53
+ } else {
54
+ this->quiet_mode_state_ = state ? SwitchState::ON : SwitchState::OFF;
55
+ }
49
56
  this->settings_.quiet_mode_state = state;
50
57
  #ifdef USE_SWITCH
51
- this->quiet_mode_switch_->publish_state(state);
58
+ if (this->quiet_mode_switch_ != nullptr) {
59
+ this->quiet_mode_switch_->publish_state(state);
60
+ }
52
61
  #endif
53
62
  this->hon_rtc_.save(&this->settings_);
54
63
  }
@@ -509,7 +518,7 @@ void HonClimate::initialization() {
509
518
  }
510
519
  this->current_vertical_swing_ = this->settings_.last_vertiacal_swing;
511
520
  this->current_horizontal_swing_ = this->settings_.last_horizontal_swing;
512
- this->quiet_mode_state_ = this->settings_.quiet_mode_state ? SwitchState::PENDING_ON : SwitchState::PENDING_OFF;
521
+ this->quiet_mode_state_ = this->settings_.quiet_mode_state ? SwitchState::ON : SwitchState::OFF;
513
522
  }
514
523
 
515
524
  haier_protocol::HaierMessage HonClimate::get_control_message() {
@@ -932,7 +941,7 @@ haier_protocol::HandlerError HonClimate::process_status_message_(const uint8_t *
932
941
  if (this->mode == CLIMATE_MODE_OFF) {
933
942
  // AC just turned on from remote need to turn off display
934
943
  this->force_send_control_ = true;
935
- } else if ((((uint8_t) this->health_mode_) & 0b10) == 0) {
944
+ } else if ((((uint8_t) this->display_status_) & 0b10) == 0) {
936
945
  this->display_status_ = disp_status ? SwitchState::ON : SwitchState::OFF;
937
946
  }
938
947
  }
@@ -1004,6 +1013,11 @@ haier_protocol::HandlerError HonClimate::process_status_message_(const uint8_t *
1004
1013
  if (new_quiet_mode != this->get_quiet_mode_state()) {
1005
1014
  this->quiet_mode_state_ = new_quiet_mode ? SwitchState::ON : SwitchState::OFF;
1006
1015
  this->settings_.quiet_mode_state = new_quiet_mode;
1016
+ #ifdef USE_SWITCH
1017
+ if (this->quiet_mode_switch_ != nullptr) {
1018
+ this->quiet_mode_switch_->publish_state(new_quiet_mode);
1019
+ }
1020
+ #endif // USE_SWITCH
1007
1021
  this->hon_rtc_.save(&this->settings_);
1008
1022
  }
1009
1023
  }
@@ -1069,19 +1083,17 @@ void HonClimate::fill_control_messages_queue_() {
1069
1083
  climate_control = this->current_hvac_settings_;
1070
1084
  // Beeper command
1071
1085
  {
1072
- this->control_messages_queue_.push(
1073
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1074
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1075
- (uint8_t) hon_protocol::DataParameters::BEEPER_STATUS,
1076
- this->get_beeper_state() ? ZERO_BUF : ONE_BUF, 2));
1086
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1087
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1088
+ (uint8_t) hon_protocol::DataParameters::BEEPER_STATUS,
1089
+ this->get_beeper_state() ? ZERO_BUF : ONE_BUF, 2);
1077
1090
  }
1078
1091
  // Health mode
1079
1092
  {
1080
- this->control_messages_queue_.push(
1081
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1082
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1083
- (uint8_t) hon_protocol::DataParameters::HEALTH_MODE,
1084
- this->get_health_mode() ? ONE_BUF : ZERO_BUF, 2));
1093
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1094
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1095
+ (uint8_t) hon_protocol::DataParameters::HEALTH_MODE,
1096
+ this->get_health_mode() ? ONE_BUF : ZERO_BUF, 2);
1085
1097
  this->health_mode_ = (SwitchState) ((uint8_t) this->health_mode_ & 0b01);
1086
1098
  }
1087
1099
  // Climate mode
@@ -1099,51 +1111,46 @@ void HonClimate::fill_control_messages_queue_() {
1099
1111
  case CLIMATE_MODE_HEAT_COOL:
1100
1112
  new_power = true;
1101
1113
  buffer[1] = (uint8_t) hon_protocol::ConditioningMode::AUTO;
1102
- this->control_messages_queue_.push(
1103
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1104
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1105
- (uint8_t) hon_protocol::DataParameters::AC_MODE,
1106
- buffer, 2));
1114
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1115
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1116
+ (uint8_t) hon_protocol::DataParameters::AC_MODE,
1117
+ buffer, 2);
1107
1118
  fan_mode_buf[1] = this->other_modes_fan_speed_;
1108
1119
  break;
1109
1120
  case CLIMATE_MODE_HEAT:
1110
1121
  new_power = true;
1111
1122
  buffer[1] = (uint8_t) hon_protocol::ConditioningMode::HEAT;
1112
- this->control_messages_queue_.push(
1113
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1114
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1115
- (uint8_t) hon_protocol::DataParameters::AC_MODE,
1116
- buffer, 2));
1123
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1124
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1125
+ (uint8_t) hon_protocol::DataParameters::AC_MODE,
1126
+ buffer, 2);
1117
1127
  fan_mode_buf[1] = this->other_modes_fan_speed_;
1118
1128
  break;
1119
1129
  case CLIMATE_MODE_DRY:
1120
1130
  new_power = true;
1121
1131
  buffer[1] = (uint8_t) hon_protocol::ConditioningMode::DRY;
1122
- this->control_messages_queue_.push(
1123
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1124
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1125
- (uint8_t) hon_protocol::DataParameters::AC_MODE,
1126
- buffer, 2));
1132
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1133
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1134
+ (uint8_t) hon_protocol::DataParameters::AC_MODE,
1135
+ buffer, 2);
1127
1136
  fan_mode_buf[1] = this->other_modes_fan_speed_;
1128
1137
  break;
1129
1138
  case CLIMATE_MODE_FAN_ONLY:
1130
1139
  new_power = true;
1131
1140
  buffer[1] = (uint8_t) hon_protocol::ConditioningMode::FAN;
1132
- this->control_messages_queue_.push(
1133
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1134
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1135
- (uint8_t) hon_protocol::DataParameters::AC_MODE,
1136
- buffer, 2));
1141
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1142
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1143
+ (uint8_t) hon_protocol::DataParameters::AC_MODE,
1144
+ buffer, 2);
1137
1145
  fan_mode_buf[1] = this->other_modes_fan_speed_; // Auto doesn't work in fan only mode
1138
1146
  break;
1139
1147
  case CLIMATE_MODE_COOL:
1140
1148
  new_power = true;
1141
1149
  buffer[1] = (uint8_t) hon_protocol::ConditioningMode::COOL;
1142
- this->control_messages_queue_.push(
1143
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1144
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1145
- (uint8_t) hon_protocol::DataParameters::AC_MODE,
1146
- buffer, 2));
1150
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1151
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1152
+ (uint8_t) hon_protocol::DataParameters::AC_MODE,
1153
+ buffer, 2);
1147
1154
  fan_mode_buf[1] = this->other_modes_fan_speed_;
1148
1155
  break;
1149
1156
  default:
@@ -1153,11 +1160,10 @@ void HonClimate::fill_control_messages_queue_() {
1153
1160
  }
1154
1161
  // Climate power
1155
1162
  {
1156
- this->control_messages_queue_.push(
1157
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1158
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1159
- (uint8_t) hon_protocol::DataParameters::AC_POWER,
1160
- new_power ? ONE_BUF : ZERO_BUF, 2));
1163
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1164
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1165
+ (uint8_t) hon_protocol::DataParameters::AC_POWER,
1166
+ new_power ? ONE_BUF : ZERO_BUF, 2);
1161
1167
  }
1162
1168
  // CLimate preset
1163
1169
  {
@@ -1199,36 +1205,32 @@ void HonClimate::fill_control_messages_queue_() {
1199
1205
  }
1200
1206
  auto presets = this->traits_.get_supported_presets();
1201
1207
  if (quiet_mode_buf[1] != 0xFF) {
1202
- this->control_messages_queue_.push(
1203
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1204
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1205
- (uint8_t) hon_protocol::DataParameters::QUIET_MODE,
1206
- quiet_mode_buf, 2));
1208
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1209
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1210
+ (uint8_t) hon_protocol::DataParameters::QUIET_MODE,
1211
+ quiet_mode_buf, 2);
1207
1212
  }
1208
1213
  if ((fast_mode_buf[1] != 0xFF) && ((presets.find(climate::ClimatePreset::CLIMATE_PRESET_BOOST) != presets.end()))) {
1209
- this->control_messages_queue_.push(
1210
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1211
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1212
- (uint8_t) hon_protocol::DataParameters::FAST_MODE,
1213
- fast_mode_buf, 2));
1214
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1215
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1216
+ (uint8_t) hon_protocol::DataParameters::FAST_MODE,
1217
+ fast_mode_buf, 2);
1214
1218
  }
1215
1219
  if ((away_mode_buf[1] != 0xFF) && ((presets.find(climate::ClimatePreset::CLIMATE_PRESET_AWAY) != presets.end()))) {
1216
- this->control_messages_queue_.push(
1217
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1218
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1219
- (uint8_t) hon_protocol::DataParameters::TEN_DEGREE,
1220
- away_mode_buf, 2));
1220
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1221
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1222
+ (uint8_t) hon_protocol::DataParameters::TEN_DEGREE,
1223
+ away_mode_buf, 2);
1221
1224
  }
1222
1225
  }
1223
1226
  // Target temperature
1224
1227
  if (climate_control.target_temperature.has_value() && (this->mode != ClimateMode::CLIMATE_MODE_FAN_ONLY)) {
1225
1228
  uint8_t buffer[2] = {0x00, 0x00};
1226
1229
  buffer[1] = ((uint8_t) climate_control.target_temperature.value()) - 16;
1227
- this->control_messages_queue_.push(
1228
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1229
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1230
- (uint8_t) hon_protocol::DataParameters::SET_POINT,
1231
- buffer, 2));
1230
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1231
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1232
+ (uint8_t) hon_protocol::DataParameters::SET_POINT,
1233
+ buffer, 2);
1232
1234
  }
1233
1235
  // Vertical swing mode
1234
1236
  if (climate_control.swing_mode.has_value()) {
@@ -1248,16 +1250,14 @@ void HonClimate::fill_control_messages_queue_() {
1248
1250
  case CLIMATE_SWING_BOTH:
1249
1251
  break;
1250
1252
  }
1251
- this->control_messages_queue_.push(
1252
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1253
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1254
- (uint8_t) hon_protocol::DataParameters::HORIZONTAL_SWING_MODE,
1255
- horizontal_swing_buf, 2));
1256
- this->control_messages_queue_.push(
1257
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1258
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1259
- (uint8_t) hon_protocol::DataParameters::VERTICAL_SWING_MODE,
1260
- vertical_swing_buf, 2));
1253
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1254
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1255
+ (uint8_t) hon_protocol::DataParameters::HORIZONTAL_SWING_MODE,
1256
+ horizontal_swing_buf, 2);
1257
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1258
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1259
+ (uint8_t) hon_protocol::DataParameters::VERTICAL_SWING_MODE,
1260
+ vertical_swing_buf, 2);
1261
1261
  }
1262
1262
  // Fan mode
1263
1263
  if (climate_control.fan_mode.has_value()) {
@@ -1280,11 +1280,10 @@ void HonClimate::fill_control_messages_queue_() {
1280
1280
  break;
1281
1281
  }
1282
1282
  if (fan_mode_buf[1] != 0xFF) {
1283
- this->control_messages_queue_.push(
1284
- haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1285
- (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1286
- (uint8_t) hon_protocol::DataParameters::FAN_MODE,
1287
- fan_mode_buf, 2));
1283
+ this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
1284
+ (uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
1285
+ (uint8_t) hon_protocol::DataParameters::FAN_MODE,
1286
+ fan_mode_buf, 2);
1288
1287
  }
1289
1288
  }
1290
1289
  }