esphome 2024.11.3__py3-none-any.whl → 2024.12.0b1__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 (178) hide show
  1. esphome/components/adc/adc_sensor.h +7 -8
  2. esphome/components/adc/adc_sensor_common.cpp +24 -0
  3. esphome/components/adc/{adc_sensor.cpp → adc_sensor_esp32.cpp} +10 -179
  4. esphome/components/adc/adc_sensor_esp8266.cpp +58 -0
  5. esphome/components/adc/adc_sensor_rp2040.cpp +93 -0
  6. esphome/components/alarm_control_panel/alarm_control_panel_call.cpp +3 -4
  7. esphome/components/animation/__init__.py +1 -2
  8. esphome/components/apds9306/apds9306.cpp +2 -1
  9. esphome/components/audio/audio.h +1 -1
  10. esphome/components/bk72xx/__init__.py +1 -1
  11. esphome/components/cse7766/cse7766.cpp +1 -1
  12. esphome/components/deep_sleep/deep_sleep_esp32.cpp +2 -2
  13. esphome/components/dht/dht.cpp +2 -1
  14. esphome/components/display/display.cpp +10 -6
  15. esphome/components/display/display.h +14 -0
  16. esphome/components/display_menu_base/__init__.py +0 -2
  17. esphome/components/display_menu_base/display_menu_base.cpp +1 -1
  18. esphome/components/dsmr/dsmr.cpp +1 -1
  19. esphome/components/esp32/__init__.py +94 -12
  20. esphome/components/esp32/boards.py +222 -14
  21. esphome/components/esp32_ble/__init__.py +22 -2
  22. esphome/components/esp32_ble/ble.cpp +13 -5
  23. esphome/components/esp32_ble/ble.h +2 -0
  24. esphome/components/esp32_ble/ble_advertising.cpp +1 -1
  25. esphome/components/esp32_ble/ble_uuid.cpp +9 -10
  26. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +4 -1
  27. esphome/components/esp32_camera_web_server/camera_web_server.h +1 -1
  28. esphome/components/esp32_rmt_led_strip/light.py +3 -3
  29. esphome/components/esp8266/__init__.py +5 -7
  30. esphome/components/ezo/ezo.cpp +14 -26
  31. esphome/components/font/__init__.py +5 -23
  32. esphome/components/font/font.cpp +5 -3
  33. esphome/components/graphical_display_menu/__init__.py +2 -0
  34. esphome/components/haier/hon_climate.cpp +79 -80
  35. esphome/components/hbridge/switch/__init__.py +44 -0
  36. esphome/components/hbridge/switch/hbridge_switch.cpp +95 -0
  37. esphome/components/hbridge/switch/hbridge_switch.h +50 -0
  38. esphome/components/hitachi_ac344/hitachi_ac344.cpp +4 -2
  39. esphome/components/hitachi_ac424/hitachi_ac424.cpp +4 -2
  40. esphome/components/homeassistant/number/homeassistant_number.cpp +3 -0
  41. esphome/components/hx711/hx711.cpp +1 -1
  42. esphome/components/hx711/hx711.h +1 -1
  43. esphome/components/i2c/i2c_bus_esp_idf.cpp +2 -2
  44. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +61 -59
  45. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -17
  46. esphome/components/ili9xxx/display.py +1 -2
  47. esphome/components/ili9xxx/ili9xxx_display.cpp +3 -2
  48. esphome/components/image/__init__.py +1 -2
  49. esphome/components/logger/logger.cpp +1 -1
  50. esphome/components/ltr501/ltr501.cpp +1 -1
  51. esphome/components/lvgl/defines.py +8 -1
  52. esphome/components/lvgl/lv_validation.py +8 -3
  53. esphome/components/lvgl/lvgl_esphome.cpp +1 -1
  54. esphome/components/lvgl/lvgl_esphome.h +16 -0
  55. esphome/components/lvgl/widgets/animimg.py +12 -17
  56. esphome/components/lvgl/widgets/img.py +1 -3
  57. esphome/components/matrix_keypad/__init__.py +15 -3
  58. esphome/components/matrix_keypad/matrix_keypad.cpp +4 -0
  59. esphome/components/matrix_keypad/matrix_keypad.h +5 -0
  60. esphome/components/max31865/max31865.cpp +4 -2
  61. esphome/components/modbus_controller/modbus_controller.cpp +24 -24
  62. esphome/components/modbus_controller/modbus_controller.h +22 -22
  63. esphome/components/modbus_controller/number/modbus_number.cpp +8 -8
  64. esphome/components/modbus_controller/number/modbus_number.h +4 -4
  65. esphome/components/modbus_controller/output/modbus_output.cpp +7 -6
  66. esphome/components/modbus_controller/output/modbus_output.h +5 -5
  67. esphome/components/modbus_controller/select/modbus_select.cpp +4 -3
  68. esphome/components/modbus_controller/select/modbus_select.h +4 -4
  69. esphome/components/modbus_controller/switch/modbus_switch.cpp +5 -5
  70. esphome/components/modbus_controller/switch/modbus_switch.h +2 -2
  71. esphome/components/mqtt/__init__.py +4 -0
  72. esphome/components/mqtt/mqtt_alarm_control_panel.cpp +2 -5
  73. esphome/components/mqtt/mqtt_backend_esp32.cpp +3 -3
  74. esphome/components/mqtt/mqtt_client.cpp +4 -0
  75. esphome/components/mqtt/mqtt_client.h +6 -0
  76. esphome/components/mqtt/mqtt_climate.cpp +13 -3
  77. esphome/components/mqtt/mqtt_sensor.cpp +2 -0
  78. esphome/components/network/ip_address.h +1 -1
  79. esphome/components/nextion/__init__.py +2 -0
  80. esphome/components/nextion/automation.h +76 -0
  81. esphome/components/nextion/base_component.py +1 -0
  82. esphome/components/nextion/binary_sensor/__init__.py +43 -2
  83. esphome/components/nextion/display.py +15 -0
  84. esphome/components/nextion/nextion.cpp +8 -5
  85. esphome/components/nextion/nextion.h +7 -0
  86. esphome/components/nextion/nextion_upload_idf.cpp +2 -2
  87. esphome/components/nextion/sensor/__init__.py +38 -5
  88. esphome/components/nextion/switch/__init__.py +38 -2
  89. esphome/components/nextion/text_sensor/__init__.py +37 -2
  90. esphome/components/nfc/ndef_record.cpp +3 -3
  91. esphome/components/online_image/__init__.py +1 -0
  92. esphome/components/opentherm/opentherm.cpp +3 -3
  93. esphome/components/opentherm/opentherm.h +1 -1
  94. esphome/components/ota/automation.h +1 -1
  95. esphome/components/output/float_output.cpp +1 -1
  96. esphome/components/pca6416a/pca6416a.cpp +5 -3
  97. esphome/components/pca9554/pca9554.cpp +4 -4
  98. esphome/components/pipsolar/pipsolar.cpp +2 -2
  99. esphome/components/pipsolar/switch/pipsolar_switch.cpp +2 -2
  100. esphome/components/pn532/pn532_mifare_ultralight.cpp +2 -2
  101. esphome/components/pn7150/pn7150_mifare_ultralight.cpp +2 -2
  102. esphome/components/pn7160/pn7160_mifare_ultralight.cpp +2 -2
  103. esphome/components/qmc5883l/qmc5883l.cpp +45 -19
  104. esphome/components/qmc5883l/qmc5883l.h +1 -1
  105. esphome/components/qspi_dbi/qspi_dbi.cpp +2 -1
  106. esphome/components/remote_base/raw_protocol.cpp +1 -1
  107. esphome/components/rotary_encoder/rotary_encoder.cpp +3 -1
  108. esphome/components/rp2040/__init__.py +1 -1
  109. esphome/components/rtl87xx/__init__.py +1 -1
  110. esphome/components/safe_mode/automation.h +1 -1
  111. esphome/components/seeed_mr60bha2/__init__.py +41 -0
  112. esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +173 -0
  113. esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +61 -0
  114. esphome/components/seeed_mr60bha2/sensor.py +57 -0
  115. esphome/components/seeed_mr60fda2/__init__.py +41 -0
  116. esphome/components/seeed_mr60fda2/binary_sensor.py +33 -0
  117. esphome/components/seeed_mr60fda2/button/__init__.py +45 -0
  118. esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.cpp +9 -0
  119. esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.h +18 -0
  120. esphome/components/seeed_mr60fda2/button/reset_radar_button.cpp +9 -0
  121. esphome/components/seeed_mr60fda2/button/reset_radar_button.h +18 -0
  122. esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp +368 -0
  123. esphome/components/seeed_mr60fda2/seeed_mr60fda2.h +101 -0
  124. esphome/components/seeed_mr60fda2/select/__init__.py +59 -0
  125. esphome/components/seeed_mr60fda2/select/height_threshold_select.cpp +15 -0
  126. esphome/components/seeed_mr60fda2/select/height_threshold_select.h +18 -0
  127. esphome/components/seeed_mr60fda2/select/install_height_select.cpp +15 -0
  128. esphome/components/seeed_mr60fda2/select/install_height_select.h +18 -0
  129. esphome/components/seeed_mr60fda2/select/sensitivity_select.cpp +15 -0
  130. esphome/components/seeed_mr60fda2/select/sensitivity_select.h +18 -0
  131. esphome/components/sen5x/sensor.py +5 -6
  132. esphome/components/shelly_dimmer/shelly_dimmer.cpp +1 -1
  133. esphome/components/sim800l/sim800l.cpp +1 -1
  134. esphome/components/sntp/sntp_component.cpp +14 -20
  135. esphome/components/sntp/sntp_component.h +6 -9
  136. esphome/components/sntp/time.py +4 -7
  137. esphome/components/sprinkler/sprinkler.cpp +2 -2
  138. esphome/components/st7735/st7735.cpp +1 -1
  139. esphome/components/st7789v/st7789v.cpp +1 -1
  140. esphome/components/stepper/stepper.h +0 -1
  141. esphome/components/sun_gtil2/sun_gtil2.cpp +1 -1
  142. esphome/components/switch/binary_sensor/__init__.py +31 -0
  143. esphome/components/switch/binary_sensor/switch_binary_sensor.cpp +17 -0
  144. esphome/components/switch/binary_sensor/switch_binary_sensor.h +22 -0
  145. esphome/components/sx1509/sx1509_gpio_pin.cpp +2 -1
  146. esphome/components/sx1509/sx1509_gpio_pin.h +5 -5
  147. esphome/components/uart/uart.h +1 -1
  148. esphome/components/udp/udp_component.cpp +32 -16
  149. esphome/components/ufire_ec/sensor.py +4 -4
  150. esphome/components/uln2003/uln2003.cpp +4 -1
  151. esphome/components/waveshare_epaper/display.py +8 -0
  152. esphome/components/waveshare_epaper/waveshare_epaper.cpp +191 -0
  153. esphome/components/waveshare_epaper/waveshare_epaper.h +56 -0
  154. esphome/components/wiegand/__init__.py +3 -4
  155. esphome/components/wifi/__init__.py +42 -0
  156. esphome/components/wifi/wifi_component.cpp +2 -2
  157. esphome/components/wifi/wifi_component.h +82 -1
  158. esphome/components/wifi/wifi_component_esp32_arduino.cpp +1 -1
  159. esphome/components/wifi/wifi_component_esp8266.cpp +1 -1
  160. esphome/components/wifi/wifi_component_esp_idf.cpp +1 -1
  161. esphome/components/wifi/wifi_component_libretiny.cpp +1 -1
  162. esphome/components/wifi/wifi_component_pico_w.cpp +1 -1
  163. esphome/components/wireguard/wireguard.cpp +2 -2
  164. esphome/components/xiaomi_ble/xiaomi_ble.cpp +1 -1
  165. esphome/config_validation.py +15 -11
  166. esphome/const.py +7 -1
  167. esphome/core/component.cpp +1 -1
  168. esphome/core/config.py +1 -2
  169. esphome/core/defines.h +3 -1
  170. esphome/core/helpers.cpp +6 -1
  171. esphome/core/helpers.h +2 -1
  172. esphome/core/optional.h +2 -2
  173. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/METADATA +3 -3
  174. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/RECORD +178 -149
  175. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/LICENSE +0 -0
  176. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/WHEEL +0 -0
  177. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/entry_points.txt +0 -0
  178. {esphome-2024.11.3.dist-info → esphome-2024.12.0b1.dist-info}/top_level.txt +0 -0
@@ -188,12 +188,20 @@ bool ESP32BLE::ble_setup_() {
188
188
  }
189
189
  }
190
190
 
191
- std::string name = App.get_name();
192
- if (name.length() > 20) {
191
+ std::string name;
192
+ if (this->name_.has_value()) {
193
+ name = this->name_.value();
193
194
  if (App.is_name_add_mac_suffix_enabled()) {
194
- name.erase(name.begin() + 13, name.end() - 7); // Remove characters between 13 and the mac address
195
- } else {
196
- name = name.substr(0, 20);
195
+ name += "-" + get_mac_address().substr(6);
196
+ }
197
+ } else {
198
+ name = App.get_name();
199
+ if (name.length() > 20) {
200
+ if (App.is_name_add_mac_suffix_enabled()) {
201
+ name.erase(name.begin() + 13, name.end() - 7); // Remove characters between 13 and the mac address
202
+ } else {
203
+ name = name.substr(0, 20);
204
+ }
197
205
  }
198
206
  }
199
207
 
@@ -90,6 +90,7 @@ class ESP32BLE : public Component {
90
90
  void loop() override;
91
91
  void dump_config() override;
92
92
  float get_setup_priority() const override;
93
+ void set_name(const std::string &name) { this->name_ = name; }
93
94
 
94
95
  void advertising_start();
95
96
  void advertising_set_service_data(const std::vector<uint8_t> &data);
@@ -131,6 +132,7 @@ class ESP32BLE : public Component {
131
132
  esp_ble_io_cap_t io_cap_{ESP_IO_CAP_NONE};
132
133
  uint32_t advertising_cycle_time_;
133
134
  bool enable_on_boot_;
135
+ optional<std::string> name_;
134
136
  };
135
137
 
136
138
  // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
@@ -83,7 +83,7 @@ esp_err_t BLEAdvertising::services_advertisement_() {
83
83
  esp_err_t err;
84
84
 
85
85
  this->advertising_data_.set_scan_rsp = false;
86
- this->advertising_data_.include_name = !this->scan_response_;
86
+ this->advertising_data_.include_name = true;
87
87
  this->advertising_data_.include_txpower = !this->scan_response_;
88
88
  err = esp_ble_gap_config_adv_data(&this->advertising_data_);
89
89
  if (err != ESP_OK) {
@@ -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
@@ -88,7 +86,7 @@ def flatten(lists) -> list:
88
86
  return list(chain.from_iterable(lists))
89
87
 
90
88
 
91
- def check_missing_glyphs(file, codepoints: Iterable, warning: bool = False):
89
+ def check_missing_glyphs(file, codepoints, warning: bool = False):
92
90
  """
93
91
  Check that the given font file actually contains the requested glyphs
94
92
  :param file: A Truetype font file
@@ -177,24 +175,6 @@ def validate_glyphs(config):
177
175
  return config
178
176
 
179
177
 
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
178
  FONT_EXTENSIONS = (".ttf", ".woff", ".otf")
199
179
 
200
180
 
@@ -393,7 +373,9 @@ def font_file_schema(value):
393
373
  # Default if no glyphs or glyphsets are provided
394
374
  DEFAULT_GLYPHSET = "GF_Latin_Kernel"
395
375
  # default for bitmap fonts
396
- DEFAULT_GLYPHS = ' !"%()+=,-.:/?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz<C2><B0>'
376
+ DEFAULT_GLYPHS = (
377
+ ' !"%()+=,-.:/?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz°'
378
+ )
397
379
 
398
380
  CONF_RAW_GLYPH_ID = "raw_glyph_id"
399
381
 
@@ -421,7 +403,7 @@ FONT_SCHEMA = cv.Schema(
421
403
  },
422
404
  )
423
405
 
424
- CONFIG_SCHEMA = cv.All(validate_pillow_installed, FONT_SCHEMA, validate_glyphs)
406
+ CONFIG_SCHEMA = cv.All(FONT_SCHEMA, validate_glyphs)
425
407
 
426
408
 
427
409
  # 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
  {