esphome 2024.8.2__py3-none-any.whl → 2024.9.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 (204) hide show
  1. esphome/__main__.py +6 -2
  2. esphome/components/api/api_connection.cpp +53 -0
  3. esphome/components/api/api_connection.h +4 -0
  4. esphome/components/api/api_pb2.cpp +280 -0
  5. esphome/components/api/api_pb2.h +91 -0
  6. esphome/components/api/api_pb2_service.cpp +85 -0
  7. esphome/components/api/api_pb2_service.h +28 -0
  8. esphome/components/async_tcp/__init__.py +3 -3
  9. esphome/components/atm90e26/sensor.py +10 -10
  10. esphome/components/atm90e32/sensor.py +1 -1
  11. esphome/components/bl0906/__init__.py +1 -0
  12. esphome/components/bl0906/bl0906.cpp +238 -0
  13. esphome/components/bl0906/bl0906.h +96 -0
  14. esphome/components/bl0906/const.py +4 -0
  15. esphome/components/bl0906/constants.h +122 -0
  16. esphome/components/bl0906/sensor.py +184 -0
  17. esphome/components/bl0942/__init__.py +1 -1
  18. esphome/components/bl0942/bl0942.cpp +127 -34
  19. esphome/components/bl0942/bl0942.h +87 -3
  20. esphome/components/bl0942/sensor.py +46 -8
  21. esphome/components/ble_client/__init__.py +1 -3
  22. esphome/components/ble_presence/binary_sensor.py +2 -2
  23. esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
  24. esphome/components/bmp280/sensor.py +2 -93
  25. esphome/components/bmp280_base/__init__.py +88 -0
  26. esphome/components/{bmp280/bmp280.cpp → bmp280_base/bmp280_base.cpp} +11 -4
  27. esphome/components/{bmp280/bmp280.h → bmp280_base/bmp280_base.h} +9 -5
  28. esphome/components/bmp280_i2c/__init__.py +0 -0
  29. esphome/components/bmp280_i2c/bmp280_i2c.cpp +27 -0
  30. esphome/components/bmp280_i2c/bmp280_i2c.h +22 -0
  31. esphome/components/bmp280_i2c/sensor.py +22 -0
  32. esphome/components/bmp280_spi/__init__.py +0 -0
  33. esphome/components/bmp280_spi/bmp280_spi.cpp +65 -0
  34. esphome/components/bmp280_spi/bmp280_spi.h +20 -0
  35. esphome/components/bmp280_spi/sensor.py +22 -0
  36. esphome/components/captive_portal/captive_portal.cpp +2 -0
  37. esphome/components/captive_portal/captive_portal.h +3 -1
  38. esphome/components/ch422g/__init__.py +67 -0
  39. esphome/components/ch422g/ch422g.cpp +122 -0
  40. esphome/components/ch422g/ch422g.h +70 -0
  41. esphome/components/debug/debug_esp32.cpp +3 -1
  42. esphome/components/display/__init__.py +5 -4
  43. esphome/components/dsmr/dsmr.cpp +6 -0
  44. esphome/components/dsmr/dsmr.h +6 -0
  45. esphome/components/dsmr/text_sensor.py +7 -2
  46. esphome/components/e131/e131.cpp +2 -0
  47. esphome/components/e131/e131.h +3 -1
  48. esphome/components/e131/e131_addressable_light_effect.cpp +2 -0
  49. esphome/components/e131/e131_addressable_light_effect.h +2 -1
  50. esphome/components/e131/e131_packet.cpp +2 -0
  51. esphome/components/esp32_ble/ble_uuid.cpp +7 -0
  52. esphome/components/esp32_ble/ble_uuid.h +1 -0
  53. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +11 -9
  54. esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +3 -3
  55. esphome/components/esp32_camera/__init__.py +4 -0
  56. esphome/components/esp32_camera/esp32_camera.cpp +9 -1
  57. esphome/components/esp32_camera/esp32_camera.h +3 -0
  58. esphome/components/esp32_can/canbus.py +18 -7
  59. esphome/components/esp32_can/esp32_can.cpp +8 -0
  60. esphome/components/esp32_can/esp32_can.h +4 -0
  61. esphome/components/esp32_rmt_led_strip/led_strip.cpp +14 -2
  62. esphome/components/esp32_rmt_led_strip/led_strip.h +3 -2
  63. esphome/components/esp32_rmt_led_strip/light.py +21 -4
  64. esphome/components/esphome/ota/ota_esphome.cpp +2 -1
  65. esphome/components/esphome/ota/ota_esphome.h +2 -0
  66. esphome/components/font/__init__.py +11 -22
  67. esphome/components/font/font.cpp +3 -2
  68. esphome/components/font/font.h +12 -3
  69. esphome/components/gree/climate.py +2 -1
  70. esphome/components/gree/gree.cpp +54 -3
  71. esphome/components/gree/gree.h +10 -2
  72. esphome/components/gt911/touchscreen/__init__.py +6 -4
  73. esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +17 -0
  74. esphome/components/gt911/touchscreen/gt911_touchscreen.h +2 -0
  75. esphome/components/hmac_md5/__init__.py +2 -0
  76. esphome/components/hmac_md5/hmac_md5.cpp +56 -0
  77. esphome/components/hmac_md5/hmac_md5.h +48 -0
  78. esphome/components/homeassistant/__init__.py +13 -0
  79. esphome/components/homeassistant/switch/__init__.py +15 -2
  80. esphome/components/homeassistant/switch/homeassistant_switch.cpp +2 -2
  81. esphome/components/i2s_audio/__init__.py +88 -9
  82. esphome/components/i2s_audio/i2s_audio.h +20 -2
  83. esphome/components/i2s_audio/media_player/__init__.py +8 -4
  84. esphome/components/i2s_audio/media_player/i2s_audio_media_player.h +1 -1
  85. esphome/components/i2s_audio/microphone/__init__.py +19 -51
  86. esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +18 -15
  87. esphome/components/i2s_audio/microphone/i2s_audio_microphone.h +0 -12
  88. esphome/components/i2s_audio/speaker/__init__.py +39 -27
  89. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +49 -37
  90. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +3 -4
  91. esphome/components/ili9xxx/display.py +16 -17
  92. esphome/components/ili9xxx/ili9xxx_display.cpp +1 -1
  93. esphome/components/ili9xxx/ili9xxx_display.h +18 -18
  94. esphome/components/ili9xxx/ili9xxx_init.h +0 -3
  95. esphome/components/improv_serial/improv_serial_component.cpp +2 -1
  96. esphome/components/improv_serial/improv_serial_component.h +2 -1
  97. esphome/components/ledc/ledc_output.cpp +11 -7
  98. esphome/components/libretiny/__init__.py +8 -13
  99. esphome/components/ltr501/__init__.py +1 -0
  100. esphome/components/ltr501/ltr501.cpp +542 -0
  101. esphome/components/ltr501/ltr501.h +184 -0
  102. esphome/components/ltr501/ltr_definitions_501.h +260 -0
  103. esphome/components/ltr501/sensor.py +274 -0
  104. esphome/components/ltr_als_ps/sensor.py +2 -2
  105. esphome/components/lvgl/__init__.py +19 -16
  106. esphome/components/lvgl/automation.py +90 -9
  107. esphome/components/lvgl/defines.py +29 -2
  108. esphome/components/lvgl/gradient.py +61 -0
  109. esphome/components/lvgl/lv_validation.py +45 -27
  110. esphome/components/lvgl/lvcode.py +8 -3
  111. esphome/components/lvgl/lvgl_esphome.cpp +54 -0
  112. esphome/components/lvgl/lvgl_esphome.h +9 -3
  113. esphome/components/lvgl/number/__init__.py +1 -0
  114. esphome/components/lvgl/number/lvgl_number.h +3 -1
  115. esphome/components/lvgl/schemas.py +16 -11
  116. esphome/components/lvgl/select/__init__.py +1 -0
  117. esphome/components/lvgl/select/lvgl_select.h +3 -1
  118. esphome/components/lvgl/switch/__init__.py +2 -1
  119. esphome/components/lvgl/switch/lvgl_switch.h +3 -1
  120. esphome/components/lvgl/text/__init__.py +1 -0
  121. esphome/components/lvgl/text/lvgl_text.h +3 -1
  122. esphome/components/lvgl/trigger.py +3 -2
  123. esphome/components/lvgl/types.py +2 -1
  124. esphome/components/lvgl/widgets/__init__.py +23 -8
  125. esphome/components/lvgl/widgets/arc.py +5 -1
  126. esphome/components/lvgl/widgets/buttonmatrix.py +5 -1
  127. esphome/components/lvgl/widgets/checkbox.py +8 -3
  128. esphome/components/lvgl/widgets/meter.py +8 -1
  129. esphome/components/lvgl/widgets/msgbox.py +26 -15
  130. esphome/components/lvgl/widgets/page.py +51 -7
  131. esphome/components/lvgl/widgets/tileview.py +2 -8
  132. esphome/components/max31856/max31856.cpp +12 -1
  133. esphome/components/max31856/max31856.h +5 -2
  134. esphome/components/max31856/sensor.py +20 -0
  135. esphome/components/mcp9600/sensor.py +2 -2
  136. esphome/components/mdns/__init__.py +6 -6
  137. esphome/components/media_player/media_player.h +16 -0
  138. esphome/components/micro_wake_word/__init__.py +2 -25
  139. esphome/components/microphone/microphone.h +1 -1
  140. esphome/components/mics_4514/mics_4514.cpp +26 -36
  141. esphome/components/modbus_controller/__init__.py +6 -0
  142. esphome/components/modbus_controller/const.py +2 -0
  143. esphome/components/modbus_controller/modbus_controller.cpp +30 -27
  144. esphome/components/modbus_controller/modbus_controller.h +22 -4
  145. esphome/components/network/__init__.py +11 -8
  146. esphome/components/pipsolar/pipsolar.cpp +3 -0
  147. esphome/components/pipsolar/pipsolar.h +1 -0
  148. esphome/components/pipsolar/switch/__init__.py +2 -0
  149. esphome/components/prometheus/prometheus_handler.cpp +2 -0
  150. esphome/components/prometheus/prometheus_handler.h +3 -1
  151. esphome/components/rp2040/__init__.py +7 -8
  152. esphome/components/rpi_dpi_rgb/display.py +20 -17
  153. esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.cpp +36 -6
  154. esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.h +4 -0
  155. esphome/components/socket/socket.cpp +2 -0
  156. esphome/components/socket/socket.h +2 -0
  157. esphome/components/speaker/speaker.h +1 -1
  158. esphome/components/st7701s/display.py +35 -37
  159. esphome/components/st7701s/st7701s.cpp +11 -6
  160. esphome/components/st7701s/st7701s.h +1 -0
  161. esphome/components/statsd/__init__.py +65 -0
  162. esphome/components/statsd/statsd.cpp +156 -0
  163. esphome/components/statsd/statsd.h +86 -0
  164. esphome/components/tuya/__init__.py +1 -0
  165. esphome/components/tuya/number/__init__.py +39 -2
  166. esphome/components/tuya/number/tuya_number.cpp +58 -2
  167. esphome/components/tuya/number/tuya_number.h +12 -3
  168. esphome/components/udp/__init__.py +158 -0
  169. esphome/components/udp/binary_sensor.py +27 -0
  170. esphome/components/udp/sensor.py +27 -0
  171. esphome/components/udp/udp_component.cpp +616 -0
  172. esphome/components/udp/udp_component.h +158 -0
  173. esphome/components/uponor_smatrix/uponor_smatrix.cpp +4 -6
  174. esphome/components/uponor_smatrix/uponor_smatrix.h +0 -1
  175. esphome/components/veml7700/sensor.py +2 -2
  176. esphome/components/voice_assistant/__init__.py +6 -0
  177. esphome/components/voice_assistant/voice_assistant.cpp +24 -2
  178. esphome/components/voice_assistant/voice_assistant.h +20 -0
  179. esphome/components/web_server/__init__.py +11 -11
  180. esphome/components/web_server/list_entities.cpp +2 -0
  181. esphome/components/web_server/list_entities.h +3 -1
  182. esphome/components/web_server/web_server.cpp +2 -1
  183. esphome/components/web_server/web_server.h +2 -0
  184. esphome/components/web_server_base/web_server_base.cpp +2 -0
  185. esphome/components/web_server_base/web_server_base.h +3 -1
  186. esphome/components/wifi/wifi_component_libretiny.cpp +15 -1
  187. esphome/components/wireguard/__init__.py +9 -6
  188. esphome/components/wireguard/wireguard.cpp +2 -1
  189. esphome/components/wireguard/wireguard.h +3 -1
  190. esphome/config_validation.py +8 -0
  191. esphome/const.py +8 -1
  192. esphome/core/bytebuffer.cpp +117 -84
  193. esphome/core/bytebuffer.h +69 -21
  194. esphome/core/config.py +0 -3
  195. esphome/core/defines.h +2 -0
  196. esphome/core/ring_buffer.cpp +13 -2
  197. esphome/core/ring_buffer.h +56 -0
  198. esphome/external_files.py +5 -3
  199. {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/METADATA +1 -1
  200. {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/RECORD +204 -169
  201. {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/LICENSE +0 -0
  202. {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/WHEEL +0 -0
  203. {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/entry_points.txt +0 -0
  204. {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/top_level.txt +0 -0
esphome/__main__.py CHANGED
@@ -38,7 +38,7 @@ from esphome.const import (
38
38
  SECRETS_FILES,
39
39
  )
40
40
  from esphome.core import CORE, EsphomeError, coroutine
41
- from esphome.helpers import indent, is_ip_address
41
+ from esphome.helpers import indent, is_ip_address, get_bool_env
42
42
  from esphome.log import Fore, color, setup_log
43
43
  from esphome.util import (
44
44
  get_serial_ports,
@@ -731,7 +731,11 @@ POST_CONFIG_ACTIONS = {
731
731
  def parse_args(argv):
732
732
  options_parser = argparse.ArgumentParser(add_help=False)
733
733
  options_parser.add_argument(
734
- "-v", "--verbose", help="Enable verbose ESPHome logs.", action="store_true"
734
+ "-v",
735
+ "--verbose",
736
+ help="Enable verbose ESPHome logs.",
737
+ action="store_true",
738
+ default=get_bool_env("ESPHOME_VERBOSE"),
735
739
  )
736
740
  options_parser.add_argument(
737
741
  "-q", "--quiet", help="Disable all ESPHome logs.", action="store_true"
@@ -1026,6 +1026,16 @@ bool APIConnection::send_media_player_info(media_player::MediaPlayer *media_play
1026
1026
  auto traits = media_player->get_traits();
1027
1027
  msg.supports_pause = traits.get_supports_pause();
1028
1028
 
1029
+ for (auto &supported_format : traits.get_supported_formats()) {
1030
+ MediaPlayerSupportedFormat media_format;
1031
+ media_format.format = supported_format.format;
1032
+ media_format.sample_rate = supported_format.sample_rate;
1033
+ media_format.num_channels = supported_format.num_channels;
1034
+ media_format.purpose = static_cast<enums::MediaPlayerFormatPurpose>(supported_format.purpose);
1035
+ media_format.sample_bytes = supported_format.sample_bytes;
1036
+ msg.supported_formats.push_back(media_format);
1037
+ }
1038
+
1029
1039
  return this->send_list_entities_media_player_response(msg);
1030
1040
  }
1031
1041
  void APIConnection::media_player_command(const MediaPlayerCommandRequest &msg) {
@@ -1204,6 +1214,49 @@ void APIConnection::on_voice_assistant_timer_event_response(const VoiceAssistant
1204
1214
  }
1205
1215
  };
1206
1216
 
1217
+ void APIConnection::on_voice_assistant_announce_request(const VoiceAssistantAnnounceRequest &msg) {
1218
+ if (voice_assistant::global_voice_assistant != nullptr) {
1219
+ if (voice_assistant::global_voice_assistant->get_api_connection() != this) {
1220
+ return;
1221
+ }
1222
+
1223
+ voice_assistant::global_voice_assistant->on_announce(msg);
1224
+ }
1225
+ }
1226
+
1227
+ VoiceAssistantConfigurationResponse APIConnection::voice_assistant_get_configuration(
1228
+ const VoiceAssistantConfigurationRequest &msg) {
1229
+ VoiceAssistantConfigurationResponse resp;
1230
+ if (voice_assistant::global_voice_assistant != nullptr) {
1231
+ if (voice_assistant::global_voice_assistant->get_api_connection() != this) {
1232
+ return resp;
1233
+ }
1234
+
1235
+ auto &config = voice_assistant::global_voice_assistant->get_configuration();
1236
+ for (auto &wake_word : config.available_wake_words) {
1237
+ VoiceAssistantWakeWord resp_wake_word;
1238
+ resp_wake_word.id = wake_word.id;
1239
+ resp_wake_word.wake_word = wake_word.wake_word;
1240
+ for (const auto &lang : wake_word.trained_languages) {
1241
+ resp_wake_word.trained_languages.push_back(lang);
1242
+ }
1243
+ resp.available_wake_words.push_back(std::move(resp_wake_word));
1244
+ }
1245
+ resp.max_active_wake_words = config.max_active_wake_words;
1246
+ }
1247
+ return resp;
1248
+ }
1249
+
1250
+ void APIConnection::voice_assistant_set_configuration(const VoiceAssistantSetConfiguration &msg) {
1251
+ if (voice_assistant::global_voice_assistant != nullptr) {
1252
+ if (voice_assistant::global_voice_assistant->get_api_connection() != this) {
1253
+ return;
1254
+ }
1255
+
1256
+ voice_assistant::global_voice_assistant->on_set_configuration(msg.active_wake_words);
1257
+ }
1258
+ }
1259
+
1207
1260
  #endif
1208
1261
 
1209
1262
  #ifdef USE_ALARM_CONTROL_PANEL
@@ -151,6 +151,10 @@ class APIConnection : public APIServerConnection {
151
151
  void on_voice_assistant_event_response(const VoiceAssistantEventResponse &msg) override;
152
152
  void on_voice_assistant_audio(const VoiceAssistantAudio &msg) override;
153
153
  void on_voice_assistant_timer_event_response(const VoiceAssistantTimerEventResponse &msg) override;
154
+ void on_voice_assistant_announce_request(const VoiceAssistantAnnounceRequest &msg) override;
155
+ VoiceAssistantConfigurationResponse voice_assistant_get_configuration(
156
+ const VoiceAssistantConfigurationRequest &msg) override;
157
+ void voice_assistant_set_configuration(const VoiceAssistantSetConfiguration &msg) override;
154
158
  #endif
155
159
 
156
160
  #ifdef USE_ALARM_CONTROL_PANEL
@@ -387,6 +387,18 @@ template<> const char *proto_enum_to_string<enums::MediaPlayerCommand>(enums::Me
387
387
  }
388
388
  #endif
389
389
  #ifdef HAS_PROTO_MESSAGE_DUMP
390
+ template<> const char *proto_enum_to_string<enums::MediaPlayerFormatPurpose>(enums::MediaPlayerFormatPurpose value) {
391
+ switch (value) {
392
+ case enums::MEDIA_PLAYER_FORMAT_PURPOSE_DEFAULT:
393
+ return "MEDIA_PLAYER_FORMAT_PURPOSE_DEFAULT";
394
+ case enums::MEDIA_PLAYER_FORMAT_PURPOSE_ANNOUNCEMENT:
395
+ return "MEDIA_PLAYER_FORMAT_PURPOSE_ANNOUNCEMENT";
396
+ default:
397
+ return "UNKNOWN";
398
+ }
399
+ }
400
+ #endif
401
+ #ifdef HAS_PROTO_MESSAGE_DUMP
390
402
  template<>
391
403
  const char *proto_enum_to_string<enums::BluetoothDeviceRequestType>(enums::BluetoothDeviceRequestType value) {
392
404
  switch (value) {
@@ -5123,6 +5135,74 @@ void ButtonCommandRequest::dump_to(std::string &out) const {
5123
5135
  out.append("}");
5124
5136
  }
5125
5137
  #endif
5138
+ bool MediaPlayerSupportedFormat::decode_varint(uint32_t field_id, ProtoVarInt value) {
5139
+ switch (field_id) {
5140
+ case 2: {
5141
+ this->sample_rate = value.as_uint32();
5142
+ return true;
5143
+ }
5144
+ case 3: {
5145
+ this->num_channels = value.as_uint32();
5146
+ return true;
5147
+ }
5148
+ case 4: {
5149
+ this->purpose = value.as_enum<enums::MediaPlayerFormatPurpose>();
5150
+ return true;
5151
+ }
5152
+ case 5: {
5153
+ this->sample_bytes = value.as_uint32();
5154
+ return true;
5155
+ }
5156
+ default:
5157
+ return false;
5158
+ }
5159
+ }
5160
+ bool MediaPlayerSupportedFormat::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
5161
+ switch (field_id) {
5162
+ case 1: {
5163
+ this->format = value.as_string();
5164
+ return true;
5165
+ }
5166
+ default:
5167
+ return false;
5168
+ }
5169
+ }
5170
+ void MediaPlayerSupportedFormat::encode(ProtoWriteBuffer buffer) const {
5171
+ buffer.encode_string(1, this->format);
5172
+ buffer.encode_uint32(2, this->sample_rate);
5173
+ buffer.encode_uint32(3, this->num_channels);
5174
+ buffer.encode_enum<enums::MediaPlayerFormatPurpose>(4, this->purpose);
5175
+ buffer.encode_uint32(5, this->sample_bytes);
5176
+ }
5177
+ #ifdef HAS_PROTO_MESSAGE_DUMP
5178
+ void MediaPlayerSupportedFormat::dump_to(std::string &out) const {
5179
+ __attribute__((unused)) char buffer[64];
5180
+ out.append("MediaPlayerSupportedFormat {\n");
5181
+ out.append(" format: ");
5182
+ out.append("'").append(this->format).append("'");
5183
+ out.append("\n");
5184
+
5185
+ out.append(" sample_rate: ");
5186
+ sprintf(buffer, "%" PRIu32, this->sample_rate);
5187
+ out.append(buffer);
5188
+ out.append("\n");
5189
+
5190
+ out.append(" num_channels: ");
5191
+ sprintf(buffer, "%" PRIu32, this->num_channels);
5192
+ out.append(buffer);
5193
+ out.append("\n");
5194
+
5195
+ out.append(" purpose: ");
5196
+ out.append(proto_enum_to_string<enums::MediaPlayerFormatPurpose>(this->purpose));
5197
+ out.append("\n");
5198
+
5199
+ out.append(" sample_bytes: ");
5200
+ sprintf(buffer, "%" PRIu32, this->sample_bytes);
5201
+ out.append(buffer);
5202
+ out.append("\n");
5203
+ out.append("}");
5204
+ }
5205
+ #endif
5126
5206
  bool ListEntitiesMediaPlayerResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
5127
5207
  switch (field_id) {
5128
5208
  case 6: {
@@ -5159,6 +5239,10 @@ bool ListEntitiesMediaPlayerResponse::decode_length(uint32_t field_id, ProtoLeng
5159
5239
  this->icon = value.as_string();
5160
5240
  return true;
5161
5241
  }
5242
+ case 9: {
5243
+ this->supported_formats.push_back(value.as_message<MediaPlayerSupportedFormat>());
5244
+ return true;
5245
+ }
5162
5246
  default:
5163
5247
  return false;
5164
5248
  }
@@ -5182,6 +5266,9 @@ void ListEntitiesMediaPlayerResponse::encode(ProtoWriteBuffer buffer) const {
5182
5266
  buffer.encode_bool(6, this->disabled_by_default);
5183
5267
  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
5184
5268
  buffer.encode_bool(8, this->supports_pause);
5269
+ for (auto &it : this->supported_formats) {
5270
+ buffer.encode_message<MediaPlayerSupportedFormat>(9, it, true);
5271
+ }
5185
5272
  }
5186
5273
  #ifdef HAS_PROTO_MESSAGE_DUMP
5187
5274
  void ListEntitiesMediaPlayerResponse::dump_to(std::string &out) const {
@@ -5219,6 +5306,12 @@ void ListEntitiesMediaPlayerResponse::dump_to(std::string &out) const {
5219
5306
  out.append(" supports_pause: ");
5220
5307
  out.append(YESNO(this->supports_pause));
5221
5308
  out.append("\n");
5309
+
5310
+ for (const auto &it : this->supported_formats) {
5311
+ out.append(" supported_formats: ");
5312
+ it.dump_to(out);
5313
+ out.append("\n");
5314
+ }
5222
5315
  out.append("}");
5223
5316
  }
5224
5317
  #endif
@@ -6978,6 +7071,193 @@ void VoiceAssistantTimerEventResponse::dump_to(std::string &out) const {
6978
7071
  out.append("}");
6979
7072
  }
6980
7073
  #endif
7074
+ bool VoiceAssistantAnnounceRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
7075
+ switch (field_id) {
7076
+ case 1: {
7077
+ this->media_id = value.as_string();
7078
+ return true;
7079
+ }
7080
+ case 2: {
7081
+ this->text = value.as_string();
7082
+ return true;
7083
+ }
7084
+ default:
7085
+ return false;
7086
+ }
7087
+ }
7088
+ void VoiceAssistantAnnounceRequest::encode(ProtoWriteBuffer buffer) const {
7089
+ buffer.encode_string(1, this->media_id);
7090
+ buffer.encode_string(2, this->text);
7091
+ }
7092
+ #ifdef HAS_PROTO_MESSAGE_DUMP
7093
+ void VoiceAssistantAnnounceRequest::dump_to(std::string &out) const {
7094
+ __attribute__((unused)) char buffer[64];
7095
+ out.append("VoiceAssistantAnnounceRequest {\n");
7096
+ out.append(" media_id: ");
7097
+ out.append("'").append(this->media_id).append("'");
7098
+ out.append("\n");
7099
+
7100
+ out.append(" text: ");
7101
+ out.append("'").append(this->text).append("'");
7102
+ out.append("\n");
7103
+ out.append("}");
7104
+ }
7105
+ #endif
7106
+ bool VoiceAssistantAnnounceFinished::decode_varint(uint32_t field_id, ProtoVarInt value) {
7107
+ switch (field_id) {
7108
+ case 1: {
7109
+ this->success = value.as_bool();
7110
+ return true;
7111
+ }
7112
+ default:
7113
+ return false;
7114
+ }
7115
+ }
7116
+ void VoiceAssistantAnnounceFinished::encode(ProtoWriteBuffer buffer) const { buffer.encode_bool(1, this->success); }
7117
+ #ifdef HAS_PROTO_MESSAGE_DUMP
7118
+ void VoiceAssistantAnnounceFinished::dump_to(std::string &out) const {
7119
+ __attribute__((unused)) char buffer[64];
7120
+ out.append("VoiceAssistantAnnounceFinished {\n");
7121
+ out.append(" success: ");
7122
+ out.append(YESNO(this->success));
7123
+ out.append("\n");
7124
+ out.append("}");
7125
+ }
7126
+ #endif
7127
+ bool VoiceAssistantWakeWord::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
7128
+ switch (field_id) {
7129
+ case 1: {
7130
+ this->id = value.as_string();
7131
+ return true;
7132
+ }
7133
+ case 2: {
7134
+ this->wake_word = value.as_string();
7135
+ return true;
7136
+ }
7137
+ case 3: {
7138
+ this->trained_languages.push_back(value.as_string());
7139
+ return true;
7140
+ }
7141
+ default:
7142
+ return false;
7143
+ }
7144
+ }
7145
+ void VoiceAssistantWakeWord::encode(ProtoWriteBuffer buffer) const {
7146
+ buffer.encode_string(1, this->id);
7147
+ buffer.encode_string(2, this->wake_word);
7148
+ for (auto &it : this->trained_languages) {
7149
+ buffer.encode_string(3, it, true);
7150
+ }
7151
+ }
7152
+ #ifdef HAS_PROTO_MESSAGE_DUMP
7153
+ void VoiceAssistantWakeWord::dump_to(std::string &out) const {
7154
+ __attribute__((unused)) char buffer[64];
7155
+ out.append("VoiceAssistantWakeWord {\n");
7156
+ out.append(" id: ");
7157
+ out.append("'").append(this->id).append("'");
7158
+ out.append("\n");
7159
+
7160
+ out.append(" wake_word: ");
7161
+ out.append("'").append(this->wake_word).append("'");
7162
+ out.append("\n");
7163
+
7164
+ for (const auto &it : this->trained_languages) {
7165
+ out.append(" trained_languages: ");
7166
+ out.append("'").append(it).append("'");
7167
+ out.append("\n");
7168
+ }
7169
+ out.append("}");
7170
+ }
7171
+ #endif
7172
+ void VoiceAssistantConfigurationRequest::encode(ProtoWriteBuffer buffer) const {}
7173
+ #ifdef HAS_PROTO_MESSAGE_DUMP
7174
+ void VoiceAssistantConfigurationRequest::dump_to(std::string &out) const {
7175
+ out.append("VoiceAssistantConfigurationRequest {}");
7176
+ }
7177
+ #endif
7178
+ bool VoiceAssistantConfigurationResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
7179
+ switch (field_id) {
7180
+ case 3: {
7181
+ this->max_active_wake_words = value.as_uint32();
7182
+ return true;
7183
+ }
7184
+ default:
7185
+ return false;
7186
+ }
7187
+ }
7188
+ bool VoiceAssistantConfigurationResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
7189
+ switch (field_id) {
7190
+ case 1: {
7191
+ this->available_wake_words.push_back(value.as_message<VoiceAssistantWakeWord>());
7192
+ return true;
7193
+ }
7194
+ case 2: {
7195
+ this->active_wake_words.push_back(value.as_string());
7196
+ return true;
7197
+ }
7198
+ default:
7199
+ return false;
7200
+ }
7201
+ }
7202
+ void VoiceAssistantConfigurationResponse::encode(ProtoWriteBuffer buffer) const {
7203
+ for (auto &it : this->available_wake_words) {
7204
+ buffer.encode_message<VoiceAssistantWakeWord>(1, it, true);
7205
+ }
7206
+ for (auto &it : this->active_wake_words) {
7207
+ buffer.encode_string(2, it, true);
7208
+ }
7209
+ buffer.encode_uint32(3, this->max_active_wake_words);
7210
+ }
7211
+ #ifdef HAS_PROTO_MESSAGE_DUMP
7212
+ void VoiceAssistantConfigurationResponse::dump_to(std::string &out) const {
7213
+ __attribute__((unused)) char buffer[64];
7214
+ out.append("VoiceAssistantConfigurationResponse {\n");
7215
+ for (const auto &it : this->available_wake_words) {
7216
+ out.append(" available_wake_words: ");
7217
+ it.dump_to(out);
7218
+ out.append("\n");
7219
+ }
7220
+
7221
+ for (const auto &it : this->active_wake_words) {
7222
+ out.append(" active_wake_words: ");
7223
+ out.append("'").append(it).append("'");
7224
+ out.append("\n");
7225
+ }
7226
+
7227
+ out.append(" max_active_wake_words: ");
7228
+ sprintf(buffer, "%" PRIu32, this->max_active_wake_words);
7229
+ out.append(buffer);
7230
+ out.append("\n");
7231
+ out.append("}");
7232
+ }
7233
+ #endif
7234
+ bool VoiceAssistantSetConfiguration::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
7235
+ switch (field_id) {
7236
+ case 1: {
7237
+ this->active_wake_words.push_back(value.as_string());
7238
+ return true;
7239
+ }
7240
+ default:
7241
+ return false;
7242
+ }
7243
+ }
7244
+ void VoiceAssistantSetConfiguration::encode(ProtoWriteBuffer buffer) const {
7245
+ for (auto &it : this->active_wake_words) {
7246
+ buffer.encode_string(1, it, true);
7247
+ }
7248
+ }
7249
+ #ifdef HAS_PROTO_MESSAGE_DUMP
7250
+ void VoiceAssistantSetConfiguration::dump_to(std::string &out) const {
7251
+ __attribute__((unused)) char buffer[64];
7252
+ out.append("VoiceAssistantSetConfiguration {\n");
7253
+ for (const auto &it : this->active_wake_words) {
7254
+ out.append(" active_wake_words: ");
7255
+ out.append("'").append(it).append("'");
7256
+ out.append("\n");
7257
+ }
7258
+ out.append("}");
7259
+ }
7260
+ #endif
6981
7261
  bool ListEntitiesAlarmControlPanelResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
6982
7262
  switch (field_id) {
6983
7263
  case 6: {
@@ -156,6 +156,10 @@ enum MediaPlayerCommand : uint32_t {
156
156
  MEDIA_PLAYER_COMMAND_MUTE = 3,
157
157
  MEDIA_PLAYER_COMMAND_UNMUTE = 4,
158
158
  };
159
+ enum MediaPlayerFormatPurpose : uint32_t {
160
+ MEDIA_PLAYER_FORMAT_PURPOSE_DEFAULT = 0,
161
+ MEDIA_PLAYER_FORMAT_PURPOSE_ANNOUNCEMENT = 1,
162
+ };
159
163
  enum BluetoothDeviceRequestType : uint32_t {
160
164
  BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT = 0,
161
165
  BLUETOOTH_DEVICE_REQUEST_TYPE_DISCONNECT = 1,
@@ -1267,6 +1271,22 @@ class ButtonCommandRequest : public ProtoMessage {
1267
1271
  protected:
1268
1272
  bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
1269
1273
  };
1274
+ class MediaPlayerSupportedFormat : public ProtoMessage {
1275
+ public:
1276
+ std::string format{};
1277
+ uint32_t sample_rate{0};
1278
+ uint32_t num_channels{0};
1279
+ enums::MediaPlayerFormatPurpose purpose{};
1280
+ uint32_t sample_bytes{0};
1281
+ void encode(ProtoWriteBuffer buffer) const override;
1282
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1283
+ void dump_to(std::string &out) const override;
1284
+ #endif
1285
+
1286
+ protected:
1287
+ bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
1288
+ bool decode_varint(uint32_t field_id, ProtoVarInt value) override;
1289
+ };
1270
1290
  class ListEntitiesMediaPlayerResponse : public ProtoMessage {
1271
1291
  public:
1272
1292
  std::string object_id{};
@@ -1277,6 +1297,7 @@ class ListEntitiesMediaPlayerResponse : public ProtoMessage {
1277
1297
  bool disabled_by_default{false};
1278
1298
  enums::EntityCategory entity_category{};
1279
1299
  bool supports_pause{false};
1300
+ std::vector<MediaPlayerSupportedFormat> supported_formats{};
1280
1301
  void encode(ProtoWriteBuffer buffer) const override;
1281
1302
  #ifdef HAS_PROTO_MESSAGE_DUMP
1282
1303
  void dump_to(std::string &out) const override;
@@ -1805,6 +1826,76 @@ class VoiceAssistantTimerEventResponse : public ProtoMessage {
1805
1826
  bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
1806
1827
  bool decode_varint(uint32_t field_id, ProtoVarInt value) override;
1807
1828
  };
1829
+ class VoiceAssistantAnnounceRequest : public ProtoMessage {
1830
+ public:
1831
+ std::string media_id{};
1832
+ std::string text{};
1833
+ void encode(ProtoWriteBuffer buffer) const override;
1834
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1835
+ void dump_to(std::string &out) const override;
1836
+ #endif
1837
+
1838
+ protected:
1839
+ bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
1840
+ };
1841
+ class VoiceAssistantAnnounceFinished : public ProtoMessage {
1842
+ public:
1843
+ bool success{false};
1844
+ void encode(ProtoWriteBuffer buffer) const override;
1845
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1846
+ void dump_to(std::string &out) const override;
1847
+ #endif
1848
+
1849
+ protected:
1850
+ bool decode_varint(uint32_t field_id, ProtoVarInt value) override;
1851
+ };
1852
+ class VoiceAssistantWakeWord : public ProtoMessage {
1853
+ public:
1854
+ std::string id{};
1855
+ std::string wake_word{};
1856
+ std::vector<std::string> trained_languages{};
1857
+ void encode(ProtoWriteBuffer buffer) const override;
1858
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1859
+ void dump_to(std::string &out) const override;
1860
+ #endif
1861
+
1862
+ protected:
1863
+ bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
1864
+ };
1865
+ class VoiceAssistantConfigurationRequest : public ProtoMessage {
1866
+ public:
1867
+ void encode(ProtoWriteBuffer buffer) const override;
1868
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1869
+ void dump_to(std::string &out) const override;
1870
+ #endif
1871
+
1872
+ protected:
1873
+ };
1874
+ class VoiceAssistantConfigurationResponse : public ProtoMessage {
1875
+ public:
1876
+ std::vector<VoiceAssistantWakeWord> available_wake_words{};
1877
+ std::vector<std::string> active_wake_words{};
1878
+ uint32_t max_active_wake_words{0};
1879
+ void encode(ProtoWriteBuffer buffer) const override;
1880
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1881
+ void dump_to(std::string &out) const override;
1882
+ #endif
1883
+
1884
+ protected:
1885
+ bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
1886
+ bool decode_varint(uint32_t field_id, ProtoVarInt value) override;
1887
+ };
1888
+ class VoiceAssistantSetConfiguration : public ProtoMessage {
1889
+ public:
1890
+ std::vector<std::string> active_wake_words{};
1891
+ void encode(ProtoWriteBuffer buffer) const override;
1892
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1893
+ void dump_to(std::string &out) const override;
1894
+ #endif
1895
+
1896
+ protected:
1897
+ bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
1898
+ };
1808
1899
  class ListEntitiesAlarmControlPanelResponse : public ProtoMessage {
1809
1900
  public:
1810
1901
  std::string object_id{};
@@ -486,6 +486,29 @@ bool APIServerConnectionBase::send_voice_assistant_audio(const VoiceAssistantAud
486
486
  #endif
487
487
  #ifdef USE_VOICE_ASSISTANT
488
488
  #endif
489
+ #ifdef USE_VOICE_ASSISTANT
490
+ #endif
491
+ #ifdef USE_VOICE_ASSISTANT
492
+ bool APIServerConnectionBase::send_voice_assistant_announce_finished(const VoiceAssistantAnnounceFinished &msg) {
493
+ #ifdef HAS_PROTO_MESSAGE_DUMP
494
+ ESP_LOGVV(TAG, "send_voice_assistant_announce_finished: %s", msg.dump().c_str());
495
+ #endif
496
+ return this->send_message_<VoiceAssistantAnnounceFinished>(msg, 120);
497
+ }
498
+ #endif
499
+ #ifdef USE_VOICE_ASSISTANT
500
+ #endif
501
+ #ifdef USE_VOICE_ASSISTANT
502
+ bool APIServerConnectionBase::send_voice_assistant_configuration_response(
503
+ const VoiceAssistantConfigurationResponse &msg) {
504
+ #ifdef HAS_PROTO_MESSAGE_DUMP
505
+ ESP_LOGVV(TAG, "send_voice_assistant_configuration_response: %s", msg.dump().c_str());
506
+ #endif
507
+ return this->send_message_<VoiceAssistantConfigurationResponse>(msg, 122);
508
+ }
509
+ #endif
510
+ #ifdef USE_VOICE_ASSISTANT
511
+ #endif
489
512
  #ifdef USE_ALARM_CONTROL_PANEL
490
513
  bool APIServerConnectionBase::send_list_entities_alarm_control_panel_response(
491
514
  const ListEntitiesAlarmControlPanelResponse &msg) {
@@ -1135,6 +1158,39 @@ bool APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
1135
1158
  ESP_LOGVV(TAG, "on_update_command_request: %s", msg.dump().c_str());
1136
1159
  #endif
1137
1160
  this->on_update_command_request(msg);
1161
+ #endif
1162
+ break;
1163
+ }
1164
+ case 119: {
1165
+ #ifdef USE_VOICE_ASSISTANT
1166
+ VoiceAssistantAnnounceRequest msg;
1167
+ msg.decode(msg_data, msg_size);
1168
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1169
+ ESP_LOGVV(TAG, "on_voice_assistant_announce_request: %s", msg.dump().c_str());
1170
+ #endif
1171
+ this->on_voice_assistant_announce_request(msg);
1172
+ #endif
1173
+ break;
1174
+ }
1175
+ case 121: {
1176
+ #ifdef USE_VOICE_ASSISTANT
1177
+ VoiceAssistantConfigurationRequest msg;
1178
+ msg.decode(msg_data, msg_size);
1179
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1180
+ ESP_LOGVV(TAG, "on_voice_assistant_configuration_request: %s", msg.dump().c_str());
1181
+ #endif
1182
+ this->on_voice_assistant_configuration_request(msg);
1183
+ #endif
1184
+ break;
1185
+ }
1186
+ case 123: {
1187
+ #ifdef USE_VOICE_ASSISTANT
1188
+ VoiceAssistantSetConfiguration msg;
1189
+ msg.decode(msg_data, msg_size);
1190
+ #ifdef HAS_PROTO_MESSAGE_DUMP
1191
+ ESP_LOGVV(TAG, "on_voice_assistant_set_configuration: %s", msg.dump().c_str());
1192
+ #endif
1193
+ this->on_voice_assistant_set_configuration(msg);
1138
1194
  #endif
1139
1195
  break;
1140
1196
  }
@@ -1625,6 +1681,35 @@ void APIServerConnection::on_subscribe_voice_assistant_request(const SubscribeVo
1625
1681
  this->subscribe_voice_assistant(msg);
1626
1682
  }
1627
1683
  #endif
1684
+ #ifdef USE_VOICE_ASSISTANT
1685
+ void APIServerConnection::on_voice_assistant_configuration_request(const VoiceAssistantConfigurationRequest &msg) {
1686
+ if (!this->is_connection_setup()) {
1687
+ this->on_no_setup_connection();
1688
+ return;
1689
+ }
1690
+ if (!this->is_authenticated()) {
1691
+ this->on_unauthenticated_access();
1692
+ return;
1693
+ }
1694
+ VoiceAssistantConfigurationResponse ret = this->voice_assistant_get_configuration(msg);
1695
+ if (!this->send_voice_assistant_configuration_response(ret)) {
1696
+ this->on_fatal_error();
1697
+ }
1698
+ }
1699
+ #endif
1700
+ #ifdef USE_VOICE_ASSISTANT
1701
+ void APIServerConnection::on_voice_assistant_set_configuration(const VoiceAssistantSetConfiguration &msg) {
1702
+ if (!this->is_connection_setup()) {
1703
+ this->on_no_setup_connection();
1704
+ return;
1705
+ }
1706
+ if (!this->is_authenticated()) {
1707
+ this->on_unauthenticated_access();
1708
+ return;
1709
+ }
1710
+ this->voice_assistant_set_configuration(msg);
1711
+ }
1712
+ #endif
1628
1713
  #ifdef USE_ALARM_CONTROL_PANEL
1629
1714
  void APIServerConnection::on_alarm_control_panel_command_request(const AlarmControlPanelCommandRequest &msg) {
1630
1715
  if (!this->is_connection_setup()) {
@@ -247,6 +247,21 @@ class APIServerConnectionBase : public ProtoService {
247
247
  #ifdef USE_VOICE_ASSISTANT
248
248
  virtual void on_voice_assistant_timer_event_response(const VoiceAssistantTimerEventResponse &value){};
249
249
  #endif
250
+ #ifdef USE_VOICE_ASSISTANT
251
+ virtual void on_voice_assistant_announce_request(const VoiceAssistantAnnounceRequest &value){};
252
+ #endif
253
+ #ifdef USE_VOICE_ASSISTANT
254
+ bool send_voice_assistant_announce_finished(const VoiceAssistantAnnounceFinished &msg);
255
+ #endif
256
+ #ifdef USE_VOICE_ASSISTANT
257
+ virtual void on_voice_assistant_configuration_request(const VoiceAssistantConfigurationRequest &value){};
258
+ #endif
259
+ #ifdef USE_VOICE_ASSISTANT
260
+ bool send_voice_assistant_configuration_response(const VoiceAssistantConfigurationResponse &msg);
261
+ #endif
262
+ #ifdef USE_VOICE_ASSISTANT
263
+ virtual void on_voice_assistant_set_configuration(const VoiceAssistantSetConfiguration &value){};
264
+ #endif
250
265
  #ifdef USE_ALARM_CONTROL_PANEL
251
266
  bool send_list_entities_alarm_control_panel_response(const ListEntitiesAlarmControlPanelResponse &msg);
252
267
  #endif
@@ -419,6 +434,13 @@ class APIServerConnection : public APIServerConnectionBase {
419
434
  #ifdef USE_VOICE_ASSISTANT
420
435
  virtual void subscribe_voice_assistant(const SubscribeVoiceAssistantRequest &msg) = 0;
421
436
  #endif
437
+ #ifdef USE_VOICE_ASSISTANT
438
+ virtual VoiceAssistantConfigurationResponse voice_assistant_get_configuration(
439
+ const VoiceAssistantConfigurationRequest &msg) = 0;
440
+ #endif
441
+ #ifdef USE_VOICE_ASSISTANT
442
+ virtual void voice_assistant_set_configuration(const VoiceAssistantSetConfiguration &msg) = 0;
443
+ #endif
422
444
  #ifdef USE_ALARM_CONTROL_PANEL
423
445
  virtual void alarm_control_panel_command(const AlarmControlPanelCommandRequest &msg) = 0;
424
446
  #endif
@@ -520,6 +542,12 @@ class APIServerConnection : public APIServerConnectionBase {
520
542
  #ifdef USE_VOICE_ASSISTANT
521
543
  void on_subscribe_voice_assistant_request(const SubscribeVoiceAssistantRequest &msg) override;
522
544
  #endif
545
+ #ifdef USE_VOICE_ASSISTANT
546
+ void on_voice_assistant_configuration_request(const VoiceAssistantConfigurationRequest &msg) override;
547
+ #endif
548
+ #ifdef USE_VOICE_ASSISTANT
549
+ void on_voice_assistant_set_configuration(const VoiceAssistantSetConfiguration &msg) override;
550
+ #endif
523
551
  #ifdef USE_ALARM_CONTROL_PANEL
524
552
  void on_alarm_control_panel_command_request(const AlarmControlPanelCommandRequest &msg) override;
525
553
  #endif