esphome 2024.12.4__py3-none-any.whl → 2025.2.0b2__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 (358) 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/cse7766/cse7766.cpp +8 -16
  46. esphome/components/custom/__init__.py +0 -3
  47. esphome/components/custom/binary_sensor/__init__.py +2 -28
  48. esphome/components/custom/climate/__init__.py +2 -27
  49. esphome/components/custom/cover/__init__.py +2 -27
  50. esphome/components/custom/light/__init__.py +2 -27
  51. esphome/components/custom/output/__init__.py +2 -58
  52. esphome/components/custom/sensor/__init__.py +2 -24
  53. esphome/components/custom/switch/__init__.py +2 -24
  54. esphome/components/custom/text_sensor/__init__.py +2 -29
  55. esphome/components/custom_component/__init__.py +3 -27
  56. esphome/components/daly_bms/daly_bms.cpp +6 -0
  57. esphome/components/daly_bms/daly_bms.h +2 -0
  58. esphome/components/daly_bms/sensor.py +6 -0
  59. esphome/components/debug/debug_component.cpp +4 -0
  60. esphome/components/debug/debug_component.h +14 -0
  61. esphome/components/debug/debug_esp32.cpp +154 -74
  62. esphome/components/dfplayer/dfplayer.cpp +15 -2
  63. esphome/components/dfrobot_sen0395/dfrobot_sen0395.cpp +2 -1
  64. esphome/components/dht/dht.cpp +2 -1
  65. esphome/components/display/__init__.py +18 -5
  66. esphome/components/display/display.cpp +2 -1
  67. esphome/components/display/rect.cpp +2 -1
  68. esphome/components/es7210/__init__.py +0 -0
  69. esphome/components/es7210/audio_adc.py +51 -0
  70. esphome/components/es7210/es7210.cpp +228 -0
  71. esphome/components/es7210/es7210.h +62 -0
  72. esphome/components/es7210/es7210_const.h +129 -0
  73. esphome/components/es7243e/__init__.py +0 -0
  74. esphome/components/es7243e/audio_adc.py +34 -0
  75. esphome/components/es7243e/es7243e.cpp +125 -0
  76. esphome/components/es7243e/es7243e.h +37 -0
  77. esphome/components/es7243e/es7243e_const.h +54 -0
  78. esphome/components/es8156/__init__.py +0 -0
  79. esphome/components/es8156/audio_dac.py +27 -0
  80. esphome/components/es8156/es8156.cpp +87 -0
  81. esphome/components/es8156/es8156.h +51 -0
  82. esphome/components/es8156/es8156_const.h +68 -0
  83. esphome/components/es8311/audio_dac.py +1 -2
  84. esphome/components/esp32/__init__.py +1 -0
  85. esphome/components/esp32/core.cpp +5 -1
  86. esphome/components/esp32/gpio.h +2 -0
  87. esphome/components/esp32_ble/__init__.py +39 -0
  88. esphome/components/esp32_ble/queue.h +4 -4
  89. esphome/components/esp32_ble_client/ble_client_base.cpp +46 -0
  90. esphome/components/esp32_ble_client/ble_client_base.h +2 -0
  91. esphome/components/esp32_ble_server/__init__.py +582 -12
  92. esphome/components/esp32_ble_server/ble_characteristic.cpp +48 -60
  93. esphome/components/esp32_ble_server/ble_characteristic.h +24 -17
  94. esphome/components/esp32_ble_server/ble_descriptor.cpp +21 -9
  95. esphome/components/esp32_ble_server/ble_descriptor.h +17 -6
  96. esphome/components/esp32_ble_server/ble_server.cpp +62 -67
  97. esphome/components/esp32_ble_server/ble_server.h +28 -32
  98. esphome/components/esp32_ble_server/ble_server_automations.cpp +77 -0
  99. esphome/components/esp32_ble_server/ble_server_automations.h +115 -0
  100. esphome/components/esp32_ble_server/ble_service.cpp +17 -15
  101. esphome/components/esp32_ble_server/ble_service.h +10 -14
  102. esphome/components/esp32_ble_tracker/__init__.py +6 -39
  103. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +33 -10
  104. esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +8 -4
  105. esphome/components/esp32_improv/__init__.py +2 -8
  106. esphome/components/esp32_improv/esp32_improv_component.cpp +21 -20
  107. esphome/components/esp32_improv/esp32_improv_component.h +3 -4
  108. esphome/components/esp32_rmt/__init__.py +28 -3
  109. esphome/components/esp32_rmt_led_strip/led_strip.cpp +73 -6
  110. esphome/components/esp32_rmt_led_strip/led_strip.h +21 -3
  111. esphome/components/esp32_rmt_led_strip/light.py +72 -7
  112. esphome/components/esp32_touch/esp32_touch.cpp +5 -0
  113. esphome/components/esp8266/__init__.py +1 -0
  114. esphome/components/esp8266/gpio.h +1 -0
  115. esphome/components/ethernet/__init__.py +10 -10
  116. esphome/components/event/event.cpp +4 -2
  117. esphome/components/event/event.h +2 -0
  118. esphome/components/event_emitter/__init__.py +5 -0
  119. esphome/components/event_emitter/event_emitter.cpp +14 -0
  120. esphome/components/event_emitter/event_emitter.h +63 -0
  121. esphome/components/gcja5/gcja5.cpp +2 -1
  122. esphome/components/graph/graph.cpp +4 -9
  123. esphome/components/haier/haier_base.cpp +2 -1
  124. esphome/components/haier/hon_climate.cpp +2 -1
  125. esphome/components/heatpumpir/heatpumpir.cpp +2 -1
  126. esphome/components/host/__init__.py +1 -0
  127. esphome/components/host/gpio.h +1 -0
  128. esphome/components/http_request/http_request.h +2 -2
  129. esphome/components/http_request/http_request_arduino.cpp +1 -1
  130. esphome/components/http_request/http_request_idf.cpp +1 -1
  131. esphome/components/i2c/i2c_bus_esp_idf.cpp +4 -0
  132. esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +7 -5
  133. esphome/components/i2s_audio/speaker/__init__.py +53 -6
  134. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +92 -46
  135. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -0
  136. esphome/components/ili9xxx/display.py +29 -11
  137. esphome/components/ili9xxx/ili9xxx_display.cpp +2 -5
  138. esphome/components/ili9xxx/ili9xxx_display.h +2 -1
  139. esphome/components/image/__init__.py +443 -255
  140. esphome/components/image/image.cpp +115 -61
  141. esphome/components/image/image.h +15 -24
  142. esphome/components/json/json_util.cpp +8 -34
  143. esphome/components/libretiny/__init__.py +1 -0
  144. esphome/components/libretiny/gpio_arduino.h +1 -0
  145. esphome/components/light/light_color_values.h +1 -1
  146. esphome/components/logger/__init__.py +43 -7
  147. esphome/components/logger/logger.cpp +16 -11
  148. esphome/components/logger/logger.h +11 -7
  149. esphome/components/logger/select/__init__.py +29 -0
  150. esphome/components/logger/select/logger_level_select.cpp +27 -0
  151. esphome/components/logger/select/logger_level_select.h +15 -0
  152. esphome/components/lvgl/__init__.py +96 -73
  153. esphome/components/lvgl/automation.py +39 -7
  154. esphome/components/lvgl/defines.py +8 -2
  155. esphome/components/lvgl/lvgl_esphome.cpp +8 -15
  156. esphome/components/lvgl/lvgl_esphome.h +20 -5
  157. esphome/components/lvgl/schemas.py +25 -14
  158. esphome/components/lvgl/trigger.py +27 -3
  159. esphome/components/lvgl/widgets/dropdown.py +1 -1
  160. esphome/components/lvgl/widgets/keyboard.py +8 -1
  161. esphome/components/lvgl/widgets/meter.py +2 -1
  162. esphome/components/lvgl/widgets/msgbox.py +1 -1
  163. esphome/components/lvgl/widgets/obj.py +1 -12
  164. esphome/components/lvgl/widgets/page.py +37 -2
  165. esphome/components/lvgl/widgets/tabview.py +1 -1
  166. esphome/components/max6956/max6956.h +2 -0
  167. esphome/components/mcp23016/mcp23016.h +2 -0
  168. esphome/components/mcp23xxx_base/mcp23xxx_base.h +2 -0
  169. esphome/components/mdns/__init__.py +1 -1
  170. esphome/components/media_player/__init__.py +37 -8
  171. esphome/components/media_player/automation.h +11 -2
  172. esphome/components/media_player/media_player.cpp +8 -0
  173. esphome/components/media_player/media_player.h +8 -4
  174. esphome/components/micronova/switch/micronova_switch.cpp +4 -2
  175. esphome/components/midea/ac_automations.h +3 -1
  176. esphome/components/midea/air_conditioner.cpp +7 -5
  177. esphome/components/midea/air_conditioner.h +1 -1
  178. esphome/components/midea/climate.py +4 -2
  179. esphome/components/midea/ir_transmitter.h +36 -5
  180. esphome/components/mixer/__init__.py +0 -0
  181. esphome/components/mixer/speaker/__init__.py +172 -0
  182. esphome/components/mixer/speaker/automation.h +19 -0
  183. esphome/components/mixer/speaker/mixer_speaker.cpp +624 -0
  184. esphome/components/mixer/speaker/mixer_speaker.h +207 -0
  185. esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp +7 -13
  186. esphome/components/mpr121/mpr121.h +2 -0
  187. esphome/components/mqtt/__init__.py +1 -1
  188. esphome/components/mqtt/mqtt_client.cpp +7 -1
  189. esphome/components/mqtt/mqtt_client.h +1 -1
  190. esphome/components/mqtt/mqtt_climate.cpp +2 -2
  191. esphome/components/network/ip_address.h +2 -0
  192. esphome/components/nextion/automation.h +17 -0
  193. esphome/components/nextion/display.py +42 -17
  194. esphome/components/nextion/nextion.cpp +4 -10
  195. esphome/components/nextion/nextion.h +89 -82
  196. esphome/components/nextion/nextion_commands.cpp +10 -10
  197. esphome/components/ntc/sensor.py +2 -4
  198. esphome/components/online_image/__init__.py +98 -46
  199. esphome/components/online_image/bmp_image.cpp +101 -0
  200. esphome/components/online_image/bmp_image.h +40 -0
  201. esphome/components/online_image/image_decoder.cpp +28 -2
  202. esphome/components/online_image/image_decoder.h +24 -15
  203. esphome/components/online_image/jpeg_image.cpp +90 -0
  204. esphome/components/online_image/jpeg_image.h +34 -0
  205. esphome/components/online_image/online_image.cpp +112 -53
  206. esphome/components/online_image/online_image.h +24 -7
  207. esphome/components/online_image/png_image.cpp +7 -3
  208. esphome/components/online_image/png_image.h +2 -1
  209. esphome/components/opentherm/__init__.py +73 -7
  210. esphome/components/opentherm/automation.h +25 -0
  211. esphome/components/opentherm/const.py +1 -0
  212. esphome/components/opentherm/generate.py +39 -6
  213. esphome/components/opentherm/hub.cpp +117 -79
  214. esphome/components/opentherm/hub.h +31 -15
  215. esphome/components/opentherm/opentherm.cpp +47 -23
  216. esphome/components/opentherm/opentherm.h +27 -6
  217. esphome/components/opentherm/opentherm_macros.h +11 -0
  218. esphome/components/opentherm/schema.py +78 -1
  219. esphome/components/opentherm/validate.py +7 -2
  220. esphome/components/pca6416a/pca6416a.h +2 -0
  221. esphome/components/pca9554/pca9554.h +2 -0
  222. esphome/components/pcf8574/pcf8574.h +2 -0
  223. esphome/components/preferences/__init__.py +2 -4
  224. esphome/components/preferences/syncer.h +10 -3
  225. esphome/components/prometheus/prometheus_handler.cpp +313 -0
  226. esphome/components/prometheus/prometheus_handler.h +48 -7
  227. esphome/components/psram/psram.cpp +8 -1
  228. esphome/components/pulse_counter/pulse_counter_sensor.cpp +14 -9
  229. esphome/components/pulse_counter/pulse_counter_sensor.h +4 -4
  230. esphome/components/pulse_meter/pulse_meter_sensor.cpp +2 -0
  231. esphome/components/qspi_dbi/__init__.py +3 -0
  232. esphome/components/qspi_dbi/display.py +74 -47
  233. esphome/components/qspi_dbi/models.py +245 -2
  234. esphome/components/qspi_dbi/qspi_dbi.cpp +9 -16
  235. esphome/components/qspi_dbi/qspi_dbi.h +2 -2
  236. esphome/components/remote_base/__init__.py +77 -25
  237. esphome/components/remote_base/remote_base.cpp +1 -1
  238. esphome/components/remote_base/remote_base.h +20 -2
  239. esphome/components/remote_base/toto_protocol.cpp +100 -0
  240. esphome/components/remote_base/toto_protocol.h +45 -0
  241. esphome/components/remote_receiver/__init__.py +55 -10
  242. esphome/components/remote_receiver/remote_receiver.h +36 -3
  243. esphome/components/remote_receiver/remote_receiver_esp32.cpp +145 -6
  244. esphome/components/remote_transmitter/__init__.py +62 -4
  245. esphome/components/remote_transmitter/remote_transmitter.h +21 -2
  246. esphome/components/remote_transmitter/remote_transmitter_esp32.cpp +140 -4
  247. esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +3 -3
  248. esphome/components/remote_transmitter/remote_transmitter_libretiny.cpp +3 -3
  249. esphome/components/resampler/__init__.py +0 -0
  250. esphome/components/resampler/speaker/__init__.py +103 -0
  251. esphome/components/resampler/speaker/resampler_speaker.cpp +318 -0
  252. esphome/components/resampler/speaker/resampler_speaker.h +107 -0
  253. esphome/components/resistance/resistance_sensor.h +2 -3
  254. esphome/components/resistance/sensor.py +2 -9
  255. esphome/components/rotary_encoder/rotary_encoder.cpp +8 -4
  256. esphome/components/rp2040/__init__.py +1 -0
  257. esphome/components/rp2040/gpio.h +1 -0
  258. esphome/components/rtl87xx/__init__.py +2 -0
  259. esphome/components/sdl/binary_sensor.py +270 -0
  260. esphome/components/sdl/sdl_esphome.cpp +16 -0
  261. esphome/components/sdl/sdl_esphome.h +9 -0
  262. esphome/components/seeed_mr60bha2/binary_sensor.py +25 -0
  263. esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +26 -2
  264. esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +9 -20
  265. esphome/components/seeed_mr60bha2/sensor.py +9 -1
  266. esphome/components/sn74hc165/sn74hc165.h +3 -0
  267. esphome/components/sn74hc595/sn74hc595.h +3 -0
  268. esphome/components/speaker/__init__.py +5 -4
  269. esphome/components/speaker/media_player/__init__.py +458 -0
  270. esphome/components/speaker/media_player/audio_pipeline.cpp +568 -0
  271. esphome/components/speaker/media_player/audio_pipeline.h +159 -0
  272. esphome/components/speaker/media_player/automation.h +26 -0
  273. esphome/components/speaker/media_player/speaker_media_player.cpp +577 -0
  274. esphome/components/speaker/media_player/speaker_media_player.h +160 -0
  275. esphome/components/speaker/speaker.h +20 -0
  276. esphome/components/spi/__init__.py +1 -5
  277. esphome/components/spi/spi.cpp +7 -1
  278. esphome/components/spi/spi.h +21 -2
  279. esphome/components/spi_led_strip/light.py +3 -5
  280. esphome/components/spi_led_strip/spi_led_strip.cpp +67 -0
  281. esphome/components/spi_led_strip/spi_led_strip.h +8 -60
  282. esphome/components/sprinkler/sprinkler.cpp +3 -1
  283. esphome/components/sx1509/sx1509_gpio_pin.h +2 -0
  284. esphome/components/tca9555/tca9555.h +2 -0
  285. esphome/components/toshiba/toshiba.cpp +2 -1
  286. esphome/components/tuya/light/tuya_light.cpp +4 -2
  287. esphome/components/uart/uart_component_esp32_arduino.cpp +2 -2
  288. esphome/components/uart/uart_component_esp_idf.cpp +2 -2
  289. esphome/components/udp/__init__.py +8 -2
  290. esphome/components/udp/udp_component.cpp +25 -56
  291. esphome/components/udp/udp_component.h +3 -0
  292. esphome/components/uponor_smatrix/sensor/__init__.py +14 -4
  293. esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.cpp +5 -0
  294. esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.h +1 -0
  295. esphome/components/uptime/text_sensor/__init__.py +19 -0
  296. esphome/components/uptime/text_sensor/uptime_text_sensor.cpp +63 -0
  297. esphome/components/uptime/text_sensor/uptime_text_sensor.h +25 -0
  298. esphome/components/voice_assistant/voice_assistant.cpp +24 -14
  299. esphome/components/voice_assistant/voice_assistant.h +8 -0
  300. esphome/components/waveshare_epaper/display.py +22 -1
  301. esphome/components/waveshare_epaper/waveshare_213v3.cpp +9 -3
  302. esphome/components/waveshare_epaper/waveshare_epaper.cpp +1155 -44
  303. esphome/components/waveshare_epaper/waveshare_epaper.h +208 -7
  304. esphome/components/web_server/web_server.cpp +28 -6
  305. esphome/components/weikai/weikai.h +2 -0
  306. esphome/components/wifi/__init__.py +6 -6
  307. esphome/components/wifi/wifi_component.cpp +1 -1
  308. esphome/components/wifi/wifi_component_esp32_arduino.cpp +30 -1
  309. esphome/components/wireguard/__init__.py +2 -2
  310. esphome/components/xl9535/xl9535.h +2 -0
  311. esphome/components/xxtea/__init__.py +3 -0
  312. esphome/components/xxtea/xxtea.cpp +46 -0
  313. esphome/components/xxtea/xxtea.h +26 -0
  314. esphome/components/yashima/yashima.cpp +2 -1
  315. esphome/config.py +9 -5
  316. esphome/config_validation.py +55 -17
  317. esphome/const.py +7 -10
  318. esphome/core/__init__.py +6 -13
  319. esphome/core/base_automation.h +1 -0
  320. esphome/core/config.py +59 -72
  321. esphome/core/defines.h +9 -1
  322. esphome/core/gpio.h +7 -0
  323. esphome/core/helpers.cpp +19 -15
  324. esphome/core/helpers.h +57 -8
  325. esphome/core/log.h +9 -7
  326. esphome/cpp_generator.py +2 -2
  327. esphome/espota2.py +3 -2
  328. esphome/loader.py +12 -4
  329. esphome/log.py +5 -7
  330. esphome/yaml_util.py +2 -2
  331. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/METADATA +12 -7
  332. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/RECORD +341 -292
  333. esphome/components/custom/binary_sensor/custom_binary_sensor.cpp +0 -16
  334. esphome/components/custom/binary_sensor/custom_binary_sensor.h +0 -26
  335. esphome/components/custom/climate/custom_climate.h +0 -22
  336. esphome/components/custom/cover/custom_cover.h +0 -21
  337. esphome/components/custom/light/custom_light_output.h +0 -24
  338. esphome/components/custom/output/custom_output.h +0 -37
  339. esphome/components/custom/sensor/custom_sensor.cpp +0 -16
  340. esphome/components/custom/sensor/custom_sensor.h +0 -24
  341. esphome/components/custom/switch/custom_switch.cpp +0 -16
  342. esphome/components/custom/switch/custom_switch.h +0 -24
  343. esphome/components/custom/text_sensor/custom_text_sensor.cpp +0 -16
  344. esphome/components/custom/text_sensor/custom_text_sensor.h +0 -26
  345. esphome/components/custom_component/custom_component.h +0 -28
  346. esphome/components/esp32_ble_server/ble_2901.cpp +0 -18
  347. esphome/components/esp32_ble_server/ble_2901.h +0 -19
  348. esphome/components/resistance_sampler/__init__.py +0 -6
  349. esphome/components/resistance_sampler/resistance_sampler.h +0 -10
  350. esphome/components/uptime/{sensor.py → sensor/__init__.py} +3 -3
  351. /esphome/components/uptime/{uptime_seconds_sensor.cpp → sensor/uptime_seconds_sensor.cpp} +0 -0
  352. /esphome/components/uptime/{uptime_seconds_sensor.h → sensor/uptime_seconds_sensor.h} +0 -0
  353. /esphome/components/uptime/{uptime_timestamp_sensor.cpp → sensor/uptime_timestamp_sensor.cpp} +0 -0
  354. /esphome/components/uptime/{uptime_timestamp_sensor.h → sensor/uptime_timestamp_sensor.h} +0 -0
  355. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/LICENSE +0 -0
  356. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/WHEEL +0 -0
  357. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/entry_points.txt +0 -0
  358. {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/top_level.txt +0 -0
@@ -4,12 +4,15 @@
4
4
  #include "esphome/components/esp32_ble_server/ble_2902.h"
5
5
  #include "esphome/core/application.h"
6
6
  #include "esphome/core/log.h"
7
+ #include "esphome/components/bytebuffer/bytebuffer.h"
7
8
 
8
9
  #ifdef USE_ESP32
9
10
 
10
11
  namespace esphome {
11
12
  namespace esp32_improv {
12
13
 
14
+ using namespace bytebuffer;
15
+
13
16
  static const char *const TAG = "esp32_improv.component";
14
17
  static const char *const ESPHOME_MY_LINK = "https://my.home-assistant.io/redirect/config_flow_start?domain=esphome";
15
18
 
@@ -26,6 +29,8 @@ void ESP32ImprovComponent::setup() {
26
29
  });
27
30
  }
28
31
  #endif
32
+ global_ble_server->on(BLEServerEvt::EmptyEvt::ON_DISCONNECT,
33
+ [this](uint16_t conn_id) { this->set_error_(improv::ERROR_NONE); });
29
34
  }
30
35
 
31
36
  void ESP32ImprovComponent::setup_characteristics() {
@@ -40,11 +45,12 @@ void ESP32ImprovComponent::setup_characteristics() {
40
45
  this->error_->add_descriptor(error_descriptor);
41
46
 
42
47
  this->rpc_ = this->service_->create_characteristic(improv::RPC_COMMAND_UUID, BLECharacteristic::PROPERTY_WRITE);
43
- this->rpc_->on_write([this](const std::vector<uint8_t> &data) {
44
- if (!data.empty()) {
45
- this->incoming_data_.insert(this->incoming_data_.end(), data.begin(), data.end());
46
- }
47
- });
48
+ this->rpc_->EventEmitter<BLECharacteristicEvt::VectorEvt, std::vector<uint8_t>, uint16_t>::on(
49
+ BLECharacteristicEvt::VectorEvt::ON_WRITE, [this](const std::vector<uint8_t> &data, uint16_t id) {
50
+ if (!data.empty()) {
51
+ this->incoming_data_.insert(this->incoming_data_.end(), data.begin(), data.end());
52
+ }
53
+ });
48
54
  BLEDescriptor *rpc_descriptor = new BLE2902();
49
55
  this->rpc_->add_descriptor(rpc_descriptor);
50
56
 
@@ -62,7 +68,7 @@ void ESP32ImprovComponent::setup_characteristics() {
62
68
  if (this->status_indicator_ != nullptr)
63
69
  capabilities |= improv::CAPABILITY_IDENTIFY;
64
70
  #endif
65
- this->capabilities_->set_value(capabilities);
71
+ this->capabilities_->set_value(ByteBuffer::wrap(capabilities));
66
72
  this->setup_complete_ = true;
67
73
  }
68
74
 
@@ -80,8 +86,7 @@ void ESP32ImprovComponent::loop() {
80
86
  if (this->service_ == nullptr) {
81
87
  // Setup the service
82
88
  ESP_LOGD(TAG, "Creating Improv service");
83
- global_ble_server->create_service(ESPBTUUID::from_raw(improv::SERVICE_UUID), true);
84
- this->service_ = global_ble_server->get_service(ESPBTUUID::from_raw(improv::SERVICE_UUID));
89
+ this->service_ = global_ble_server->create_service(ESPBTUUID::from_raw(improv::SERVICE_UUID), true);
85
90
  this->setup_characteristics();
86
91
  }
87
92
 
@@ -93,15 +98,15 @@ void ESP32ImprovComponent::loop() {
93
98
  case improv::STATE_STOPPED:
94
99
  this->set_status_indicator_state_(false);
95
100
 
96
- if (this->service_->is_created() && this->should_start_ && this->setup_complete_) {
97
- if (this->service_->is_running()) {
101
+ if (this->should_start_ && this->setup_complete_) {
102
+ if (this->service_->is_created()) {
103
+ this->service_->start();
104
+ } else if (this->service_->is_running()) {
98
105
  esp32_ble::global_ble->advertising_start();
99
106
 
100
107
  this->set_state_(improv::STATE_AWAITING_AUTHORIZATION);
101
108
  this->set_error_(improv::ERROR_NONE);
102
109
  ESP_LOGD(TAG, "Service started!");
103
- } else {
104
- this->service_->start();
105
110
  }
106
111
  }
107
112
  break;
@@ -112,7 +117,7 @@ void ESP32ImprovComponent::loop() {
112
117
  this->set_state_(improv::STATE_AUTHORIZED);
113
118
  } else
114
119
  #else
115
- this->set_state_(improv::STATE_AUTHORIZED);
120
+ { this->set_state_(improv::STATE_AUTHORIZED); }
116
121
  #endif
117
122
  {
118
123
  if (!this->check_identify_())
@@ -199,8 +204,7 @@ void ESP32ImprovComponent::set_state_(improv::State state) {
199
204
  ESP_LOGV(TAG, "Setting state: %d", state);
200
205
  this->state_ = state;
201
206
  if (this->status_->get_value().empty() || this->status_->get_value()[0] != state) {
202
- uint8_t data[1]{state};
203
- this->status_->set_value(data, 1);
207
+ this->status_->set_value(ByteBuffer::wrap(static_cast<uint8_t>(state)));
204
208
  if (state != improv::STATE_STOPPED)
205
209
  this->status_->notify();
206
210
  }
@@ -232,15 +236,14 @@ void ESP32ImprovComponent::set_error_(improv::Error error) {
232
236
  ESP_LOGE(TAG, "Error: %d", error);
233
237
  }
234
238
  if (this->error_->get_value().empty() || this->error_->get_value()[0] != error) {
235
- uint8_t data[1]{error};
236
- this->error_->set_value(data, 1);
239
+ this->error_->set_value(ByteBuffer::wrap(static_cast<uint8_t>(error)));
237
240
  if (this->state_ != improv::STATE_STOPPED)
238
241
  this->error_->notify();
239
242
  }
240
243
  }
241
244
 
242
245
  void ESP32ImprovComponent::send_response_(std::vector<uint8_t> &response) {
243
- this->rpc_response_->set_value(response);
246
+ this->rpc_response_->set_value(ByteBuffer::wrap(response));
244
247
  if (this->state_ != improv::STATE_STOPPED)
245
248
  this->rpc_response_->notify();
246
249
  }
@@ -339,8 +342,6 @@ void ESP32ImprovComponent::on_wifi_connect_timeout_() {
339
342
  wifi::global_wifi_component->clear_sta();
340
343
  }
341
344
 
342
- void ESP32ImprovComponent::on_client_disconnect() { this->set_error_(improv::ERROR_NONE); };
343
-
344
345
  ESP32ImprovComponent *global_improv_component = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
345
346
 
346
347
  } // namespace esp32_improv
@@ -32,18 +32,17 @@ namespace esp32_improv {
32
32
 
33
33
  using namespace esp32_ble_server;
34
34
 
35
- class ESP32ImprovComponent : public Component, public BLEServiceComponent {
35
+ class ESP32ImprovComponent : public Component {
36
36
  public:
37
37
  ESP32ImprovComponent();
38
38
  void dump_config() override;
39
39
  void loop() override;
40
40
  void setup() override;
41
41
  void setup_characteristics();
42
- void on_client_disconnect() override;
43
42
 
44
43
  float get_setup_priority() const override;
45
- void start() override;
46
- void stop() override;
44
+ void start();
45
+ void stop();
47
46
  bool is_active() const { return this->state_ != improv::STATE_STOPPED; }
48
47
 
49
48
  #ifdef USE_ESP32_IMPROV_STATE_CALLBACK
@@ -1,7 +1,8 @@
1
- import esphome.config_validation as cv
2
1
  import esphome.codegen as cg
3
-
4
2
  from esphome.components import esp32
3
+ import esphome.config_validation as cv
4
+ from esphome.const import KEY_CORE, KEY_FRAMEWORK_VERSION
5
+ from esphome.core import CORE
5
6
 
6
7
  CODEOWNERS = ["@jesserockz"]
7
8
 
@@ -36,8 +37,32 @@ RMT_CHANNEL_ENUMS = {
36
37
  }
37
38
 
38
39
 
39
- def validate_rmt_channel(*, tx: bool):
40
+ def use_new_rmt_driver():
41
+ framework_version = CORE.data[KEY_CORE][KEY_FRAMEWORK_VERSION]
42
+ if CORE.using_esp_idf and framework_version >= cv.Version(5, 0, 0):
43
+ return True
44
+ return False
45
+
46
+
47
+ def validate_clock_resolution():
48
+ def _validator(value):
49
+ cv.only_on_esp32(value)
50
+ value = cv.int_(value)
51
+ variant = esp32.get_esp32_variant()
52
+ if variant == esp32.const.VARIANT_ESP32H2 and value > 32000000:
53
+ raise cv.Invalid(
54
+ f"ESP32 variant {variant} has a max clock_resolution of 32000000."
55
+ )
56
+ if value > 80000000:
57
+ raise cv.Invalid(
58
+ f"ESP32 variant {variant} has a max clock_resolution of 80000000."
59
+ )
60
+ return value
40
61
 
62
+ return _validator
63
+
64
+
65
+ def validate_rmt_channel(*, tx: bool):
41
66
  rmt_channels = RMT_TX_CHANNELS if tx else RMT_RX_CHANNELS
42
67
 
43
68
  def _validator(value):
@@ -1,5 +1,5 @@
1
- #include <cinttypes>
2
1
  #include "led_strip.h"
2
+ #include <cinttypes>
3
3
 
4
4
  #ifdef USE_ESP32
5
5
 
@@ -13,9 +13,13 @@ namespace esp32_rmt_led_strip {
13
13
 
14
14
  static const char *const TAG = "esp32_rmt_led_strip";
15
15
 
16
+ #ifdef USE_ESP32_VARIANT_ESP32H2
17
+ static const uint32_t RMT_CLK_FREQ = 32000000;
18
+ static const uint8_t RMT_CLK_DIV = 1;
19
+ #else
16
20
  static const uint32_t RMT_CLK_FREQ = 80000000;
17
-
18
21
  static const uint8_t RMT_CLK_DIV = 2;
22
+ #endif
19
23
 
20
24
  void ESP32RMTLEDStripLightOutput::setup() {
21
25
  ESP_LOGCONFIG(TAG, "Setting up ESP32 LED Strip...");
@@ -29,6 +33,7 @@ void ESP32RMTLEDStripLightOutput::setup() {
29
33
  this->mark_failed();
30
34
  return;
31
35
  }
36
+ memset(this->buf_, 0, buffer_size);
32
37
 
33
38
  this->effect_data_ = allocator.allocate(this->num_leds_);
34
39
  if (this->effect_data_ == nullptr) {
@@ -37,9 +42,48 @@ void ESP32RMTLEDStripLightOutput::setup() {
37
42
  return;
38
43
  }
39
44
 
45
+ #if ESP_IDF_VERSION_MAJOR >= 5
46
+ RAMAllocator<rmt_symbol_word_t> rmt_allocator(this->use_psram_ ? 0 : RAMAllocator<rmt_symbol_word_t>::ALLOC_INTERNAL);
47
+
48
+ // 8 bits per byte, 1 rmt_symbol_word_t per bit + 1 rmt_symbol_word_t for reset
49
+ this->rmt_buf_ = rmt_allocator.allocate(buffer_size * 8 + 1);
50
+
51
+ rmt_tx_channel_config_t channel;
52
+ memset(&channel, 0, sizeof(channel));
53
+ channel.clk_src = RMT_CLK_SRC_DEFAULT;
54
+ channel.resolution_hz = RMT_CLK_FREQ / RMT_CLK_DIV;
55
+ channel.gpio_num = gpio_num_t(this->pin_);
56
+ channel.mem_block_symbols = this->rmt_symbols_;
57
+ channel.trans_queue_depth = 1;
58
+ channel.flags.io_loop_back = 0;
59
+ channel.flags.io_od_mode = 0;
60
+ channel.flags.invert_out = 0;
61
+ channel.flags.with_dma = 0;
62
+ channel.intr_priority = 0;
63
+ if (rmt_new_tx_channel(&channel, &this->channel_) != ESP_OK) {
64
+ ESP_LOGE(TAG, "Channel creation failed");
65
+ this->mark_failed();
66
+ return;
67
+ }
68
+
69
+ rmt_copy_encoder_config_t encoder;
70
+ memset(&encoder, 0, sizeof(encoder));
71
+ if (rmt_new_copy_encoder(&encoder, &this->encoder_) != ESP_OK) {
72
+ ESP_LOGE(TAG, "Encoder creation failed");
73
+ this->mark_failed();
74
+ return;
75
+ }
76
+
77
+ if (rmt_enable(this->channel_) != ESP_OK) {
78
+ ESP_LOGE(TAG, "Enabling channel failed");
79
+ this->mark_failed();
80
+ return;
81
+ }
82
+ #else
40
83
  RAMAllocator<rmt_item32_t> rmt_allocator(this->use_psram_ ? 0 : RAMAllocator<rmt_item32_t>::ALLOC_INTERNAL);
41
- this->rmt_buf_ = rmt_allocator.allocate(buffer_size * 8 +
42
- 1); // 8 bits per byte, 1 rmt_item32_t per bit + 1 rmt_item32_t for reset
84
+
85
+ // 8 bits per byte, 1 rmt_item32_t per bit + 1 rmt_item32_t for reset
86
+ this->rmt_buf_ = rmt_allocator.allocate(buffer_size * 8 + 1);
43
87
 
44
88
  rmt_config_t config;
45
89
  memset(&config, 0, sizeof(config));
@@ -64,6 +108,7 @@ void ESP32RMTLEDStripLightOutput::setup() {
64
108
  this->mark_failed();
65
109
  return;
66
110
  }
111
+ #endif
67
112
  }
68
113
 
69
114
  void ESP32RMTLEDStripLightOutput::set_led_params(uint32_t bit0_high, uint32_t bit0_low, uint32_t bit1_high,
@@ -100,7 +145,12 @@ void ESP32RMTLEDStripLightOutput::write_state(light::LightState *state) {
100
145
 
101
146
  ESP_LOGVV(TAG, "Writing RGB values to bus...");
102
147
 
103
- if (rmt_wait_tx_done(this->channel_, pdMS_TO_TICKS(1000)) != ESP_OK) {
148
+ #if ESP_IDF_VERSION_MAJOR >= 5
149
+ esp_err_t error = rmt_tx_wait_all_done(this->channel_, 1000);
150
+ #else
151
+ esp_err_t error = rmt_wait_tx_done(this->channel_, pdMS_TO_TICKS(1000));
152
+ #endif
153
+ if (error != ESP_OK) {
104
154
  ESP_LOGE(TAG, "RMT TX timeout");
105
155
  this->status_set_warning();
106
156
  return;
@@ -112,7 +162,11 @@ void ESP32RMTLEDStripLightOutput::write_state(light::LightState *state) {
112
162
  size_t size = 0;
113
163
  size_t len = 0;
114
164
  uint8_t *psrc = this->buf_;
165
+ #if ESP_IDF_VERSION_MAJOR >= 5
166
+ rmt_symbol_word_t *pdest = this->rmt_buf_;
167
+ #else
115
168
  rmt_item32_t *pdest = this->rmt_buf_;
169
+ #endif
116
170
  while (size < buffer_size) {
117
171
  uint8_t b = *psrc;
118
172
  for (int i = 0; i < 8; i++) {
@@ -130,7 +184,16 @@ void ESP32RMTLEDStripLightOutput::write_state(light::LightState *state) {
130
184
  len++;
131
185
  }
132
186
 
133
- if (rmt_write_items(this->channel_, this->rmt_buf_, len, false) != ESP_OK) {
187
+ #if ESP_IDF_VERSION_MAJOR >= 5
188
+ rmt_transmit_config_t config;
189
+ memset(&config, 0, sizeof(config));
190
+ config.loop_count = 0;
191
+ config.flags.eot_level = 0;
192
+ error = rmt_transmit(this->channel_, this->encoder_, this->rmt_buf_, len * sizeof(rmt_symbol_word_t), &config);
193
+ #else
194
+ error = rmt_write_items(this->channel_, this->rmt_buf_, len, false);
195
+ #endif
196
+ if (error != ESP_OK) {
134
197
  ESP_LOGE(TAG, "RMT TX error");
135
198
  this->status_set_warning();
136
199
  return;
@@ -186,7 +249,11 @@ light::ESPColorView ESP32RMTLEDStripLightOutput::get_view_internal(int32_t index
186
249
  void ESP32RMTLEDStripLightOutput::dump_config() {
187
250
  ESP_LOGCONFIG(TAG, "ESP32 RMT LED Strip:");
188
251
  ESP_LOGCONFIG(TAG, " Pin: %u", this->pin_);
252
+ #if ESP_IDF_VERSION_MAJOR >= 5
253
+ ESP_LOGCONFIG(TAG, " RMT Symbols: %" PRIu32, this->rmt_symbols_);
254
+ #else
189
255
  ESP_LOGCONFIG(TAG, " Channel: %u", this->channel_);
256
+ #endif
190
257
  const char *rgb_order;
191
258
  switch (this->rgb_order_) {
192
259
  case ORDER_RGB:
@@ -9,8 +9,14 @@
9
9
  #include "esphome/core/helpers.h"
10
10
 
11
11
  #include <driver/gpio.h>
12
- #include <driver/rmt.h>
13
12
  #include <esp_err.h>
13
+ #include <esp_idf_version.h>
14
+
15
+ #if ESP_IDF_VERSION_MAJOR >= 5
16
+ #include <driver/rmt_tx.h>
17
+ #else
18
+ #include <driver/rmt.h>
19
+ #endif
14
20
 
15
21
  namespace esphome {
16
22
  namespace esp32_rmt_led_strip {
@@ -54,7 +60,11 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
54
60
  uint32_t reset_time_high, uint32_t reset_time_low);
55
61
 
56
62
  void set_rgb_order(RGBOrder rgb_order) { this->rgb_order_ = rgb_order; }
63
+ #if ESP_IDF_VERSION_MAJOR >= 5
64
+ void set_rmt_symbols(uint32_t rmt_symbols) { this->rmt_symbols_ = rmt_symbols; }
65
+ #else
57
66
  void set_rmt_channel(rmt_channel_t channel) { this->channel_ = channel; }
67
+ #endif
58
68
 
59
69
  void clear_effect_data() override {
60
70
  for (int i = 0; i < this->size(); i++)
@@ -70,7 +80,17 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
70
80
 
71
81
  uint8_t *buf_{nullptr};
72
82
  uint8_t *effect_data_{nullptr};
83
+ #if ESP_IDF_VERSION_MAJOR >= 5
84
+ rmt_channel_handle_t channel_{nullptr};
85
+ rmt_encoder_handle_t encoder_{nullptr};
86
+ rmt_symbol_word_t *rmt_buf_{nullptr};
87
+ rmt_symbol_word_t bit0_, bit1_, reset_;
88
+ uint32_t rmt_symbols_;
89
+ #else
73
90
  rmt_item32_t *rmt_buf_{nullptr};
91
+ rmt_item32_t bit0_, bit1_, reset_;
92
+ rmt_channel_t channel_{RMT_CHANNEL_0};
93
+ #endif
74
94
 
75
95
  uint8_t pin_;
76
96
  uint16_t num_leds_;
@@ -78,9 +98,7 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
78
98
  bool is_wrgb_;
79
99
  bool use_psram_;
80
100
 
81
- rmt_item32_t bit0_, bit1_, reset_;
82
101
  RGBOrder rgb_order_;
83
- rmt_channel_t channel_;
84
102
 
85
103
  uint32_t last_refresh_{0};
86
104
  optional<uint32_t> max_refresh_rate_{};
@@ -1,4 +1,5 @@
1
1
  from dataclasses import dataclass
2
+ import logging
2
3
 
3
4
  from esphome import pins
4
5
  import esphome.codegen as cg
@@ -13,7 +14,11 @@ from esphome.const import (
13
14
  CONF_PIN,
14
15
  CONF_RGB_ORDER,
15
16
  CONF_RMT_CHANNEL,
17
+ CONF_RMT_SYMBOLS,
16
18
  )
19
+ from esphome.core import CORE
20
+
21
+ _LOGGER = logging.getLogger(__name__)
17
22
 
18
23
  CODEOWNERS = ["@jesserockz"]
19
24
  DEPENDENCIES = ["esp32"]
@@ -23,8 +28,6 @@ ESP32RMTLEDStripLightOutput = esp32_rmt_led_strip_ns.class_(
23
28
  "ESP32RMTLEDStripLightOutput", light.AddressableLight
24
29
  )
25
30
 
26
- rmt_channel_t = cg.global_ns.enum("rmt_channel_t")
27
-
28
31
  RGBOrder = esp32_rmt_led_strip_ns.enum("RGBOrder")
29
32
 
30
33
  RGB_ORDERS = {
@@ -65,6 +68,53 @@ CONF_RESET_HIGH = "reset_high"
65
68
  CONF_RESET_LOW = "reset_low"
66
69
 
67
70
 
71
+ class OptionalForIDF5(cv.SplitDefault):
72
+ @property
73
+ def default(self):
74
+ if not esp32_rmt.use_new_rmt_driver():
75
+ return cv.UNDEFINED
76
+ return super().default
77
+
78
+ @default.setter
79
+ def default(self, value):
80
+ # Ignore default set from vol.Optional
81
+ pass
82
+
83
+
84
+ def only_with_new_rmt_driver(obj):
85
+ if not esp32_rmt.use_new_rmt_driver():
86
+ raise cv.Invalid(
87
+ "This feature is only available for the IDF framework version 5."
88
+ )
89
+ return obj
90
+
91
+
92
+ def not_with_new_rmt_driver(obj):
93
+ if esp32_rmt.use_new_rmt_driver():
94
+ raise cv.Invalid(
95
+ "This feature is not available for the IDF framework version 5."
96
+ )
97
+ return obj
98
+
99
+
100
+ def final_validation(config):
101
+ if not esp32_rmt.use_new_rmt_driver():
102
+ if CONF_RMT_CHANNEL not in config:
103
+ if CORE.using_esp_idf:
104
+ raise cv.Invalid(
105
+ "rmt_channel is a required option for IDF version < 5."
106
+ )
107
+ raise cv.Invalid(
108
+ "rmt_channel is a required option for the Arduino framework."
109
+ )
110
+ _LOGGER.warning(
111
+ "RMT_LED_STRIP support for IDF version < 5 is deprecated and will be removed soon."
112
+ )
113
+
114
+
115
+ FINAL_VALIDATE_SCHEMA = final_validation
116
+
117
+
68
118
  CONFIG_SCHEMA = cv.All(
69
119
  light.ADDRESSABLE_LIGHT_SCHEMA.extend(
70
120
  {
@@ -72,7 +122,18 @@ CONFIG_SCHEMA = cv.All(
72
122
  cv.Required(CONF_PIN): pins.internal_gpio_output_pin_number,
73
123
  cv.Required(CONF_NUM_LEDS): cv.positive_not_null_int,
74
124
  cv.Required(CONF_RGB_ORDER): cv.enum(RGB_ORDERS, upper=True),
75
- cv.Required(CONF_RMT_CHANNEL): esp32_rmt.validate_rmt_channel(tx=True),
125
+ cv.Optional(CONF_RMT_CHANNEL): cv.All(
126
+ not_with_new_rmt_driver, esp32_rmt.validate_rmt_channel(tx=True)
127
+ ),
128
+ OptionalForIDF5(
129
+ CONF_RMT_SYMBOLS,
130
+ esp32_idf=192,
131
+ esp32_s2_idf=192,
132
+ esp32_s3_idf=192,
133
+ esp32_c3_idf=96,
134
+ esp32_c6_idf=96,
135
+ esp32_h2_idf=96,
136
+ ): cv.All(only_with_new_rmt_driver, cv.int_range(min=2)),
76
137
  cv.Optional(CONF_MAX_REFRESH_RATE): cv.positive_time_period_microseconds,
77
138
  cv.Optional(CONF_CHIPSET): cv.one_of(*CHIPSETS, upper=True),
78
139
  cv.Optional(CONF_IS_RGBW, default=False): cv.boolean,
@@ -148,8 +209,12 @@ async def to_code(config):
148
209
  cg.add(var.set_is_wrgb(config[CONF_IS_WRGB]))
149
210
  cg.add(var.set_use_psram(config[CONF_USE_PSRAM]))
150
211
 
151
- cg.add(
152
- var.set_rmt_channel(
153
- getattr(rmt_channel_t, f"RMT_CHANNEL_{config[CONF_RMT_CHANNEL]}")
212
+ if esp32_rmt.use_new_rmt_driver():
213
+ cg.add(var.set_rmt_symbols(config[CONF_RMT_SYMBOLS]))
214
+ else:
215
+ rmt_channel_t = cg.global_ns.enum("rmt_channel_t")
216
+ cg.add(
217
+ var.set_rmt_channel(
218
+ getattr(rmt_channel_t, f"RMT_CHANNEL_{config[CONF_RMT_CHANNEL]}")
219
+ )
154
220
  )
155
- )
@@ -52,7 +52,12 @@ void ESP32TouchComponent::setup() {
52
52
  }
53
53
  #endif
54
54
 
55
+ #if ESP_IDF_VERSION_MAJOR >= 5
56
+ touch_pad_set_measurement_clock_cycles(this->meas_cycle_);
57
+ touch_pad_set_measurement_interval(this->sleep_cycle_);
58
+ #else
55
59
  touch_pad_set_meas_time(this->sleep_cycle_, this->meas_cycle_);
60
+ #endif
56
61
  touch_pad_set_voltage(this->high_voltage_reference_, this->low_voltage_reference_, this->voltage_attenuation_);
57
62
 
58
63
  for (auto *child : this->children_) {
@@ -34,6 +34,7 @@ from .gpio import PinInitialState, add_pin_initial_states_array
34
34
  CODEOWNERS = ["@esphome/core"]
35
35
  _LOGGER = logging.getLogger(__name__)
36
36
  AUTO_LOAD = ["preferences"]
37
+ IS_TARGET_PLATFORM = True
37
38
 
38
39
 
39
40
  def set_core_data(config):
@@ -22,6 +22,7 @@ class ESP8266GPIOPin : public InternalGPIOPin {
22
22
  void detach_interrupt() const override;
23
23
  ISRInternalGPIOPin to_isr() const override;
24
24
  uint8_t get_pin() const override { return pin_; }
25
+ gpio::Flags get_flags() const override { return flags_; }
25
26
  bool is_inverted() const override { return inverted_; }
26
27
 
27
28
  protected:
@@ -94,11 +94,11 @@ CLK_MODES = {
94
94
 
95
95
  MANUAL_IP_SCHEMA = cv.Schema(
96
96
  {
97
- cv.Required(CONF_STATIC_IP): cv.ipv4,
98
- cv.Required(CONF_GATEWAY): cv.ipv4,
99
- cv.Required(CONF_SUBNET): cv.ipv4,
100
- cv.Optional(CONF_DNS1, default="0.0.0.0"): cv.ipv4,
101
- cv.Optional(CONF_DNS2, default="0.0.0.0"): cv.ipv4,
97
+ cv.Required(CONF_STATIC_IP): cv.ipv4address,
98
+ cv.Required(CONF_GATEWAY): cv.ipv4address,
99
+ cv.Required(CONF_SUBNET): cv.ipv4address,
100
+ cv.Optional(CONF_DNS1, default="0.0.0.0"): cv.ipv4address,
101
+ cv.Optional(CONF_DNS2, default="0.0.0.0"): cv.ipv4address,
102
102
  }
103
103
  )
104
104
 
@@ -255,11 +255,11 @@ FINAL_VALIDATE_SCHEMA = _final_validate
255
255
  def manual_ip(config):
256
256
  return cg.StructInitializer(
257
257
  ManualIP,
258
- ("static_ip", IPAddress(*config[CONF_STATIC_IP].args)),
259
- ("gateway", IPAddress(*config[CONF_GATEWAY].args)),
260
- ("subnet", IPAddress(*config[CONF_SUBNET].args)),
261
- ("dns1", IPAddress(*config[CONF_DNS1].args)),
262
- ("dns2", IPAddress(*config[CONF_DNS2].args)),
258
+ ("static_ip", IPAddress(str(config[CONF_STATIC_IP]))),
259
+ ("gateway", IPAddress(str(config[CONF_GATEWAY]))),
260
+ ("subnet", IPAddress(str(config[CONF_SUBNET]))),
261
+ ("dns1", IPAddress(str(config[CONF_DNS1]))),
262
+ ("dns2", IPAddress(str(config[CONF_DNS2]))),
263
263
  )
264
264
 
265
265
 
@@ -8,11 +8,13 @@ namespace event {
8
8
  static const char *const TAG = "event";
9
9
 
10
10
  void Event::trigger(const std::string &event_type) {
11
- if (types_.find(event_type) == types_.end()) {
11
+ auto found = types_.find(event_type);
12
+ if (found == types_.end()) {
12
13
  ESP_LOGE(TAG, "'%s': invalid event type for trigger(): %s", this->get_name().c_str(), event_type.c_str());
13
14
  return;
14
15
  }
15
- ESP_LOGD(TAG, "'%s' Triggered event '%s'", this->get_name().c_str(), event_type.c_str());
16
+ last_event_type = &(*found);
17
+ ESP_LOGD(TAG, "'%s' Triggered event '%s'", this->get_name().c_str(), last_event_type->c_str());
16
18
  this->event_callback_.call(event_type);
17
19
  }
18
20
 
@@ -23,6 +23,8 @@ namespace event {
23
23
 
24
24
  class Event : public EntityBase, public EntityBase_DeviceClass {
25
25
  public:
26
+ const std::string *last_event_type;
27
+
26
28
  void trigger(const std::string &event_type);
27
29
  void set_event_types(const std::set<std::string> &event_types) { this->types_ = event_types; }
28
30
  std::set<std::string> get_event_types() const { return this->types_; }
@@ -0,0 +1,5 @@
1
+ CODEOWNERS = ["@Rapsssito"]
2
+
3
+ # Allows event_emitter to be configured in yaml, to allow use of the C++ api.
4
+
5
+ CONFIG_SCHEMA = {}
@@ -0,0 +1,14 @@
1
+ #include "event_emitter.h"
2
+
3
+ namespace esphome {
4
+ namespace event_emitter {
5
+
6
+ static const char *const TAG = "event_emitter";
7
+
8
+ void raise_event_emitter_full_error() {
9
+ ESP_LOGE(TAG, "EventEmitter has reached the maximum number of listeners for event");
10
+ ESP_LOGW(TAG, "Removing listener to make space for new listener");
11
+ }
12
+
13
+ } // namespace event_emitter
14
+ } // namespace esphome