esphome 2025.7.4__py3-none-any.whl → 2025.7.5__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.
@@ -657,10 +657,16 @@ class APIConnection : public APIServerConnection {
657
657
  bool send_message_smart_(EntityBase *entity, MessageCreatorPtr creator, uint8_t message_type,
658
658
  uint8_t estimated_size) {
659
659
  // Try to send immediately if:
660
- // 1. We should try to send immediately (should_try_send_immediately = true)
661
- // 2. Batch delay is 0 (user has opted in to immediate sending)
662
- // 3. Buffer has space available
663
- if (this->flags_.should_try_send_immediately && this->get_batch_delay_ms_() == 0 &&
660
+ // 1. It's an UpdateStateResponse (always send immediately to handle cases where
661
+ // the main loop is blocked, e.g., during OTA updates)
662
+ // 2. OR: We should try to send immediately (should_try_send_immediately = true)
663
+ // AND Batch delay is 0 (user has opted in to immediate sending)
664
+ // 3. AND: Buffer has space available
665
+ if ((
666
+ #ifdef USE_UPDATE
667
+ message_type == UpdateStateResponse::MESSAGE_TYPE ||
668
+ #endif
669
+ (this->flags_.should_try_send_immediately && this->get_batch_delay_ms_() == 0)) &&
664
670
  this->helper_->can_write_without_blocking()) {
665
671
  // Now actually encode and send
666
672
  if (creator(entity, this, MAX_BATCH_PACKET_SIZE, true) &&
@@ -15,6 +15,7 @@ from freetype import (
15
15
  FT_LOAD_RENDER,
16
16
  FT_LOAD_TARGET_MONO,
17
17
  Face,
18
+ FT_Exception,
18
19
  ft_pixel_mode_mono,
19
20
  )
20
21
  import requests
@@ -94,7 +95,14 @@ class FontCache(MutableMapping):
94
95
  return self.store[self._keytransform(item)]
95
96
 
96
97
  def __setitem__(self, key, value):
97
- self.store[self._keytransform(key)] = Face(str(value))
98
+ transformed = self._keytransform(key)
99
+ try:
100
+ self.store[transformed] = Face(str(value))
101
+ except FT_Exception as exc:
102
+ file = transformed.split(":", 1)
103
+ raise cv.Invalid(
104
+ f"{file[0].capitalize()} {file[1]} is not a valid font file"
105
+ ) from exc
98
106
 
99
107
 
100
108
  FONT_CACHE = FontCache()
@@ -24,9 +24,6 @@ static const uint32_t READ_DURATION_MS = 16;
24
24
  static const size_t TASK_STACK_SIZE = 4096;
25
25
  static const ssize_t TASK_PRIORITY = 23;
26
26
 
27
- // Use an exponential moving average to correct a DC offset with weight factor 1/1000
28
- static const int32_t DC_OFFSET_MOVING_AVERAGE_COEFFICIENT_DENOMINATOR = 1000;
29
-
30
27
  static const char *const TAG = "i2s_audio.microphone";
31
28
 
32
29
  enum MicrophoneEventGroupBits : uint32_t {
@@ -382,26 +379,57 @@ void I2SAudioMicrophone::mic_task(void *params) {
382
379
  }
383
380
 
384
381
  void I2SAudioMicrophone::fix_dc_offset_(std::vector<uint8_t> &data) {
382
+ /**
383
+ * From https://www.musicdsp.org/en/latest/Filters/135-dc-filter.html:
384
+ *
385
+ * y(n) = x(n) - x(n-1) + R * y(n-1)
386
+ * R = 1 - (pi * 2 * frequency / samplerate)
387
+ *
388
+ * From https://en.wikipedia.org/wiki/Hearing_range:
389
+ * The human range is commonly given as 20Hz up.
390
+ *
391
+ * From https://en.wikipedia.org/wiki/High-resolution_audio:
392
+ * A reasonable upper bound for sample rate seems to be 96kHz.
393
+ *
394
+ * Calculate R value for 20Hz on a 96kHz sample rate:
395
+ * R = 1 - (pi * 2 * 20 / 96000)
396
+ * R = 0.9986910031
397
+ *
398
+ * Transform floating point to bit-shifting approximation:
399
+ * output = input - prev_input + R * prev_output
400
+ * output = input - prev_input + (prev_output - (prev_output >> S))
401
+ *
402
+ * Approximate bit-shift value S from R:
403
+ * R = 1 - (1 >> S)
404
+ * R = 1 - (1 / 2^S)
405
+ * R = 1 - 2^-S
406
+ * 0.9986910031 = 1 - 2^-S
407
+ * S = 9.57732 ~= 10
408
+ *
409
+ * Actual R from S:
410
+ * R = 1 - 2^-10 = 0.9990234375
411
+ *
412
+ * Confirm this has effect outside human hearing on 96000kHz sample:
413
+ * 0.9990234375 = 1 - (pi * 2 * f / 96000)
414
+ * f = 14.9208Hz
415
+ *
416
+ * Confirm this has effect outside human hearing on PDM 16kHz sample:
417
+ * 0.9990234375 = 1 - (pi * 2 * f / 16000)
418
+ * f = 2.4868Hz
419
+ *
420
+ */
421
+ const uint8_t dc_filter_shift = 10;
385
422
  const size_t bytes_per_sample = this->audio_stream_info_.samples_to_bytes(1);
386
423
  const uint32_t total_samples = this->audio_stream_info_.bytes_to_samples(data.size());
387
-
388
- if (total_samples == 0) {
389
- return;
390
- }
391
-
392
- int64_t offset_accumulator = 0;
393
424
  for (uint32_t sample_index = 0; sample_index < total_samples; ++sample_index) {
394
425
  const uint32_t byte_index = sample_index * bytes_per_sample;
395
- int32_t sample = audio::unpack_audio_sample_to_q31(&data[byte_index], bytes_per_sample);
396
- offset_accumulator += sample;
397
- sample -= this->dc_offset_;
398
- audio::pack_q31_as_audio_sample(sample, &data[byte_index], bytes_per_sample);
426
+ int32_t input = audio::unpack_audio_sample_to_q31(&data[byte_index], bytes_per_sample);
427
+ int32_t output = input - this->dc_offset_prev_input_ +
428
+ (this->dc_offset_prev_output_ - (this->dc_offset_prev_output_ >> dc_filter_shift));
429
+ this->dc_offset_prev_input_ = input;
430
+ this->dc_offset_prev_output_ = output;
431
+ audio::pack_q31_as_audio_sample(output, &data[byte_index], bytes_per_sample);
399
432
  }
400
-
401
- const int32_t new_offset = offset_accumulator / total_samples;
402
- this->dc_offset_ = new_offset / DC_OFFSET_MOVING_AVERAGE_COEFFICIENT_DENOMINATOR +
403
- (DC_OFFSET_MOVING_AVERAGE_COEFFICIENT_DENOMINATOR - 1) * this->dc_offset_ /
404
- DC_OFFSET_MOVING_AVERAGE_COEFFICIENT_DENOMINATOR;
405
433
  }
406
434
 
407
435
  size_t I2SAudioMicrophone::read_(uint8_t *buf, size_t len, TickType_t ticks_to_wait) {
@@ -82,7 +82,8 @@ class I2SAudioMicrophone : public I2SAudioIn, public microphone::Microphone, pub
82
82
 
83
83
  bool correct_dc_offset_;
84
84
  bool locked_driver_{false};
85
- int32_t dc_offset_{0};
85
+ int32_t dc_offset_prev_input_{0};
86
+ int32_t dc_offset_prev_output_{0};
86
87
  };
87
88
 
88
89
  } // namespace i2s_audio
@@ -15,7 +15,7 @@ from ..defines import (
15
15
  TILE_DIRECTIONS,
16
16
  literal,
17
17
  )
18
- from ..lv_validation import animated, lv_int
18
+ from ..lv_validation import animated, lv_int, lv_pct
19
19
  from ..lvcode import lv, lv_assign, lv_expr, lv_obj, lv_Pvariable
20
20
  from ..schemas import container_schema
21
21
  from ..types import LV_EVENT, LvType, ObjUpdateAction, lv_obj_t, lv_obj_t_ptr
@@ -41,8 +41,8 @@ TILEVIEW_SCHEMA = cv.Schema(
41
41
  container_schema(
42
42
  obj_spec,
43
43
  {
44
- cv.Required(CONF_ROW): lv_int,
45
- cv.Required(CONF_COLUMN): lv_int,
44
+ cv.Required(CONF_ROW): cv.positive_int,
45
+ cv.Required(CONF_COLUMN): cv.positive_int,
46
46
  cv.GenerateID(): cv.declare_id(lv_tile_t),
47
47
  cv.Optional(CONF_DIR, default="ALL"): TILE_DIRECTIONS.several_of,
48
48
  },
@@ -63,21 +63,29 @@ class TileviewType(WidgetType):
63
63
  )
64
64
 
65
65
  async def to_code(self, w: Widget, config: dict):
66
- for tile_conf in config.get(CONF_TILES, ()):
66
+ tiles = config[CONF_TILES]
67
+ for tile_conf in tiles:
67
68
  w_id = tile_conf[CONF_ID]
68
69
  tile_obj = lv_Pvariable(lv_obj_t, w_id)
69
70
  tile = Widget.create(w_id, tile_obj, tile_spec, tile_conf)
70
71
  dirs = tile_conf[CONF_DIR]
71
72
  if isinstance(dirs, list):
72
73
  dirs = "|".join(dirs)
74
+ row_pos = tile_conf[CONF_ROW]
75
+ col_pos = tile_conf[CONF_COLUMN]
73
76
  lv_assign(
74
77
  tile_obj,
75
- lv_expr.tileview_add_tile(
76
- w.obj, tile_conf[CONF_COLUMN], tile_conf[CONF_ROW], literal(dirs)
77
- ),
78
+ lv_expr.tileview_add_tile(w.obj, col_pos, row_pos, literal(dirs)),
78
79
  )
80
+ # Bugfix for LVGL 8.x
81
+ lv_obj.set_pos(tile_obj, lv_pct(col_pos * 100), lv_pct(row_pos * 100))
79
82
  await set_obj_properties(tile, tile_conf)
80
83
  await add_widgets(tile, tile_conf)
84
+ if tiles:
85
+ # Set the first tile as active
86
+ lv_obj.set_tile_id(
87
+ w.obj, tiles[0][CONF_COLUMN], tiles[0][CONF_ROW], literal("LV_ANIM_OFF")
88
+ )
81
89
 
82
90
 
83
91
  tileview_spec = TileviewType()
esphome/const.py CHANGED
@@ -4,7 +4,7 @@ from enum import Enum
4
4
 
5
5
  from esphome.enum import StrEnum
6
6
 
7
- __version__ = "2025.7.4"
7
+ __version__ = "2025.7.5"
8
8
 
9
9
  ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
10
10
  VALID_SUBSTITUTIONS_CHARACTERS = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esphome
3
- Version: 2025.7.4
3
+ Version: 2025.7.5
4
4
  Summary: ESPHome is a system to configure your microcontrollers by simple yet powerful configuration files and control them remotely through Home Automation systems.
5
5
  Author-email: The ESPHome Authors <esphome@openhomefoundation.org>
6
6
  License: MIT
@@ -5,7 +5,7 @@ esphome/codegen.py,sha256=H_WB4rj0uEowvlhEb31EjJQwutLQ5CQkJIsNgDK-wx8,1917
5
5
  esphome/config.py,sha256=b-Gh-DEx_pax0ZKqHTKb5gmMIvaQA71bJvE-15AI0JI,42211
6
6
  esphome/config_helpers.py,sha256=BpyuWRxj5edJGIW7VP4S59i4I8g8baSlWpNyu6nB_uM,5413
7
7
  esphome/config_validation.py,sha256=QUNpomRbIhqTaSrZZXNFcTQdPibGPbYDNSo5sTIzqCI,64924
8
- esphome/const.py,sha256=TiaRIL8HNMH-_mcJANWLuu8l8f5Mnv0Z59u7fw7TzZg,43367
8
+ esphome/const.py,sha256=KfTHIfnS2AZHANmoUCkRFP-zGx-VO-YLQyFopyQtiOI,43367
9
9
  esphome/coroutine.py,sha256=HNBqqhaTbpvsOI19bTXltxJCMVtoeqZPe4qTf4CKkAc,9309
10
10
  esphome/cpp_generator.py,sha256=khmyuRIOc-ST9zIZjX7uOWLy9sSJhk4C2KexoBv51uk,31946
11
11
  esphome/cpp_helpers.py,sha256=P9FVGpid75_UcKxIf-sj7GbhWGQNRcBm_2XVF3r7NtU,3998
@@ -184,7 +184,7 @@ esphome/components/apds9960/binary_sensor.py,sha256=MvCYb6pTgOU48TMm_YhN6uHKkoFK
184
184
  esphome/components/apds9960/sensor.py,sha256=vUPm5H_IFROftGlMJWfgqSzm0IeLpYh5DvtA_DL1Amk,872
185
185
  esphome/components/api/__init__.py,sha256=c6z0YUDVDmGpZiiNAsiqiuheib4qv8cw1NfCL9OvVcA,12311
186
186
  esphome/components/api/api_connection.cpp,sha256=O-1osGKN7dqC6X179V28lZfp0ipfDW-9FyEDrFai1n8,80703
187
- esphome/components/api/api_connection.h,sha256=X57XY_kYpEcZdYpx1ShwLte_8jnnXq6me8K0-Y_M-lU,30537
187
+ esphome/components/api/api_connection.h,sha256=IM_cz7AQCkTI_-DZaTJz6yPjZZBD9af3HwIkDE0vQcY,30808
188
188
  esphome/components/api/api_frame_helper.cpp,sha256=fAt3UqdHCJSSggcJm1dqBz46PTbJS6lLrhwgXE-pZvw,38065
189
189
  esphome/components/api/api_frame_helper.h,sha256=p6af-nRWvSLG4Vimtjzw2BKZJiCts9mknurSYZTeNsM,10293
190
190
  esphome/components/api/api_noise_context.h,sha256=y_3hWMKXtKxyCwZ8cKQjn3gQqenaAX5DhcCFQ6kBiPc,606
@@ -999,7 +999,7 @@ esphome/components/fingerprint_grow/binary_sensor.py,sha256=rD-DJ5lZzX94WKH7XrkM
999
999
  esphome/components/fingerprint_grow/fingerprint_grow.cpp,sha256=oUcj5GDrIQ59gv5yKhBmxJVjsLFLyTimn_skKuamxhU,18668
1000
1000
  esphome/components/fingerprint_grow/fingerprint_grow.h,sha256=UEkLR4Cqas_XYlTLAwscXCAMRoprWeQZEZ_3vTsI-BM,11206
1001
1001
  esphome/components/fingerprint_grow/sensor.py,sha256=IZbpSTae6AkEuba4SR8UUcDdiz7P5NriXO9TYoLxYFE,2245
1002
- esphome/components/font/__init__.py,sha256=HfJ4ZP7Df3S4rDUe3SegerSc7Rrvj_0TbLEjcgRYFFI,19286
1002
+ esphome/components/font/__init__.py,sha256=QCs1jfEQo-qGj4dlxQmlfcr57a34TRBWnHVaQYq-d4s,19566
1003
1003
  esphome/components/font/font.cpp,sha256=7ttSZHCLEi-wtJUe9CLbYWPv4eKYAyrcFChcbVOOhuY,5557
1004
1004
  esphome/components/font/font.h,sha256=nqSOZsAP4M7cZYIY8cIPpyA4I2SgFId9iU_G-vo_CFg,2834
1005
1005
  esphome/components/fs3000/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1283,8 +1283,8 @@ esphome/components/i2s_audio/media_player/__init__.py,sha256=OrkYG35UbKj04hQF1Wt
1283
1283
  esphome/components/i2s_audio/media_player/i2s_audio_media_player.cpp,sha256=CiO08AVUZG-egAIOs9OSgYttC1d3xQT871wJoq4718o,7563
1284
1284
  esphome/components/i2s_audio/media_player/i2s_audio_media_player.h,sha256=gmG6n9YU2Mz85CFa3fO7Na2KBdt9fOrGbDg0-C7jwjI,2078
1285
1285
  esphome/components/i2s_audio/microphone/__init__.py,sha256=m62jL72XwxBavk9cDULs2cdcbHHkM96JF5RPiPBHGcg,4281
1286
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp,sha256=TUsYopCDgzRWi4QRtw3hNx5qmsy4eT8hUnEeUvFyiA4,16932
1287
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.h,sha256=74azu9ZjuKfbE5tPXIMDMQD241EqYU1VtV8gpwfLtHw,2409
1286
+ esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp,sha256=DhfnMf-janbfaW_Df_0VzyS9-yb_DWAb2sZsq7Ifl6I,17889
1287
+ esphome/components/i2s_audio/microphone/i2s_audio_microphone.h,sha256=IVF1iJgzro5NT0mWsrogUZxveExKg9_Q8zCEklFNzIw,2457
1288
1288
  esphome/components/i2s_audio/speaker/__init__.py,sha256=GqE7dlAd6cbn0Es_ZRWpLZhMG0UQrPmwABPfkdF1I_g,6149
1289
1289
  esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp,sha256=WWsZ72wenICP37UHodPgT7_ui_SHKLsBKAff4RuCu2M,27353
1290
1290
  esphome/components/i2s_audio/speaker/i2s_audio_speaker.h,sha256=JZLm5X2Anpx4R34eXONlHvzypJvLI8N-MQiZkFhx7B4,6697
@@ -1640,7 +1640,7 @@ esphome/components/lvgl/widgets/spinner.py,sha256=TpO-rTS4UuBWbEg1O4wuejgVGx6bfD
1640
1640
  esphome/components/lvgl/widgets/switch.py,sha256=qgFVOF16f6dY8O2ZxqB2L3MXi30DCK5VKWtixl-wBOo,433
1641
1641
  esphome/components/lvgl/widgets/tabview.py,sha256=R3upkoqT8pLT0ua4md0JvaBc8MR_kS54HrGeClpyMF4,4198
1642
1642
  esphome/components/lvgl/widgets/textarea.py,sha256=XxQ4VLHY8NCZTIaKkUjMdI17avutBI7VoxzndpJIpJc,1866
1643
- esphome/components/lvgl/widgets/tileview.py,sha256=W_T8DMeaLEZ2TqjKNb8ni8Sh9YYrf2eSi1CWHgZgMt4,3895
1643
+ esphome/components/lvgl/widgets/tileview.py,sha256=ZlO2i1GfJLkdW5aVdtZoqnIoY7aqKwsobNfqgatAVEs,4270
1644
1644
  esphome/components/m5stack_8angle/__init__.py,sha256=deBGpm0St5AydlmnDNclX_O6uEI3baT9XxjuSQzlSUA,793
1645
1645
  esphome/components/m5stack_8angle/m5stack_8angle.cpp,sha256=mt8yIqcFXoRFXJ3lJYomdQ9cEODSne8uQCA0yD_UBtg,2033
1646
1646
  esphome/components/m5stack_8angle/m5stack_8angle.h,sha256=0EG4iGQSWhXGHjxynZmOrgM1kn3IcWpUlF7CioKXeto,997
@@ -3655,9 +3655,9 @@ esphome/dashboard/util/itertools.py,sha256=8eLrWEWmICLtXNxkKdYPQV0c_N4GEz8m9Npnb
3655
3655
  esphome/dashboard/util/password.py,sha256=cQz3b9B-ijTe7zS6BeCW0hc3pWv6JjC78jmnycYYAh8,321
3656
3656
  esphome/dashboard/util/subprocess.py,sha256=T8EW6dbU4LPd2DG1dRrdh8li71tt6J1isn411poMhkk,1022
3657
3657
  esphome/dashboard/util/text.py,sha256=wwFtORlvHjsYkqb68IT-772LHAhWxT4OtnkIcPICQB0,317
3658
- esphome-2025.7.4.dist-info/licenses/LICENSE,sha256=HzEjkBInJe44L4WvAOPfhPJJDNj6YbnqFyvGWRzArGM,36664
3659
- esphome-2025.7.4.dist-info/METADATA,sha256=Dlcq3C2cnO1s5Q9H8HB11OWErxRCjoN-MSri4PJV9TI,3705
3660
- esphome-2025.7.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
3661
- esphome-2025.7.4.dist-info/entry_points.txt,sha256=mIxVNuWtbYzeEcaWCl-AQ-97aBOWbnYBAK8nbF6P4M0,50
3662
- esphome-2025.7.4.dist-info/top_level.txt,sha256=0GSXEW3cnITpgG3qnsSMz0qoqJHAFyfw7Y8MVtEf1Yk,8
3663
- esphome-2025.7.4.dist-info/RECORD,,
3658
+ esphome-2025.7.5.dist-info/licenses/LICENSE,sha256=HzEjkBInJe44L4WvAOPfhPJJDNj6YbnqFyvGWRzArGM,36664
3659
+ esphome-2025.7.5.dist-info/METADATA,sha256=LRzKuaeJjsW7R3qKsOPqy0YTsiPcr58r_0hJ9089avg,3705
3660
+ esphome-2025.7.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
3661
+ esphome-2025.7.5.dist-info/entry_points.txt,sha256=mIxVNuWtbYzeEcaWCl-AQ-97aBOWbnYBAK8nbF6P4M0,50
3662
+ esphome-2025.7.5.dist-info/top_level.txt,sha256=0GSXEW3cnITpgG3qnsSMz0qoqJHAFyfw7Y8MVtEf1Yk,8
3663
+ esphome-2025.7.5.dist-info/RECORD,,