esphome 2024.12.4__py3-none-any.whl → 2025.2.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 (355) hide show
  1. esphome/__main__.py +16 -3
  2. esphome/components/adc/__init__.py +17 -11
  3. esphome/components/adc/adc_sensor.h +17 -0
  4. esphome/components/adc/adc_sensor_common.cpp +55 -0
  5. esphome/components/adc/adc_sensor_esp32.cpp +8 -5
  6. esphome/components/adc/adc_sensor_esp8266.cpp +10 -6
  7. esphome/components/adc/adc_sensor_libretiny.cpp +11 -6
  8. esphome/components/adc/adc_sensor_rp2040.cpp +13 -10
  9. esphome/components/adc/sensor.py +9 -3
  10. esphome/components/ads1115/ads1115.cpp +56 -7
  11. esphome/components/ads1115/ads1115.h +13 -1
  12. esphome/components/ads1115/sensor/__init__.py +16 -0
  13. esphome/components/ads1115/sensor/ads1115_sensor.cpp +2 -1
  14. esphome/components/ads1115/sensor/ads1115_sensor.h +2 -0
  15. esphome/components/animation/__init__.py +23 -261
  16. esphome/components/animation/animation.cpp +2 -2
  17. esphome/components/animation/animation.h +2 -1
  18. esphome/components/api/api_pb2.cpp +14 -0
  19. esphome/components/api/api_pb2.h +1 -0
  20. esphome/components/audio/__init__.py +112 -0
  21. esphome/components/audio/audio.cpp +67 -0
  22. esphome/components/audio/audio.h +125 -7
  23. esphome/components/audio/audio_decoder.cpp +361 -0
  24. esphome/components/audio/audio_decoder.h +135 -0
  25. esphome/components/audio/audio_reader.cpp +308 -0
  26. esphome/components/audio/audio_reader.h +85 -0
  27. esphome/components/audio/audio_resampler.cpp +159 -0
  28. esphome/components/audio/audio_resampler.h +101 -0
  29. esphome/components/audio/audio_transfer_buffer.cpp +165 -0
  30. esphome/components/audio/audio_transfer_buffer.h +139 -0
  31. esphome/components/audio_adc/__init__.py +41 -0
  32. esphome/components/audio_adc/audio_adc.h +17 -0
  33. esphome/components/audio_adc/automation.h +23 -0
  34. esphome/components/bk72xx/__init__.py +1 -0
  35. esphome/components/ble_client/ble_client.cpp +1 -2
  36. esphome/components/ble_client/sensor/__init__.py +1 -1
  37. esphome/components/ble_client/text_sensor/__init__.py +1 -1
  38. esphome/components/bluetooth_proxy/bluetooth_connection.cpp +5 -0
  39. esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -0
  40. esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
  41. esphome/components/ch422g/ch422g.h +2 -0
  42. esphome/components/climate/__init__.py +1 -1
  43. esphome/components/climate_ir/climate_ir.cpp +2 -1
  44. esphome/components/coolix/coolix.cpp +2 -1
  45. esphome/components/custom/__init__.py +0 -3
  46. esphome/components/custom/binary_sensor/__init__.py +2 -28
  47. esphome/components/custom/climate/__init__.py +2 -27
  48. esphome/components/custom/cover/__init__.py +2 -27
  49. esphome/components/custom/light/__init__.py +2 -27
  50. esphome/components/custom/output/__init__.py +2 -58
  51. esphome/components/custom/sensor/__init__.py +2 -24
  52. esphome/components/custom/switch/__init__.py +2 -24
  53. esphome/components/custom/text_sensor/__init__.py +2 -29
  54. esphome/components/custom_component/__init__.py +3 -27
  55. esphome/components/daly_bms/daly_bms.cpp +6 -0
  56. esphome/components/daly_bms/daly_bms.h +2 -0
  57. esphome/components/daly_bms/sensor.py +6 -0
  58. esphome/components/debug/debug_component.cpp +4 -0
  59. esphome/components/debug/debug_component.h +14 -0
  60. esphome/components/debug/debug_esp32.cpp +154 -74
  61. esphome/components/dfplayer/dfplayer.cpp +15 -2
  62. esphome/components/dfrobot_sen0395/dfrobot_sen0395.cpp +2 -1
  63. esphome/components/dht/dht.cpp +2 -1
  64. esphome/components/display/__init__.py +18 -5
  65. esphome/components/display/display.cpp +2 -1
  66. esphome/components/display/rect.cpp +2 -1
  67. esphome/components/es7210/__init__.py +0 -0
  68. esphome/components/es7210/audio_adc.py +51 -0
  69. esphome/components/es7210/es7210.cpp +228 -0
  70. esphome/components/es7210/es7210.h +62 -0
  71. esphome/components/es7210/es7210_const.h +129 -0
  72. esphome/components/es7243e/__init__.py +0 -0
  73. esphome/components/es7243e/audio_adc.py +34 -0
  74. esphome/components/es7243e/es7243e.cpp +125 -0
  75. esphome/components/es7243e/es7243e.h +37 -0
  76. esphome/components/es7243e/es7243e_const.h +54 -0
  77. esphome/components/es8156/__init__.py +0 -0
  78. esphome/components/es8156/audio_dac.py +27 -0
  79. esphome/components/es8156/es8156.cpp +87 -0
  80. esphome/components/es8156/es8156.h +51 -0
  81. esphome/components/es8156/es8156_const.h +68 -0
  82. esphome/components/es8311/audio_dac.py +1 -2
  83. esphome/components/esp32/__init__.py +1 -0
  84. esphome/components/esp32/core.cpp +5 -1
  85. esphome/components/esp32/gpio.h +2 -0
  86. esphome/components/esp32_ble/__init__.py +39 -0
  87. esphome/components/esp32_ble/queue.h +4 -4
  88. esphome/components/esp32_ble_client/ble_client_base.cpp +46 -0
  89. esphome/components/esp32_ble_client/ble_client_base.h +2 -0
  90. esphome/components/esp32_ble_server/__init__.py +582 -12
  91. esphome/components/esp32_ble_server/ble_characteristic.cpp +48 -60
  92. esphome/components/esp32_ble_server/ble_characteristic.h +24 -17
  93. esphome/components/esp32_ble_server/ble_descriptor.cpp +21 -9
  94. esphome/components/esp32_ble_server/ble_descriptor.h +17 -6
  95. esphome/components/esp32_ble_server/ble_server.cpp +62 -67
  96. esphome/components/esp32_ble_server/ble_server.h +28 -32
  97. esphome/components/esp32_ble_server/ble_server_automations.cpp +77 -0
  98. esphome/components/esp32_ble_server/ble_server_automations.h +115 -0
  99. esphome/components/esp32_ble_server/ble_service.cpp +17 -15
  100. esphome/components/esp32_ble_server/ble_service.h +10 -14
  101. esphome/components/esp32_ble_tracker/__init__.py +6 -39
  102. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +33 -10
  103. esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +8 -4
  104. esphome/components/esp32_improv/__init__.py +2 -8
  105. esphome/components/esp32_improv/esp32_improv_component.cpp +21 -20
  106. esphome/components/esp32_improv/esp32_improv_component.h +3 -4
  107. esphome/components/esp32_rmt/__init__.py +28 -3
  108. esphome/components/esp32_rmt_led_strip/led_strip.cpp +73 -6
  109. esphome/components/esp32_rmt_led_strip/led_strip.h +21 -3
  110. esphome/components/esp32_rmt_led_strip/light.py +72 -7
  111. esphome/components/esp32_touch/esp32_touch.cpp +5 -0
  112. esphome/components/esp8266/__init__.py +1 -0
  113. esphome/components/esp8266/gpio.h +1 -0
  114. esphome/components/ethernet/__init__.py +10 -10
  115. esphome/components/event/event.cpp +4 -2
  116. esphome/components/event/event.h +2 -0
  117. esphome/components/event_emitter/__init__.py +5 -0
  118. esphome/components/event_emitter/event_emitter.cpp +14 -0
  119. esphome/components/event_emitter/event_emitter.h +63 -0
  120. esphome/components/gcja5/gcja5.cpp +2 -1
  121. esphome/components/haier/haier_base.cpp +2 -1
  122. esphome/components/haier/hon_climate.cpp +2 -1
  123. esphome/components/heatpumpir/heatpumpir.cpp +2 -1
  124. esphome/components/host/__init__.py +1 -0
  125. esphome/components/host/gpio.h +1 -0
  126. esphome/components/http_request/http_request.h +2 -2
  127. esphome/components/http_request/http_request_arduino.cpp +1 -1
  128. esphome/components/http_request/http_request_idf.cpp +1 -1
  129. esphome/components/i2c/i2c_bus_esp_idf.cpp +4 -0
  130. esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +7 -5
  131. esphome/components/i2s_audio/speaker/__init__.py +53 -6
  132. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +92 -46
  133. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -0
  134. esphome/components/ili9xxx/display.py +29 -11
  135. esphome/components/ili9xxx/ili9xxx_display.cpp +2 -5
  136. esphome/components/ili9xxx/ili9xxx_display.h +2 -1
  137. esphome/components/image/__init__.py +443 -255
  138. esphome/components/image/image.cpp +115 -61
  139. esphome/components/image/image.h +15 -24
  140. esphome/components/json/json_util.cpp +8 -34
  141. esphome/components/libretiny/__init__.py +1 -0
  142. esphome/components/libretiny/gpio_arduino.h +1 -0
  143. esphome/components/light/light_color_values.h +1 -1
  144. esphome/components/logger/__init__.py +43 -7
  145. esphome/components/logger/logger.cpp +16 -11
  146. esphome/components/logger/logger.h +11 -7
  147. esphome/components/logger/select/__init__.py +29 -0
  148. esphome/components/logger/select/logger_level_select.cpp +27 -0
  149. esphome/components/logger/select/logger_level_select.h +15 -0
  150. esphome/components/lvgl/__init__.py +96 -73
  151. esphome/components/lvgl/automation.py +39 -7
  152. esphome/components/lvgl/defines.py +8 -2
  153. esphome/components/lvgl/lvgl_esphome.cpp +8 -15
  154. esphome/components/lvgl/lvgl_esphome.h +20 -5
  155. esphome/components/lvgl/schemas.py +25 -14
  156. esphome/components/lvgl/trigger.py +27 -3
  157. esphome/components/lvgl/widgets/dropdown.py +1 -1
  158. esphome/components/lvgl/widgets/keyboard.py +8 -1
  159. esphome/components/lvgl/widgets/meter.py +2 -1
  160. esphome/components/lvgl/widgets/msgbox.py +1 -1
  161. esphome/components/lvgl/widgets/obj.py +1 -12
  162. esphome/components/lvgl/widgets/page.py +37 -2
  163. esphome/components/lvgl/widgets/tabview.py +1 -1
  164. esphome/components/max6956/max6956.h +2 -0
  165. esphome/components/mcp23016/mcp23016.h +2 -0
  166. esphome/components/mcp23xxx_base/mcp23xxx_base.h +2 -0
  167. esphome/components/mdns/__init__.py +1 -1
  168. esphome/components/media_player/__init__.py +37 -8
  169. esphome/components/media_player/automation.h +11 -2
  170. esphome/components/media_player/media_player.cpp +8 -0
  171. esphome/components/media_player/media_player.h +8 -4
  172. esphome/components/micronova/switch/micronova_switch.cpp +4 -2
  173. esphome/components/midea/ac_automations.h +3 -1
  174. esphome/components/midea/air_conditioner.cpp +7 -5
  175. esphome/components/midea/air_conditioner.h +1 -1
  176. esphome/components/midea/climate.py +4 -2
  177. esphome/components/midea/ir_transmitter.h +36 -5
  178. esphome/components/mixer/__init__.py +0 -0
  179. esphome/components/mixer/speaker/__init__.py +172 -0
  180. esphome/components/mixer/speaker/automation.h +19 -0
  181. esphome/components/mixer/speaker/mixer_speaker.cpp +624 -0
  182. esphome/components/mixer/speaker/mixer_speaker.h +207 -0
  183. esphome/components/mpr121/mpr121.h +2 -0
  184. esphome/components/mqtt/__init__.py +1 -1
  185. esphome/components/mqtt/mqtt_client.cpp +7 -1
  186. esphome/components/mqtt/mqtt_client.h +1 -1
  187. esphome/components/mqtt/mqtt_climate.cpp +2 -2
  188. esphome/components/network/ip_address.h +2 -0
  189. esphome/components/nextion/automation.h +17 -0
  190. esphome/components/nextion/display.py +42 -17
  191. esphome/components/nextion/nextion.cpp +4 -10
  192. esphome/components/nextion/nextion.h +89 -82
  193. esphome/components/nextion/nextion_commands.cpp +10 -10
  194. esphome/components/ntc/sensor.py +2 -4
  195. esphome/components/online_image/__init__.py +98 -46
  196. esphome/components/online_image/bmp_image.cpp +101 -0
  197. esphome/components/online_image/bmp_image.h +40 -0
  198. esphome/components/online_image/image_decoder.cpp +28 -2
  199. esphome/components/online_image/image_decoder.h +24 -15
  200. esphome/components/online_image/jpeg_image.cpp +90 -0
  201. esphome/components/online_image/jpeg_image.h +34 -0
  202. esphome/components/online_image/online_image.cpp +112 -53
  203. esphome/components/online_image/online_image.h +24 -7
  204. esphome/components/online_image/png_image.cpp +7 -3
  205. esphome/components/online_image/png_image.h +2 -1
  206. esphome/components/opentherm/__init__.py +73 -7
  207. esphome/components/opentherm/automation.h +25 -0
  208. esphome/components/opentherm/const.py +1 -0
  209. esphome/components/opentherm/generate.py +39 -6
  210. esphome/components/opentherm/hub.cpp +117 -79
  211. esphome/components/opentherm/hub.h +31 -15
  212. esphome/components/opentherm/opentherm.cpp +47 -23
  213. esphome/components/opentherm/opentherm.h +27 -6
  214. esphome/components/opentherm/opentherm_macros.h +11 -0
  215. esphome/components/opentherm/schema.py +78 -1
  216. esphome/components/opentherm/validate.py +7 -2
  217. esphome/components/pca6416a/pca6416a.h +2 -0
  218. esphome/components/pca9554/pca9554.h +2 -0
  219. esphome/components/pcf8574/pcf8574.h +2 -0
  220. esphome/components/preferences/__init__.py +2 -4
  221. esphome/components/preferences/syncer.h +10 -3
  222. esphome/components/prometheus/prometheus_handler.cpp +313 -0
  223. esphome/components/prometheus/prometheus_handler.h +48 -7
  224. esphome/components/psram/psram.cpp +8 -1
  225. esphome/components/pulse_counter/pulse_counter_sensor.cpp +14 -9
  226. esphome/components/pulse_counter/pulse_counter_sensor.h +4 -4
  227. esphome/components/pulse_meter/pulse_meter_sensor.cpp +2 -0
  228. esphome/components/qspi_dbi/__init__.py +3 -0
  229. esphome/components/qspi_dbi/display.py +74 -47
  230. esphome/components/qspi_dbi/models.py +245 -2
  231. esphome/components/qspi_dbi/qspi_dbi.cpp +9 -16
  232. esphome/components/qspi_dbi/qspi_dbi.h +2 -2
  233. esphome/components/remote_base/__init__.py +77 -25
  234. esphome/components/remote_base/remote_base.cpp +1 -1
  235. esphome/components/remote_base/remote_base.h +20 -2
  236. esphome/components/remote_base/toto_protocol.cpp +100 -0
  237. esphome/components/remote_base/toto_protocol.h +45 -0
  238. esphome/components/remote_receiver/__init__.py +55 -10
  239. esphome/components/remote_receiver/remote_receiver.h +36 -3
  240. esphome/components/remote_receiver/remote_receiver_esp32.cpp +145 -6
  241. esphome/components/remote_transmitter/__init__.py +62 -4
  242. esphome/components/remote_transmitter/remote_transmitter.h +21 -2
  243. esphome/components/remote_transmitter/remote_transmitter_esp32.cpp +140 -4
  244. esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +3 -3
  245. esphome/components/remote_transmitter/remote_transmitter_libretiny.cpp +3 -3
  246. esphome/components/resampler/__init__.py +0 -0
  247. esphome/components/resampler/speaker/__init__.py +103 -0
  248. esphome/components/resampler/speaker/resampler_speaker.cpp +318 -0
  249. esphome/components/resampler/speaker/resampler_speaker.h +107 -0
  250. esphome/components/resistance/resistance_sensor.h +2 -3
  251. esphome/components/resistance/sensor.py +2 -9
  252. esphome/components/rotary_encoder/rotary_encoder.cpp +8 -4
  253. esphome/components/rp2040/__init__.py +1 -0
  254. esphome/components/rp2040/gpio.h +1 -0
  255. esphome/components/rtl87xx/__init__.py +2 -0
  256. esphome/components/sdl/binary_sensor.py +270 -0
  257. esphome/components/sdl/sdl_esphome.cpp +16 -0
  258. esphome/components/sdl/sdl_esphome.h +9 -0
  259. esphome/components/seeed_mr60bha2/binary_sensor.py +25 -0
  260. esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +26 -2
  261. esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +9 -20
  262. esphome/components/seeed_mr60bha2/sensor.py +9 -1
  263. esphome/components/sn74hc165/sn74hc165.h +3 -0
  264. esphome/components/sn74hc595/sn74hc595.h +3 -0
  265. esphome/components/speaker/__init__.py +5 -4
  266. esphome/components/speaker/media_player/__init__.py +458 -0
  267. esphome/components/speaker/media_player/audio_pipeline.cpp +568 -0
  268. esphome/components/speaker/media_player/audio_pipeline.h +159 -0
  269. esphome/components/speaker/media_player/automation.h +26 -0
  270. esphome/components/speaker/media_player/speaker_media_player.cpp +577 -0
  271. esphome/components/speaker/media_player/speaker_media_player.h +160 -0
  272. esphome/components/speaker/speaker.h +20 -0
  273. esphome/components/spi/__init__.py +1 -5
  274. esphome/components/spi/spi.cpp +7 -1
  275. esphome/components/spi/spi.h +21 -2
  276. esphome/components/spi_led_strip/light.py +3 -5
  277. esphome/components/spi_led_strip/spi_led_strip.cpp +67 -0
  278. esphome/components/spi_led_strip/spi_led_strip.h +8 -60
  279. esphome/components/sprinkler/sprinkler.cpp +3 -1
  280. esphome/components/sx1509/sx1509_gpio_pin.h +2 -0
  281. esphome/components/tca9555/tca9555.h +2 -0
  282. esphome/components/toshiba/toshiba.cpp +2 -1
  283. esphome/components/tuya/light/tuya_light.cpp +4 -2
  284. esphome/components/uart/uart_component_esp32_arduino.cpp +2 -2
  285. esphome/components/uart/uart_component_esp_idf.cpp +2 -2
  286. esphome/components/udp/__init__.py +8 -2
  287. esphome/components/udp/udp_component.cpp +25 -56
  288. esphome/components/udp/udp_component.h +3 -0
  289. esphome/components/uponor_smatrix/sensor/__init__.py +14 -4
  290. esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.cpp +5 -0
  291. esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.h +1 -0
  292. esphome/components/uptime/text_sensor/__init__.py +19 -0
  293. esphome/components/uptime/text_sensor/uptime_text_sensor.cpp +63 -0
  294. esphome/components/uptime/text_sensor/uptime_text_sensor.h +25 -0
  295. esphome/components/voice_assistant/voice_assistant.cpp +24 -14
  296. esphome/components/voice_assistant/voice_assistant.h +8 -0
  297. esphome/components/waveshare_epaper/display.py +22 -1
  298. esphome/components/waveshare_epaper/waveshare_213v3.cpp +9 -3
  299. esphome/components/waveshare_epaper/waveshare_epaper.cpp +1155 -44
  300. esphome/components/waveshare_epaper/waveshare_epaper.h +208 -7
  301. esphome/components/web_server/web_server.cpp +28 -6
  302. esphome/components/weikai/weikai.h +2 -0
  303. esphome/components/wifi/__init__.py +6 -6
  304. esphome/components/wifi/wifi_component.cpp +1 -1
  305. esphome/components/wifi/wifi_component_esp32_arduino.cpp +30 -1
  306. esphome/components/wireguard/__init__.py +2 -2
  307. esphome/components/xl9535/xl9535.h +2 -0
  308. esphome/components/xxtea/__init__.py +3 -0
  309. esphome/components/xxtea/xxtea.cpp +46 -0
  310. esphome/components/xxtea/xxtea.h +26 -0
  311. esphome/components/yashima/yashima.cpp +2 -1
  312. esphome/config.py +9 -5
  313. esphome/config_validation.py +55 -17
  314. esphome/const.py +7 -10
  315. esphome/core/__init__.py +6 -13
  316. esphome/core/base_automation.h +1 -0
  317. esphome/core/config.py +57 -72
  318. esphome/core/defines.h +9 -1
  319. esphome/core/gpio.h +7 -0
  320. esphome/core/helpers.cpp +19 -15
  321. esphome/core/helpers.h +57 -8
  322. esphome/core/log.h +9 -7
  323. esphome/cpp_generator.py +2 -2
  324. esphome/espota2.py +3 -2
  325. esphome/loader.py +12 -4
  326. esphome/log.py +5 -7
  327. esphome/yaml_util.py +2 -2
  328. {esphome-2024.12.4.dist-info → esphome-2025.2.0b1.dist-info}/METADATA +12 -7
  329. {esphome-2024.12.4.dist-info → esphome-2025.2.0b1.dist-info}/RECORD +338 -289
  330. esphome/components/custom/binary_sensor/custom_binary_sensor.cpp +0 -16
  331. esphome/components/custom/binary_sensor/custom_binary_sensor.h +0 -26
  332. esphome/components/custom/climate/custom_climate.h +0 -22
  333. esphome/components/custom/cover/custom_cover.h +0 -21
  334. esphome/components/custom/light/custom_light_output.h +0 -24
  335. esphome/components/custom/output/custom_output.h +0 -37
  336. esphome/components/custom/sensor/custom_sensor.cpp +0 -16
  337. esphome/components/custom/sensor/custom_sensor.h +0 -24
  338. esphome/components/custom/switch/custom_switch.cpp +0 -16
  339. esphome/components/custom/switch/custom_switch.h +0 -24
  340. esphome/components/custom/text_sensor/custom_text_sensor.cpp +0 -16
  341. esphome/components/custom/text_sensor/custom_text_sensor.h +0 -26
  342. esphome/components/custom_component/custom_component.h +0 -28
  343. esphome/components/esp32_ble_server/ble_2901.cpp +0 -18
  344. esphome/components/esp32_ble_server/ble_2901.h +0 -19
  345. esphome/components/resistance_sampler/__init__.py +0 -6
  346. esphome/components/resistance_sampler/resistance_sampler.h +0 -10
  347. esphome/components/uptime/{sensor.py → sensor/__init__.py} +3 -3
  348. /esphome/components/uptime/{uptime_seconds_sensor.cpp → sensor/uptime_seconds_sensor.cpp} +0 -0
  349. /esphome/components/uptime/{uptime_seconds_sensor.h → sensor/uptime_seconds_sensor.h} +0 -0
  350. /esphome/components/uptime/{uptime_timestamp_sensor.cpp → sensor/uptime_timestamp_sensor.cpp} +0 -0
  351. /esphome/components/uptime/{uptime_timestamp_sensor.h → sensor/uptime_timestamp_sensor.h} +0 -0
  352. {esphome-2024.12.4.dist-info → esphome-2025.2.0b1.dist-info}/LICENSE +0 -0
  353. {esphome-2024.12.4.dist-info → esphome-2025.2.0b1.dist-info}/WHEEL +0 -0
  354. {esphome-2024.12.4.dist-info → esphome-2025.2.0b1.dist-info}/entry_points.txt +0 -0
  355. {esphome-2024.12.4.dist-info → esphome-2025.2.0b1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,165 @@
1
+ #include "audio_transfer_buffer.h"
2
+
3
+ #ifdef USE_ESP32
4
+
5
+ #include "esphome/core/helpers.h"
6
+
7
+ namespace esphome {
8
+ namespace audio {
9
+
10
+ AudioTransferBuffer::~AudioTransferBuffer() { this->deallocate_buffer_(); };
11
+
12
+ std::unique_ptr<AudioSinkTransferBuffer> AudioSinkTransferBuffer::create(size_t buffer_size) {
13
+ std::unique_ptr<AudioSinkTransferBuffer> sink_buffer = make_unique<AudioSinkTransferBuffer>();
14
+
15
+ if (!sink_buffer->allocate_buffer_(buffer_size)) {
16
+ return nullptr;
17
+ }
18
+
19
+ return sink_buffer;
20
+ }
21
+
22
+ std::unique_ptr<AudioSourceTransferBuffer> AudioSourceTransferBuffer::create(size_t buffer_size) {
23
+ std::unique_ptr<AudioSourceTransferBuffer> source_buffer = make_unique<AudioSourceTransferBuffer>();
24
+
25
+ if (!source_buffer->allocate_buffer_(buffer_size)) {
26
+ return nullptr;
27
+ }
28
+
29
+ return source_buffer;
30
+ }
31
+
32
+ size_t AudioTransferBuffer::free() const {
33
+ if (this->buffer_size_ == 0) {
34
+ return 0;
35
+ }
36
+ return this->buffer_size_ - (this->buffer_length_ - (this->data_start_ - this->buffer_));
37
+ }
38
+
39
+ void AudioTransferBuffer::decrease_buffer_length(size_t bytes) {
40
+ this->buffer_length_ -= bytes;
41
+ this->data_start_ += bytes;
42
+ }
43
+
44
+ void AudioTransferBuffer::increase_buffer_length(size_t bytes) { this->buffer_length_ += bytes; }
45
+
46
+ void AudioTransferBuffer::clear_buffered_data() {
47
+ this->buffer_length_ = 0;
48
+ if (this->ring_buffer_.use_count() > 0) {
49
+ this->ring_buffer_->reset();
50
+ }
51
+ }
52
+
53
+ void AudioSinkTransferBuffer::clear_buffered_data() {
54
+ this->buffer_length_ = 0;
55
+ if (this->ring_buffer_.use_count() > 0) {
56
+ this->ring_buffer_->reset();
57
+ }
58
+ #ifdef USE_SPEAKER
59
+ if (this->speaker_ != nullptr) {
60
+ this->speaker_->stop();
61
+ }
62
+ #endif
63
+ }
64
+
65
+ bool AudioTransferBuffer::has_buffered_data() const {
66
+ if (this->ring_buffer_.use_count() > 0) {
67
+ return ((this->ring_buffer_->available() > 0) || (this->available() > 0));
68
+ }
69
+ return (this->available() > 0);
70
+ }
71
+
72
+ bool AudioTransferBuffer::reallocate(size_t new_buffer_size) {
73
+ if (this->buffer_length_ > 0) {
74
+ // Already has data in the buffer, fail
75
+ return false;
76
+ }
77
+ this->deallocate_buffer_();
78
+ return this->allocate_buffer_(new_buffer_size);
79
+ }
80
+
81
+ bool AudioTransferBuffer::allocate_buffer_(size_t buffer_size) {
82
+ this->buffer_size_ = buffer_size;
83
+
84
+ RAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
85
+
86
+ this->buffer_ = allocator.allocate(this->buffer_size_);
87
+ if (this->buffer_ == nullptr) {
88
+ return false;
89
+ }
90
+
91
+ this->data_start_ = this->buffer_;
92
+ this->buffer_length_ = 0;
93
+
94
+ return true;
95
+ }
96
+
97
+ void AudioTransferBuffer::deallocate_buffer_() {
98
+ if (this->buffer_ != nullptr) {
99
+ RAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
100
+ allocator.deallocate(this->buffer_, this->buffer_size_);
101
+ this->buffer_ = nullptr;
102
+ this->data_start_ = nullptr;
103
+ }
104
+
105
+ this->buffer_size_ = 0;
106
+ this->buffer_length_ = 0;
107
+ }
108
+
109
+ size_t AudioSourceTransferBuffer::transfer_data_from_source(TickType_t ticks_to_wait) {
110
+ // Shift data in buffer to start
111
+ if (this->buffer_length_ > 0) {
112
+ memmove(this->buffer_, this->data_start_, this->buffer_length_);
113
+ }
114
+ this->data_start_ = this->buffer_;
115
+
116
+ size_t bytes_to_read = this->free();
117
+ size_t bytes_read = 0;
118
+ if (bytes_to_read > 0) {
119
+ if (this->ring_buffer_.use_count() > 0) {
120
+ bytes_read = this->ring_buffer_->read((void *) this->get_buffer_end(), bytes_to_read, ticks_to_wait);
121
+ }
122
+
123
+ this->increase_buffer_length(bytes_read);
124
+ }
125
+ return bytes_read;
126
+ }
127
+
128
+ size_t AudioSinkTransferBuffer::transfer_data_to_sink(TickType_t ticks_to_wait) {
129
+ size_t bytes_written = 0;
130
+ if (this->available()) {
131
+ #ifdef USE_SPEAKER
132
+ if (this->speaker_ != nullptr) {
133
+ bytes_written = this->speaker_->play(this->data_start_, this->available(), ticks_to_wait);
134
+ } else
135
+ #endif
136
+ if (this->ring_buffer_.use_count() > 0) {
137
+ bytes_written =
138
+ this->ring_buffer_->write_without_replacement((void *) this->data_start_, this->available(), ticks_to_wait);
139
+ }
140
+
141
+ this->decrease_buffer_length(bytes_written);
142
+
143
+ // Shift unwritten data to the start of the buffer
144
+ memmove(this->buffer_, this->data_start_, this->buffer_length_);
145
+ this->data_start_ = this->buffer_;
146
+ }
147
+ return bytes_written;
148
+ }
149
+
150
+ bool AudioSinkTransferBuffer::has_buffered_data() const {
151
+ #ifdef USE_SPEAKER
152
+ if (this->speaker_ != nullptr) {
153
+ return (this->speaker_->has_buffered_data() || (this->available() > 0));
154
+ }
155
+ #endif
156
+ if (this->ring_buffer_.use_count() > 0) {
157
+ return ((this->ring_buffer_->available() > 0) || (this->available() > 0));
158
+ }
159
+ return (this->available() > 0);
160
+ }
161
+
162
+ } // namespace audio
163
+ } // namespace esphome
164
+
165
+ #endif
@@ -0,0 +1,139 @@
1
+ #pragma once
2
+
3
+ #ifdef USE_ESP32
4
+ #include "esphome/core/defines.h"
5
+ #include "esphome/core/ring_buffer.h"
6
+
7
+ #ifdef USE_SPEAKER
8
+ #include "esphome/components/speaker/speaker.h"
9
+ #endif
10
+
11
+ #include "esp_err.h"
12
+
13
+ #include <freertos/FreeRTOS.h>
14
+
15
+ namespace esphome {
16
+ namespace audio {
17
+
18
+ class AudioTransferBuffer {
19
+ /*
20
+ * @brief Class that facilitates tranferring data between a buffer and an audio source or sink.
21
+ * The transfer buffer is a typical C array that temporarily holds data for processing in other audio components.
22
+ * Both sink and source transfer buffers can use a ring buffer as the sink/source.
23
+ * - The ring buffer is stored in a shared_ptr, so destroying the transfer buffer object will release ownership.
24
+ */
25
+ public:
26
+ /// @brief Destructor that deallocates the transfer buffer
27
+ ~AudioTransferBuffer();
28
+
29
+ /// @brief Returns a pointer to the start of the transfer buffer where available() bytes of exisiting data can be read
30
+ uint8_t *get_buffer_start() const { return this->data_start_; }
31
+
32
+ /// @brief Returns a pointer to the end of the transfer buffer where free() bytes of new data can be written
33
+ uint8_t *get_buffer_end() const { return this->data_start_ + this->buffer_length_; }
34
+
35
+ /// @brief Updates the internal state of the transfer buffer. This should be called after reading data
36
+ /// @param bytes The number of bytes consumed/read
37
+ void decrease_buffer_length(size_t bytes);
38
+
39
+ /// @brief Updates the internal state of the transfer buffer. This should be called after writing data
40
+ /// @param bytes The number of bytes written
41
+ void increase_buffer_length(size_t bytes);
42
+
43
+ /// @brief Returns the transfer buffer's currently available bytes to read
44
+ size_t available() const { return this->buffer_length_; }
45
+
46
+ /// @brief Returns the transfer buffers allocated bytes
47
+ size_t capacity() const { return this->buffer_size_; }
48
+
49
+ /// @brief Returns the transfer buffer's currrently free bytes available to write
50
+ size_t free() const;
51
+
52
+ /// @brief Clears data in the transfer buffer and, if possible, the source/sink.
53
+ virtual void clear_buffered_data();
54
+
55
+ /// @brief Tests if there is any data in the tranfer buffer or the source/sink.
56
+ /// @return True if there is data, false otherwise.
57
+ virtual bool has_buffered_data() const;
58
+
59
+ bool reallocate(size_t new_buffer_size);
60
+
61
+ protected:
62
+ /// @brief Allocates the transfer buffer in external memory, if available.
63
+ /// @return True is successful, false otherwise.
64
+ bool allocate_buffer_(size_t buffer_size);
65
+
66
+ /// @brief Deallocates the buffer and resets the class variables.
67
+ void deallocate_buffer_();
68
+
69
+ // A possible source or sink for the transfer buffer
70
+ std::shared_ptr<RingBuffer> ring_buffer_;
71
+
72
+ uint8_t *buffer_{nullptr};
73
+ uint8_t *data_start_{nullptr};
74
+
75
+ size_t buffer_size_{0};
76
+ size_t buffer_length_{0};
77
+ };
78
+
79
+ class AudioSinkTransferBuffer : public AudioTransferBuffer {
80
+ /*
81
+ * @brief A class that implements a transfer buffer for audio sinks.
82
+ * Supports writing processed data in the transfer buffer to a ring buffer or a speaker component.
83
+ */
84
+ public:
85
+ /// @brief Creates a new sink transfer buffer.
86
+ /// @param buffer_size Size of the transfer buffer in bytes.
87
+ /// @return unique_ptr if successfully allocated, nullptr otherwise
88
+ static std::unique_ptr<AudioSinkTransferBuffer> create(size_t buffer_size);
89
+
90
+ /// @brief Writes any available data in the transfer buffer to the sink.
91
+ /// @param ticks_to_wait FreeRTOS ticks to block while waiting for the sink to have enough space
92
+ /// @return Number of bytes written
93
+ size_t transfer_data_to_sink(TickType_t ticks_to_wait);
94
+
95
+ /// @brief Adds a ring buffer as the transfer buffer's sink.
96
+ /// @param ring_buffer weak_ptr to the allocated ring buffer
97
+ void set_sink(const std::weak_ptr<RingBuffer> &ring_buffer) { this->ring_buffer_ = ring_buffer.lock(); }
98
+
99
+ #ifdef USE_SPEAKER
100
+ /// @brief Adds a speaker as the transfer buffer's sink.
101
+ /// @param speaker Pointer to the speaker component
102
+ void set_sink(speaker::Speaker *speaker) { this->speaker_ = speaker; }
103
+ #endif
104
+
105
+ void clear_buffered_data() override;
106
+
107
+ bool has_buffered_data() const override;
108
+
109
+ protected:
110
+ #ifdef USE_SPEAKER
111
+ speaker::Speaker *speaker_{nullptr};
112
+ #endif
113
+ };
114
+
115
+ class AudioSourceTransferBuffer : public AudioTransferBuffer {
116
+ /*
117
+ * @brief A class that implements a transfer buffer for audio sources.
118
+ * Supports reading audio data from a ring buffer into the transfer buffer for processing.
119
+ */
120
+ public:
121
+ /// @brief Creates a new source transfer buffer.
122
+ /// @param buffer_size Size of the transfer buffer in bytes.
123
+ /// @return unique_ptr if successfully allocated, nullptr otherwise
124
+ static std::unique_ptr<AudioSourceTransferBuffer> create(size_t buffer_size);
125
+
126
+ /// @brief Reads any available data from the sink into the transfer buffer.
127
+ /// @param ticks_to_wait FreeRTOS ticks to block while waiting for the source to have enough data
128
+ /// @return Number of bytes read
129
+ size_t transfer_data_from_source(TickType_t ticks_to_wait);
130
+
131
+ /// @brief Adds a ring buffer as the transfer buffer's source.
132
+ /// @param ring_buffer weak_ptr to the allocated ring buffer
133
+ void set_source(const std::weak_ptr<RingBuffer> &ring_buffer) { this->ring_buffer_ = ring_buffer.lock(); };
134
+ };
135
+
136
+ } // namespace audio
137
+ } // namespace esphome
138
+
139
+ #endif
@@ -0,0 +1,41 @@
1
+ from esphome import automation
2
+ import esphome.codegen as cg
3
+ import esphome.config_validation as cv
4
+ from esphome.const import CONF_ID, CONF_MIC_GAIN
5
+ from esphome.core import coroutine_with_priority
6
+
7
+ CODEOWNERS = ["@kbx81"]
8
+ IS_PLATFORM_COMPONENT = True
9
+
10
+ audio_adc_ns = cg.esphome_ns.namespace("audio_adc")
11
+ AudioAdc = audio_adc_ns.class_("AudioAdc")
12
+
13
+ SetMicGainAction = audio_adc_ns.class_("SetMicGainAction", automation.Action)
14
+
15
+
16
+ SET_MIC_GAIN_ACTION_SCHEMA = cv.maybe_simple_value(
17
+ {
18
+ cv.GenerateID(): cv.use_id(AudioAdc),
19
+ cv.Required(CONF_MIC_GAIN): cv.templatable(cv.decibel),
20
+ },
21
+ key=CONF_MIC_GAIN,
22
+ )
23
+
24
+
25
+ @automation.register_action(
26
+ "audio_adc.set_mic_gain", SetMicGainAction, SET_MIC_GAIN_ACTION_SCHEMA
27
+ )
28
+ async def audio_adc_set_mic_gain_to_code(config, action_id, template_arg, args):
29
+ paren = await cg.get_variable(config[CONF_ID])
30
+ var = cg.new_Pvariable(action_id, template_arg, paren)
31
+
32
+ template_ = await cg.templatable(config.get(CONF_MIC_GAIN), args, float)
33
+ cg.add(var.set_mic_gain(template_))
34
+
35
+ return var
36
+
37
+
38
+ @coroutine_with_priority(100.0)
39
+ async def to_code(config):
40
+ cg.add_define("USE_AUDIO_ADC")
41
+ cg.add_global(audio_adc_ns.using)
@@ -0,0 +1,17 @@
1
+ #pragma once
2
+
3
+ #include "esphome/core/defines.h"
4
+ #include "esphome/core/hal.h"
5
+
6
+ namespace esphome {
7
+ namespace audio_adc {
8
+
9
+ class AudioAdc {
10
+ public:
11
+ virtual bool set_mic_gain(float mic_gain) = 0;
12
+
13
+ virtual float mic_gain() = 0;
14
+ };
15
+
16
+ } // namespace audio_adc
17
+ } // namespace esphome
@@ -0,0 +1,23 @@
1
+ #pragma once
2
+
3
+ #include "esphome/core/automation.h"
4
+ #include "esphome/core/component.h"
5
+ #include "audio_adc.h"
6
+
7
+ namespace esphome {
8
+ namespace audio_adc {
9
+
10
+ template<typename... Ts> class SetMicGainAction : public Action<Ts...> {
11
+ public:
12
+ explicit SetMicGainAction(AudioAdc *audio_adc) : audio_adc_(audio_adc) {}
13
+
14
+ TEMPLATABLE_VALUE(float, mic_gain)
15
+
16
+ void play(Ts... x) override { this->audio_adc_->set_mic_gain(this->mic_gain_.value(x...)); }
17
+
18
+ protected:
19
+ AudioAdc *audio_adc_;
20
+ };
21
+
22
+ } // namespace audio_adc
23
+ } // namespace esphome
@@ -19,6 +19,7 @@ from .boards import BK72XX_BOARD_PINS, BK72XX_BOARDS
19
19
 
20
20
  CODEOWNERS = ["@kuba2k2"]
21
21
  AUTO_LOAD = ["libretiny"]
22
+ IS_TARGET_PLATFORM = True
22
23
 
23
24
  COMPONENT_DATA = LibreTinyComponent(
24
25
  name=COMPONENT_BK72XX,
@@ -25,8 +25,7 @@ void BLEClient::loop() {
25
25
 
26
26
  void BLEClient::dump_config() {
27
27
  ESP_LOGCONFIG(TAG, "BLE Client:");
28
- ESP_LOGCONFIG(TAG, " Address: %s", this->address_str().c_str());
29
- ESP_LOGCONFIG(TAG, " Auto-Connect: %s", TRUEFALSE(this->auto_connect_));
28
+ BLEClientBase::dump_config();
30
29
  }
31
30
 
32
31
  bool BLEClient::parse_device(const espbt::ESPBTDevice &device) {
@@ -11,6 +11,7 @@ from esphome.const import (
11
11
  DEVICE_CLASS_SIGNAL_STRENGTH,
12
12
  STATE_CLASS_MEASUREMENT,
13
13
  UNIT_DECIBEL_MILLIWATT,
14
+ CONF_NOTIFY,
14
15
  )
15
16
 
16
17
  from .. import ble_client_ns
@@ -19,7 +20,6 @@ DEPENDENCIES = ["ble_client"]
19
20
 
20
21
  CONF_DESCRIPTOR_UUID = "descriptor_uuid"
21
22
 
22
- CONF_NOTIFY = "notify"
23
23
  CONF_ON_NOTIFY = "on_notify"
24
24
  TYPE_CHARACTERISTIC = "characteristic"
25
25
  TYPE_RSSI = "rssi"
@@ -6,6 +6,7 @@ from esphome.const import (
6
6
  CONF_CHARACTERISTIC_UUID,
7
7
  CONF_ID,
8
8
  CONF_SERVICE_UUID,
9
+ CONF_NOTIFY,
9
10
  CONF_TRIGGER_ID,
10
11
  )
11
12
 
@@ -15,7 +16,6 @@ DEPENDENCIES = ["ble_client"]
15
16
 
16
17
  CONF_DESCRIPTOR_UUID = "descriptor_uuid"
17
18
 
18
- CONF_NOTIFY = "notify"
19
19
  CONF_ON_NOTIFY = "on_notify"
20
20
 
21
21
  adv_data_t = cg.std_vector.template(cg.uint8)
@@ -13,6 +13,11 @@ namespace bluetooth_proxy {
13
13
 
14
14
  static const char *const TAG = "bluetooth_proxy.connection";
15
15
 
16
+ void BluetoothConnection::dump_config() {
17
+ ESP_LOGCONFIG(TAG, "BLE Connection:");
18
+ BLEClientBase::dump_config();
19
+ }
20
+
16
21
  bool BluetoothConnection::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
17
22
  esp_ble_gattc_cb_param_t *param) {
18
23
  if (!BLEClientBase::gattc_event_handler(event, gattc_if, param))
@@ -11,6 +11,7 @@ class BluetoothProxy;
11
11
 
12
12
  class BluetoothConnection : public esp32_ble_client::BLEClientBase {
13
13
  public:
14
+ void dump_config() override;
14
15
  bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
15
16
  esp_ble_gattc_cb_param_t *param) override;
16
17
  void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) override;
@@ -475,6 +475,11 @@ void BluetoothProxy::send_connections_free() {
475
475
  api::BluetoothConnectionsFreeResponse call;
476
476
  call.free = this->get_bluetooth_connections_free();
477
477
  call.limit = this->get_bluetooth_connections_limit();
478
+ for (auto *connection : this->connections_) {
479
+ if (connection->address_ != 0) {
480
+ call.allocated.push_back(connection->address_);
481
+ }
482
+ }
478
483
  this->api_connection_->send_bluetooth_connections_free_response(call);
479
484
  }
480
485
 
@@ -57,6 +57,8 @@ class CH422GGPIOPin : public GPIOPin {
57
57
  void set_inverted(bool inverted) { inverted_ = inverted; }
58
58
  void set_flags(gpio::Flags flags);
59
59
 
60
+ gpio::Flags get_flags() const override { return this->flags_; }
61
+
60
62
  protected:
61
63
  CH422GComponent *parent_{};
62
64
  uint8_t pin_{};
@@ -115,7 +115,7 @@ CONF_MAX_HUMIDITY = "max_humidity"
115
115
  CONF_TARGET_HUMIDITY = "target_humidity"
116
116
 
117
117
  visual_temperature = cv.float_with_unit(
118
- "visual_temperature", "(°C|° C|°|C|° K|° K|K|°F|° F|F)?"
118
+ "visual_temperature", "(°C|° C|°|C|°K|° K|K|°F|° F|F)?"
119
119
  )
120
120
 
121
121
 
@@ -37,8 +37,9 @@ void ClimateIR::setup() {
37
37
  this->publish_state();
38
38
  });
39
39
  this->current_temperature = this->sensor_->state;
40
- } else
40
+ } else {
41
41
  this->current_temperature = NAN;
42
+ }
42
43
  // restore set points
43
44
  auto restore = this->restore_state_();
44
45
  if (restore.has_value()) {
@@ -131,8 +131,9 @@ bool CoolixClimate::on_coolix(climate::Climate *parent, remote_base::RemoteRecei
131
131
  } else {
132
132
  parent->mode = climate::CLIMATE_MODE_FAN_ONLY;
133
133
  }
134
- } else
134
+ } else {
135
135
  parent->mode = climate::CLIMATE_MODE_COOL;
136
+ }
136
137
 
137
138
  // Fan Speed
138
139
  if ((remote_state & COOLIX_FAN_AUTO) == COOLIX_FAN_AUTO || parent->mode == climate::CLIMATE_MODE_HEAT_COOL ||
@@ -1,3 +0,0 @@
1
- import esphome.codegen as cg
2
-
3
- custom_ns = cg.esphome_ns.namespace("custom")
@@ -1,31 +1,5 @@
1
- import esphome.codegen as cg
2
1
  import esphome.config_validation as cv
3
- from esphome.components import binary_sensor
4
- from esphome.const import CONF_BINARY_SENSORS, CONF_ID, CONF_LAMBDA
5
- from .. import custom_ns
6
2
 
7
- CustomBinarySensorConstructor = custom_ns.class_("CustomBinarySensorConstructor")
8
-
9
- CONFIG_SCHEMA = cv.Schema(
10
- {
11
- cv.GenerateID(): cv.declare_id(CustomBinarySensorConstructor),
12
- cv.Required(CONF_LAMBDA): cv.returning_lambda,
13
- cv.Required(CONF_BINARY_SENSORS): cv.ensure_list(
14
- binary_sensor.binary_sensor_schema()
15
- ),
16
- }
3
+ CONFIG_SCHEMA = cv.invalid(
4
+ 'The "custom" component has been removed. Consider conversion to an external component.\nhttps://esphome.io/guides/contributing#a-note-about-custom-components'
17
5
  )
18
-
19
-
20
- async def to_code(config):
21
- template_ = await cg.process_lambda(
22
- config[CONF_LAMBDA],
23
- [],
24
- return_type=cg.std_vector.template(binary_sensor.BinarySensorPtr),
25
- )
26
-
27
- rhs = CustomBinarySensorConstructor(template_)
28
- custom = cg.variable(config[CONF_ID], rhs)
29
- for i, conf in enumerate(config[CONF_BINARY_SENSORS]):
30
- rhs = custom.Pget_binary_sensor(i)
31
- await binary_sensor.register_binary_sensor(rhs, conf)
@@ -1,30 +1,5 @@
1
- import esphome.codegen as cg
2
1
  import esphome.config_validation as cv
3
- from esphome.components import climate
4
- from esphome.const import CONF_ID, CONF_LAMBDA
5
- from .. import custom_ns
6
2
 
7
- CustomClimateConstructor = custom_ns.class_("CustomClimateConstructor")
8
- CONF_CLIMATES = "climates"
9
-
10
- CONFIG_SCHEMA = cv.Schema(
11
- {
12
- cv.GenerateID(): cv.declare_id(CustomClimateConstructor),
13
- cv.Required(CONF_LAMBDA): cv.returning_lambda,
14
- cv.Required(CONF_CLIMATES): cv.ensure_list(climate.CLIMATE_SCHEMA),
15
- }
3
+ CONFIG_SCHEMA = cv.invalid(
4
+ 'The "custom" component has been removed. Consider conversion to an external component.\nhttps://esphome.io/guides/contributing#a-note-about-custom-components'
16
5
  )
17
-
18
-
19
- async def to_code(config):
20
- template_ = await cg.process_lambda(
21
- config[CONF_LAMBDA],
22
- [],
23
- return_type=cg.std_vector.template(climate.Climate.operator("ptr")),
24
- )
25
-
26
- rhs = CustomClimateConstructor(template_)
27
- custom = cg.variable(config[CONF_ID], rhs)
28
- for i, conf in enumerate(config[CONF_CLIMATES]):
29
- rhs = custom.Pget_climate(i)
30
- await climate.register_climate(rhs, conf)
@@ -1,30 +1,5 @@
1
- import esphome.codegen as cg
2
1
  import esphome.config_validation as cv
3
- from esphome.components import cover
4
- from esphome.const import CONF_ID, CONF_LAMBDA
5
- from .. import custom_ns
6
2
 
7
- CustomCoverConstructor = custom_ns.class_("CustomCoverConstructor")
8
- CONF_COVERS = "covers"
9
-
10
- CONFIG_SCHEMA = cv.Schema(
11
- {
12
- cv.GenerateID(): cv.declare_id(CustomCoverConstructor),
13
- cv.Required(CONF_LAMBDA): cv.returning_lambda,
14
- cv.Required(CONF_COVERS): cv.ensure_list(cover.COVER_SCHEMA),
15
- }
3
+ CONFIG_SCHEMA = cv.invalid(
4
+ 'The "custom" component has been removed. Consider conversion to an external component.\nhttps://esphome.io/guides/contributing#a-note-about-custom-components'
16
5
  )
17
-
18
-
19
- async def to_code(config):
20
- template_ = await cg.process_lambda(
21
- config[CONF_LAMBDA],
22
- [],
23
- return_type=cg.std_vector.template(cover.Cover.operator("ptr")),
24
- )
25
-
26
- rhs = CustomCoverConstructor(template_)
27
- custom = cg.variable(config[CONF_ID], rhs)
28
- for i, conf in enumerate(config[CONF_COVERS]):
29
- rhs = custom.Pget_cover(i)
30
- await cover.register_cover(rhs, conf)
@@ -1,30 +1,5 @@
1
- import esphome.codegen as cg
2
1
  import esphome.config_validation as cv
3
- from esphome.components import light
4
- from esphome.const import CONF_ID, CONF_LAMBDA
5
- from .. import custom_ns
6
2
 
7
- CustomLightOutputConstructor = custom_ns.class_("CustomLightOutputConstructor")
8
- CONF_LIGHTS = "lights"
9
-
10
- CONFIG_SCHEMA = cv.Schema(
11
- {
12
- cv.GenerateID(): cv.declare_id(CustomLightOutputConstructor),
13
- cv.Required(CONF_LAMBDA): cv.returning_lambda,
14
- cv.Required(CONF_LIGHTS): cv.ensure_list(light.ADDRESSABLE_LIGHT_SCHEMA),
15
- }
3
+ CONFIG_SCHEMA = cv.invalid(
4
+ 'The "custom" component has been removed. Consider conversion to an external component.\nhttps://esphome.io/guides/contributing#a-note-about-custom-components'
16
5
  )
17
-
18
-
19
- async def to_code(config):
20
- template_ = await cg.process_lambda(
21
- config[CONF_LAMBDA],
22
- [],
23
- return_type=cg.std_vector.template(light.LightOutput.operator("ptr")),
24
- )
25
-
26
- rhs = CustomLightOutputConstructor(template_)
27
- custom = cg.variable(config[CONF_ID], rhs)
28
- for i, conf in enumerate(config[CONF_LIGHTS]):
29
- rhs = custom.Pget_light(i)
30
- await light.register_light(rhs, conf)