esphome 2024.10.1__py3-none-any.whl → 2024.10.2__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.
@@ -267,6 +267,9 @@ def angle(value):
267
267
  return int(cv.float_range(0.0, 360.0)(cv.angle(value)) * 10)
268
268
 
269
269
 
270
+ lv_angle = LValidator(angle, uint32)
271
+
272
+
270
273
  @schema_extractor("one_of")
271
274
  def size_validator(value):
272
275
  """A size in one axis - one of "size_content", a number (pixels) or a percentage"""
@@ -403,6 +406,7 @@ class TextValidator(LValidator):
403
406
  lv_text = TextValidator()
404
407
  lv_float = LValidator(cv.float_, cg.float_)
405
408
  lv_int = LValidator(cv.int_, cg.int_)
409
+ lv_positive_int = LValidator(cv.positive_int, cg.int_)
406
410
  lv_brightness = LValidator(cv.percentage, cg.float_, retmapper=lambda x: int(x * 255))
407
411
 
408
412
 
@@ -91,7 +91,7 @@ STYLE_PROPS = {
91
91
  "arc_opa": lvalid.opacity,
92
92
  "arc_color": lvalid.lv_color,
93
93
  "arc_rounded": lvalid.lv_bool,
94
- "arc_width": cv.positive_int,
94
+ "arc_width": lvalid.lv_positive_int,
95
95
  "anim_time": lvalid.lv_milliseconds,
96
96
  "bg_color": lvalid.lv_color,
97
97
  "bg_grad": lv_gradient,
@@ -111,7 +111,7 @@ STYLE_PROPS = {
111
111
  "border_side": df.LvConstant(
112
112
  "LV_BORDER_SIDE_", "NONE", "TOP", "BOTTOM", "LEFT", "RIGHT", "INTERNAL"
113
113
  ).several_of,
114
- "border_width": cv.positive_int,
114
+ "border_width": lvalid.lv_positive_int,
115
115
  "clip_corner": lvalid.lv_bool,
116
116
  "color_filter_opa": lvalid.opacity,
117
117
  "height": lvalid.size,
@@ -134,11 +134,11 @@ STYLE_PROPS = {
134
134
  "pad_right": lvalid.pixels,
135
135
  "pad_top": lvalid.pixels,
136
136
  "shadow_color": lvalid.lv_color,
137
- "shadow_ofs_x": cv.int_,
138
- "shadow_ofs_y": cv.int_,
137
+ "shadow_ofs_x": lvalid.lv_int,
138
+ "shadow_ofs_y": lvalid.lv_int,
139
139
  "shadow_opa": lvalid.opacity,
140
- "shadow_spread": cv.int_,
141
- "shadow_width": cv.positive_int,
140
+ "shadow_spread": lvalid.lv_int,
141
+ "shadow_width": lvalid.lv_positive_int,
142
142
  "text_align": df.LvConstant(
143
143
  "LV_TEXT_ALIGN_", "LEFT", "CENTER", "RIGHT", "AUTO"
144
144
  ).one_of,
@@ -150,7 +150,7 @@ STYLE_PROPS = {
150
150
  "text_letter_space": cv.positive_int,
151
151
  "text_line_space": cv.positive_int,
152
152
  "text_opa": lvalid.opacity,
153
- "transform_angle": lvalid.angle,
153
+ "transform_angle": lvalid.lv_angle,
154
154
  "transform_height": lvalid.pixels_or_percent,
155
155
  "transform_pivot_x": lvalid.pixels_or_percent,
156
156
  "transform_pivot_y": lvalid.pixels_or_percent,
@@ -433,16 +433,18 @@ void VoiceAssistant::loop() {
433
433
 
434
434
  #ifdef USE_SPEAKER
435
435
  void VoiceAssistant::write_speaker_() {
436
- if (this->speaker_buffer_size_ > 0) {
437
- size_t write_chunk = std::min<size_t>(this->speaker_buffer_size_, 4 * 1024);
438
- size_t written = this->speaker_->play(this->speaker_buffer_, write_chunk);
439
- if (written > 0) {
440
- memmove(this->speaker_buffer_, this->speaker_buffer_ + written, this->speaker_buffer_size_ - written);
441
- this->speaker_buffer_size_ -= written;
442
- this->speaker_buffer_index_ -= written;
443
- this->set_timeout("speaker-timeout", 5000, [this]() { this->speaker_->stop(); });
444
- } else {
445
- ESP_LOGV(TAG, "Speaker buffer full, trying again next loop");
436
+ if ((this->speaker_ != nullptr) && (this->speaker_buffer_ != nullptr)) {
437
+ if (this->speaker_buffer_size_ > 0) {
438
+ size_t write_chunk = std::min<size_t>(this->speaker_buffer_size_, 4 * 1024);
439
+ size_t written = this->speaker_->play(this->speaker_buffer_, write_chunk);
440
+ if (written > 0) {
441
+ memmove(this->speaker_buffer_, this->speaker_buffer_ + written, this->speaker_buffer_size_ - written);
442
+ this->speaker_buffer_size_ -= written;
443
+ this->speaker_buffer_index_ -= written;
444
+ this->set_timeout("speaker-timeout", 5000, [this]() { this->speaker_->stop(); });
445
+ } else {
446
+ ESP_LOGV(TAG, "Speaker buffer full, trying again next loop");
447
+ }
446
448
  }
447
449
  }
448
450
  }
@@ -772,16 +774,20 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
772
774
  }
773
775
  case api::enums::VOICE_ASSISTANT_TTS_STREAM_START: {
774
776
  #ifdef USE_SPEAKER
775
- this->wait_for_stream_end_ = true;
776
- ESP_LOGD(TAG, "TTS stream start");
777
- this->defer([this] { this->tts_stream_start_trigger_->trigger(); });
777
+ if (this->speaker_ != nullptr) {
778
+ this->wait_for_stream_end_ = true;
779
+ ESP_LOGD(TAG, "TTS stream start");
780
+ this->defer([this] { this->tts_stream_start_trigger_->trigger(); });
781
+ }
778
782
  #endif
779
783
  break;
780
784
  }
781
785
  case api::enums::VOICE_ASSISTANT_TTS_STREAM_END: {
782
786
  #ifdef USE_SPEAKER
783
- this->stream_ended_ = true;
784
- ESP_LOGD(TAG, "TTS stream end");
787
+ if (this->speaker_ != nullptr) {
788
+ this->stream_ended_ = true;
789
+ ESP_LOGD(TAG, "TTS stream end");
790
+ }
785
791
  #endif
786
792
  break;
787
793
  }
@@ -802,14 +808,16 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
802
808
 
803
809
  void VoiceAssistant::on_audio(const api::VoiceAssistantAudio &msg) {
804
810
  #ifdef USE_SPEAKER // We should never get to this function if there is no speaker anyway
805
- if (this->speaker_buffer_index_ + msg.data.length() < SPEAKER_BUFFER_SIZE) {
806
- memcpy(this->speaker_buffer_ + this->speaker_buffer_index_, msg.data.data(), msg.data.length());
807
- this->speaker_buffer_index_ += msg.data.length();
808
- this->speaker_buffer_size_ += msg.data.length();
809
- this->speaker_bytes_received_ += msg.data.length();
810
- ESP_LOGV(TAG, "Received audio: %u bytes from API", msg.data.length());
811
- } else {
812
- ESP_LOGE(TAG, "Cannot receive audio, buffer is full");
811
+ if ((this->speaker_ != nullptr) && (this->speaker_buffer_ != nullptr)) {
812
+ if (this->speaker_buffer_index_ + msg.data.length() < SPEAKER_BUFFER_SIZE) {
813
+ memcpy(this->speaker_buffer_ + this->speaker_buffer_index_, msg.data.data(), msg.data.length());
814
+ this->speaker_buffer_index_ += msg.data.length();
815
+ this->speaker_buffer_size_ += msg.data.length();
816
+ this->speaker_bytes_received_ += msg.data.length();
817
+ ESP_LOGV(TAG, "Received audio: %u bytes from API", msg.data.length());
818
+ } else {
819
+ ESP_LOGE(TAG, "Cannot receive audio, buffer is full");
820
+ }
813
821
  }
814
822
  #endif
815
823
  }
@@ -250,7 +250,7 @@ class VoiceAssistant : public Component {
250
250
  #ifdef USE_SPEAKER
251
251
  void write_speaker_();
252
252
  speaker::Speaker *speaker_{nullptr};
253
- uint8_t *speaker_buffer_;
253
+ uint8_t *speaker_buffer_{nullptr};
254
254
  size_t speaker_buffer_index_{0};
255
255
  size_t speaker_buffer_size_{0};
256
256
  size_t speaker_bytes_received_{0};
@@ -282,8 +282,8 @@ class VoiceAssistant : public Component {
282
282
  float volume_multiplier_;
283
283
  uint32_t conversation_timeout_;
284
284
 
285
- uint8_t *send_buffer_;
286
- int16_t *input_buffer_;
285
+ uint8_t *send_buffer_{nullptr};
286
+ int16_t *input_buffer_{nullptr};
287
287
 
288
288
  bool continuous_{false};
289
289
  bool silence_detection_;
esphome/const.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Constants used by esphome."""
2
2
 
3
- __version__ = "2024.10.1"
3
+ __version__ = "2024.10.2"
4
4
 
5
5
  ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
6
6
  VALID_SUBSTITUTIONS_CHARACTERS = (
esphome/mqtt.py CHANGED
@@ -209,6 +209,12 @@ def show_logs(config, topic=None, username=None, password=None, client_id=None):
209
209
  elif CONF_MQTT in config:
210
210
  conf = config[CONF_MQTT]
211
211
  if CONF_LOG_TOPIC in conf:
212
+ if config[CONF_MQTT][CONF_LOG_TOPIC] is None:
213
+ _LOGGER.error("MQTT log topic set to null, can't start MQTT logs")
214
+ return 1
215
+ if CONF_TOPIC not in config[CONF_MQTT][CONF_LOG_TOPIC]:
216
+ _LOGGER.error("MQTT log topic not available, can't start MQTT logs")
217
+ return 1
212
218
  topic = config[CONF_MQTT][CONF_LOG_TOPIC][CONF_TOPIC]
213
219
  elif CONF_TOPIC_PREFIX in config[CONF_MQTT]:
214
220
  topic = f"{config[CONF_MQTT][CONF_TOPIC_PREFIX]}/debug"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: esphome
3
- Version: 2024.10.1
3
+ Version: 2024.10.2
4
4
  Summary: Make creating custom firmwares for ESP32/ESP8266 super easy.
5
5
  Author-email: The ESPHome Authors <esphome@nabucasa.com>
6
6
  License: MIT
@@ -5,7 +5,7 @@ esphome/codegen.py,sha256=GePHUM7xdXb_Pil59SHVsXg2F4VBPgkH-Fz2PDX8Z54,1873
5
5
  esphome/config.py,sha256=nOiXPZv8wHtmytkNlGcewp0uuJd9G5rRjkqevYXtjzo,39618
6
6
  esphome/config_helpers.py,sha256=MKf_wzO35nn41FvigXE0iYKDslPgL2ruf8R-EPtTT2I,3256
7
7
  esphome/config_validation.py,sha256=MeZcJrTRpe91KV5r18i6U-PeZ_Oaql81m12KW_gzCXU,66221
8
- esphome/const.py,sha256=UiLeLL6QhKcTUlBLBHya_JxA5HRNO7Z0Z7y_d4tZses,40030
8
+ esphome/const.py,sha256=dEYtG4kBiixzrPjFOlNNPegHXcq0Zn-v5mwCKTZpirk,40030
9
9
  esphome/coroutine.py,sha256=j_14z8dIIzIBeuNO30D4c1RJvMMt1xZFZ58Evd-EvJA,9344
10
10
  esphome/cpp_generator.py,sha256=lXPXHYUsFIvBSAoZ93mXYlGcXYg5L18nTtYGHE4_rr8,31203
11
11
  esphome/cpp_helpers.py,sha256=6C2vNbOIhZKi43xRVlk5hp9GfshfBn-rc5D_ZFUEYaE,4801
@@ -17,7 +17,7 @@ esphome/git.py,sha256=rKb5JUc05nbRlvR4tRWGL851ANZUYuS7YZp5Tm5wHjE,6296
17
17
  esphome/helpers.py,sha256=o0fhHNo-acxPLenSy_e5qR6f5rhOkDWVHaX9eheqdcI,10454
18
18
  esphome/loader.py,sha256=jDxlzaWlO_o3sC_3vviFcwTjuKi37JpBu4WqG8Bkbdc,6573
19
19
  esphome/log.py,sha256=9aoxHebCu4DnowC8n1kgDJqYBqZqf5ZNSSFqFg_x8-I,2179
20
- esphome/mqtt.py,sha256=8VA7W1sVIzfRrzYCAzfabG4TPT_ACo_Q3nMkltXZ0JA,8721
20
+ esphome/mqtt.py,sha256=3B3_ILAvynsVFiKav7w_nrD0pAXh9eaRXJj6jtdb0ps,9065
21
21
  esphome/pins.py,sha256=wO0d-2qn0fhT6WEN0H0AmYRSH90jW154hZT7RewMGYI,10713
22
22
  esphome/platformio_api.py,sha256=OEWhPZ2NQnTrZ3Vtm0IqW0E-xE7EyVhs5w3OtT2xfDY,11905
23
23
  esphome/schema_extractors.py,sha256=wQMtWFp2q4ZZ97Xv3xVhFUU6Ol3qjcyDtjowG4Shllo,2108
@@ -1449,12 +1449,12 @@ esphome/components/lvgl/font.cpp,sha256=l9dPIw7LdOdtg_3QZErTLLevMc6A66Wfm-1s-6qc
1449
1449
  esphome/components/lvgl/gradient.py,sha256=K60e7b52N8i7aQjkLIsij7OOXmVhBnJnxj4J3zPme4w,1989
1450
1450
  esphome/components/lvgl/hello_world.py,sha256=iwfSWO0TT0CEGN5M_QBY_oKqmYshT69jOBDFTTUyBII,1417
1451
1451
  esphome/components/lvgl/helpers.py,sha256=XI3C5IHwoSVlgR32kMxeXTZWK6iW112nmWv5wByrKLY,1253
1452
- esphome/components/lvgl/lv_validation.py,sha256=wvhdQKhYLLjSK_YEkEAoT_6H31Gd942P_KWTm3zYcfU,13572
1452
+ esphome/components/lvgl/lv_validation.py,sha256=J6iP8bzlNd0_DDHWxmZOJyMfXbVxID-AXJfCjHPkMKw,13666
1453
1453
  esphome/components/lvgl/lvcode.py,sha256=cpBpc7ZftH6VVZWsRCdEZOO7-yHLD5JhVPMKFRBZOs8,10295
1454
1454
  esphome/components/lvgl/lvgl_esphome.cpp,sha256=JBnbvisKonhExjtp2WFlZYOWgSX_0wiM8bAZn6YxqCw,14157
1455
1455
  esphome/components/lvgl/lvgl_esphome.h,sha256=3RpW5BoNQt8MpWexZqb2L_CJ7cgGJWYrwRXp5LK6S0k,9265
1456
1456
  esphome/components/lvgl/lvgl_hal.h,sha256=aZqWpSmKKAB-ZfNxxgxjgASTtLpAZjXJKuoTiPB0qqU,431
1457
- esphome/components/lvgl/schemas.py,sha256=Nvrj2bPI_RYc1VOCVTaKOhIAvitylkvlu4M1yPg8_PU,14174
1457
+ esphome/components/lvgl/schemas.py,sha256=NYBfD6qfy_P1ST6f-7MhxPhDmPHkTJ2rk14u1Mq3aO8,14216
1458
1458
  esphome/components/lvgl/styles.py,sha256=a98M5BPsPZUJplY5N73pqhLb2b4p_l_V6vQ8DDKH0Pc,2249
1459
1459
  esphome/components/lvgl/touchscreens.py,sha256=R2tkfse86qzWDU6Ot_tARApWfn1jeFaJObDUX5gITL8,1634
1460
1460
  esphome/components/lvgl/trigger.py,sha256=iR2jixpj5FnLYSAuy6q8GC1njRkTCPhxZEJILUeyPZ4,2337
@@ -3040,8 +3040,8 @@ esphome/components/vl53l0x/sensor.py,sha256=P8rWgRSOAQO-kAn35UC2I2_UwmYKUWS3DvYD
3040
3040
  esphome/components/vl53l0x/vl53l0x_sensor.cpp,sha256=JqSIf9jjNhin561LU-QzAmRKEK0PqQ8CuLO2mn380og,15017
3041
3041
  esphome/components/vl53l0x/vl53l0x_sensor.h,sha256=iTtScB2O7DVFh0eR9AVht2l3AdSAPJOVMtflTv2ZX7c,2561
3042
3042
  esphome/components/voice_assistant/__init__.py,sha256=mMd2eklOnmvpDJLjzr1nIUS6iXIWjHi6mmlGDs7iV1M,13826
3043
- esphome/components/voice_assistant/voice_assistant.cpp,sha256=p3QkEluD845Xu3XYB_6K5sAta_MpvMRQ9hQ97nGZ4gU,29559
3044
- esphome/components/voice_assistant/voice_assistant.h,sha256=5Do-4sdNRPokNNdB4_0XNP7g-XYcojhpMGu9rFaxVhI,11644
3043
+ esphome/components/voice_assistant/voice_assistant.cpp,sha256=NPvFK2LMKjKcgxtKXhqvZoxUBL4R9bfWO-1dqTkyjr8,29863
3044
+ esphome/components/voice_assistant/voice_assistant.h,sha256=hlbcIrSBsY3b6cmOULeB_uv9KkNT7iS7IKMYS1rDCe4,11671
3045
3045
  esphome/components/voltage_sampler/__init__.py,sha256=IU5YrROZSNyuAP1d6M_V3ZGAwNjXCHPcVy5nMjZ953Y,155
3046
3046
  esphome/components/voltage_sampler/voltage_sampler.h,sha256=Y67FLOpOzW29v29BRRyYgEmGZ_B8QnUUaqJMH6FA3jM,337
3047
3047
  esphome/components/wake_on_lan/__init__.py,sha256=-RYpXD02o3dlFnKzOCYk58bUbxfD2v-wj1ECywj-cgI,50
@@ -3309,9 +3309,9 @@ esphome/dashboard/util/itertools.py,sha256=8eLrWEWmICLtXNxkKdYPQV0c_N4GEz8m9Npnb
3309
3309
  esphome/dashboard/util/password.py,sha256=cQz3b9B-ijTe7zS6BeCW0hc3pWv6JjC78jmnycYYAh8,321
3310
3310
  esphome/dashboard/util/subprocess.py,sha256=T8EW6dbU4LPd2DG1dRrdh8li71tt6J1isn411poMhkk,1022
3311
3311
  esphome/dashboard/util/text.py,sha256=ENDnfN4O0NdA3CKVJjQYabFbwbrsIhVKrAMQe53qYu4,534
3312
- esphome-2024.10.1.dist-info/LICENSE,sha256=HzEjkBInJe44L4WvAOPfhPJJDNj6YbnqFyvGWRzArGM,36664
3313
- esphome-2024.10.1.dist-info/METADATA,sha256=b9YvzWDW4Q3Cztg34HjZPfGjtO9amPrhMsiQWP5QtPo,3407
3314
- esphome-2024.10.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
3315
- esphome-2024.10.1.dist-info/entry_points.txt,sha256=mIxVNuWtbYzeEcaWCl-AQ-97aBOWbnYBAK8nbF6P4M0,50
3316
- esphome-2024.10.1.dist-info/top_level.txt,sha256=0GSXEW3cnITpgG3qnsSMz0qoqJHAFyfw7Y8MVtEf1Yk,8
3317
- esphome-2024.10.1.dist-info/RECORD,,
3312
+ esphome-2024.10.2.dist-info/LICENSE,sha256=HzEjkBInJe44L4WvAOPfhPJJDNj6YbnqFyvGWRzArGM,36664
3313
+ esphome-2024.10.2.dist-info/METADATA,sha256=LWw73uKU1gpiyC-waNEhY3MMflu2cGuOWghTAYNIK1g,3407
3314
+ esphome-2024.10.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
3315
+ esphome-2024.10.2.dist-info/entry_points.txt,sha256=mIxVNuWtbYzeEcaWCl-AQ-97aBOWbnYBAK8nbF6P4M0,50
3316
+ esphome-2024.10.2.dist-info/top_level.txt,sha256=0GSXEW3cnITpgG3qnsSMz0qoqJHAFyfw7Y8MVtEf1Yk,8
3317
+ esphome-2024.10.2.dist-info/RECORD,,