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
@@ -33,19 +33,12 @@ void QspiDbi::update() {
33
33
  this->do_update_();
34
34
  if (this->buffer_ == nullptr || this->x_low_ > this->x_high_ || this->y_low_ > this->y_high_)
35
35
  return;
36
- // Start addresses and widths/heights must be divisible by 2 (CASET/RASET restriction in datasheet)
37
- if (this->x_low_ % 2 == 1) {
38
- this->x_low_--;
39
- }
40
- if (this->x_high_ % 2 == 0) {
41
- this->x_high_++;
42
- }
43
- if (this->y_low_ % 2 == 1) {
44
- this->y_low_--;
45
- }
46
- if (this->y_high_ % 2 == 0) {
47
- this->y_high_++;
48
- }
36
+ // Some chips require that the drawing window be aligned on certain boundaries
37
+ auto dr = this->draw_rounding_;
38
+ this->x_low_ = this->x_low_ / dr * dr;
39
+ this->y_low_ = this->y_low_ / dr * dr;
40
+ this->x_high_ = (this->x_high_ + dr) / dr * dr - 1;
41
+ this->y_high_ = (this->y_high_ + dr) / dr * dr - 1;
49
42
  if (this->draw_from_origin_) {
50
43
  this->x_low_ = 0;
51
44
  this->y_low_ = 0;
@@ -175,10 +168,9 @@ void QspiDbi::write_to_display_(int x_start, int y_start, int w, int h, const ui
175
168
  this->write_cmd_addr_data(8, 0x32, 24, 0x2C00, ptr, w * h * 2, 4);
176
169
  } else {
177
170
  auto stride = x_offset + w + x_pad;
178
- uint16_t cmd = 0x2C00;
171
+ this->write_cmd_addr_data(8, 0x32, 24, 0x2C00, nullptr, 0, 4);
179
172
  for (int y = 0; y != h; y++) {
180
- this->write_cmd_addr_data(8, 0x32, 24, cmd, ptr + ((y + y_offset) * stride + x_offset) * 2, w * 2, 4);
181
- cmd = 0x3C00;
173
+ this->write_cmd_addr_data(0, 0, 0, 0, ptr + ((y + y_offset) * stride + x_offset) * 2, w * 2, 4);
182
174
  }
183
175
  }
184
176
  this->disable();
@@ -220,6 +212,7 @@ void QspiDbi::dump_config() {
220
212
  ESP_LOGCONFIG("", "Model: %s", this->model_);
221
213
  ESP_LOGCONFIG(TAG, " Height: %u", this->height_);
222
214
  ESP_LOGCONFIG(TAG, " Width: %u", this->width_);
215
+ ESP_LOGCONFIG(TAG, " Draw rounding: %u", this->draw_rounding_);
223
216
  LOG_PIN(" CS Pin: ", this->cs_);
224
217
  LOG_PIN(" Reset Pin: ", this->reset_pin_);
225
218
  ESP_LOGCONFIG(TAG, " SPI Data rate: %dMHz", (unsigned) (this->data_rate_ / 1000000));
@@ -4,12 +4,10 @@
4
4
  #pragma once
5
5
 
6
6
  #ifdef USE_ESP_IDF
7
- #include "esphome/core/component.h"
8
7
  #include "esphome/components/spi/spi.h"
9
8
  #include "esphome/components/display/display.h"
10
9
  #include "esphome/components/display/display_buffer.h"
11
10
  #include "esphome/components/display/display_color_utils.h"
12
- #include "esp_lcd_panel_ops.h"
13
11
 
14
12
  #include "esp_lcd_panel_rgb.h"
15
13
 
@@ -105,6 +103,7 @@ class QspiDbi : public display::DisplayBuffer,
105
103
  int get_height_internal() override { return this->height_; }
106
104
  bool can_proceed() override { return this->setup_complete_; }
107
105
  void add_init_sequence(const std::vector<uint8_t> &sequence) { this->init_sequences_.push_back(sequence); }
106
+ void set_draw_rounding(unsigned rounding) { this->draw_rounding_ = rounding; }
108
107
 
109
108
  protected:
110
109
  void check_buffer_() {
@@ -161,6 +160,7 @@ class QspiDbi : public display::DisplayBuffer,
161
160
  bool mirror_x_{};
162
161
  bool mirror_y_{};
163
162
  bool draw_from_origin_{false};
163
+ unsigned draw_rounding_{2};
164
164
  uint8_t brightness_{0xD0};
165
165
  const char *model_{"Unknown"};
166
166
  std::vector<std::vector<uint8_t>> init_sequences_{};
@@ -1,41 +1,41 @@
1
- import esphome.codegen as cg
2
- import esphome.config_validation as cv
3
1
  from esphome import automation
2
+ import esphome.codegen as cg
4
3
  from esphome.components import binary_sensor
4
+ import esphome.config_validation as cv
5
5
  from esphome.const import (
6
+ CONF_ADDRESS,
7
+ CONF_BUTTON,
8
+ CONF_CARRIER_FREQUENCY,
9
+ CONF_CHANNEL,
10
+ CONF_CHECK,
11
+ CONF_CODE,
12
+ CONF_COMMAND,
6
13
  CONF_COMMAND_REPEATS,
7
14
  CONF_DATA,
8
- CONF_TRIGGER_ID,
15
+ CONF_DELTA,
16
+ CONF_DEVICE,
17
+ CONF_FAMILY,
18
+ CONF_GROUP,
19
+ CONF_ID,
20
+ CONF_INVERTED,
21
+ CONF_LEVEL,
22
+ CONF_MAGNITUDE,
9
23
  CONF_NBITS,
10
- CONF_ADDRESS,
11
- CONF_COMMAND,
12
- CONF_CODE,
13
- CONF_PULSE_LENGTH,
14
- CONF_SYNC,
15
- CONF_ZERO,
16
24
  CONF_ONE,
17
- CONF_INVERTED,
18
25
  CONF_PROTOCOL,
19
- CONF_GROUP,
20
- CONF_DEVICE,
26
+ CONF_PULSE_LENGTH,
27
+ CONF_RC_CODE_1,
28
+ CONF_RC_CODE_2,
29
+ CONF_REPEAT,
21
30
  CONF_SECOND,
22
31
  CONF_STATE,
23
- CONF_CHANNEL,
24
- CONF_FAMILY,
25
- CONF_REPEAT,
26
- CONF_WAIT_TIME,
32
+ CONF_SYNC,
27
33
  CONF_TIMES,
34
+ CONF_TRIGGER_ID,
28
35
  CONF_TYPE_ID,
29
- CONF_CARRIER_FREQUENCY,
30
- CONF_RC_CODE_1,
31
- CONF_RC_CODE_2,
32
- CONF_MAGNITUDE,
36
+ CONF_WAIT_TIME,
33
37
  CONF_WAND_ID,
34
- CONF_LEVEL,
35
- CONF_DELTA,
36
- CONF_ID,
37
- CONF_BUTTON,
38
- CONF_CHECK,
38
+ CONF_ZERO,
39
39
  )
40
40
  from esphome.core import coroutine
41
41
  from esphome.schema_extractors import SCHEMA_EXTRACT, schema_extractor
@@ -1963,3 +1963,55 @@ async def mirage_action(var, config, args):
1963
1963
  vec_ = cg.std_vector.template(cg.uint8)
1964
1964
  template_ = await cg.templatable(config[CONF_CODE], args, vec_, vec_)
1965
1965
  cg.add(var.set_code(template_))
1966
+
1967
+
1968
+ # Toto
1969
+ (
1970
+ TotoData,
1971
+ TotoBinarySensor,
1972
+ TotoTrigger,
1973
+ TotoAction,
1974
+ TotoDumper,
1975
+ ) = declare_protocol("Toto")
1976
+
1977
+ TOTO_SCHEMA = cv.Schema(
1978
+ {
1979
+ cv.Optional(CONF_RC_CODE_1, default=0): cv.hex_int_range(0, 0xF),
1980
+ cv.Optional(CONF_RC_CODE_2, default=0): cv.hex_int_range(0, 0xF),
1981
+ cv.Required(CONF_COMMAND): cv.hex_uint8_t,
1982
+ }
1983
+ )
1984
+
1985
+
1986
+ @register_binary_sensor("toto", TotoBinarySensor, TOTO_SCHEMA)
1987
+ def toto_binary_sensor(var, config):
1988
+ cg.add(
1989
+ var.set_data(
1990
+ cg.StructInitializer(
1991
+ TotoData,
1992
+ ("rc_code_1", config[CONF_RC_CODE_1]),
1993
+ ("rc_code_2", config[CONF_RC_CODE_2]),
1994
+ ("command", config[CONF_COMMAND]),
1995
+ )
1996
+ )
1997
+ )
1998
+
1999
+
2000
+ @register_trigger("toto", TotoTrigger, TotoData)
2001
+ def toto_trigger(var, config):
2002
+ pass
2003
+
2004
+
2005
+ @register_dumper("toto", TotoDumper)
2006
+ def toto_dumper(var, config):
2007
+ pass
2008
+
2009
+
2010
+ @register_action("toto", TotoAction, TOTO_SCHEMA)
2011
+ async def Toto_action(var, config, args):
2012
+ template_ = await cg.templatable(config[CONF_RC_CODE_1], args, cg.uint8)
2013
+ cg.add(var.set_rc_code_1(template_))
2014
+ template_ = await cg.templatable(config[CONF_RC_CODE_2], args, cg.uint8)
2015
+ cg.add(var.set_rc_code_2(template_))
2016
+ template_ = await cg.templatable(config[CONF_COMMAND], args, cg.uint8)
2017
+ cg.add(var.set_command(template_))
@@ -8,7 +8,7 @@ namespace remote_base {
8
8
 
9
9
  static const char *const TAG = "remote_base";
10
10
 
11
- #ifdef USE_ESP32
11
+ #if defined(USE_ESP32) && ESP_IDF_VERSION_MAJOR < 5
12
12
  RemoteRMTChannel::RemoteRMTChannel(uint8_t mem_block_num) : mem_block_num_(mem_block_num) {
13
13
  static rmt_channel_t next_rmt_channel = RMT_CHANNEL_0;
14
14
  this->channel_ = next_rmt_channel;
@@ -8,7 +8,7 @@
8
8
  #include "esphome/core/component.h"
9
9
  #include "esphome/core/hal.h"
10
10
 
11
- #ifdef USE_ESP32
11
+ #if defined(USE_ESP32) && ESP_IDF_VERSION_MAJOR < 5
12
12
  #include <driver/rmt.h>
13
13
  #endif
14
14
 
@@ -54,7 +54,7 @@ class RemoteReceiveData {
54
54
  uint32_t get_index() const { return index_; }
55
55
  int32_t operator[](uint32_t index) const { return this->data_[index]; }
56
56
  int32_t size() const { return this->data_.size(); }
57
- bool is_valid(uint32_t offset) const { return this->index_ + offset < this->data_.size(); }
57
+ bool is_valid(uint32_t offset = 0) const { return this->index_ + offset < this->data_.size(); }
58
58
  int32_t peek(uint32_t offset = 0) const { return this->data_[this->index_ + offset]; }
59
59
  bool peek_mark(uint32_t length, uint32_t offset = 0) const;
60
60
  bool peek_space(uint32_t length, uint32_t offset = 0) const;
@@ -112,25 +112,43 @@ class RemoteComponentBase {
112
112
  #ifdef USE_ESP32
113
113
  class RemoteRMTChannel {
114
114
  public:
115
+ #if ESP_IDF_VERSION_MAJOR >= 5
116
+ void set_clock_resolution(uint32_t clock_resolution) { this->clock_resolution_ = clock_resolution; }
117
+ void set_rmt_symbols(uint32_t rmt_symbols) { this->rmt_symbols_ = rmt_symbols; }
118
+ #else
115
119
  explicit RemoteRMTChannel(uint8_t mem_block_num = 1);
116
120
  explicit RemoteRMTChannel(rmt_channel_t channel, uint8_t mem_block_num = 1);
117
121
 
118
122
  void config_rmt(rmt_config_t &rmt);
119
123
  void set_clock_divider(uint8_t clock_divider) { this->clock_divider_ = clock_divider; }
124
+ #endif
120
125
 
121
126
  protected:
122
127
  uint32_t from_microseconds_(uint32_t us) {
128
+ #if ESP_IDF_VERSION_MAJOR >= 5
129
+ const uint32_t ticks_per_ten_us = this->clock_resolution_ / 100000u;
130
+ #else
123
131
  const uint32_t ticks_per_ten_us = 80000000u / this->clock_divider_ / 100000u;
132
+ #endif
124
133
  return us * ticks_per_ten_us / 10;
125
134
  }
126
135
  uint32_t to_microseconds_(uint32_t ticks) {
136
+ #if ESP_IDF_VERSION_MAJOR >= 5
137
+ const uint32_t ticks_per_ten_us = this->clock_resolution_ / 100000u;
138
+ #else
127
139
  const uint32_t ticks_per_ten_us = 80000000u / this->clock_divider_ / 100000u;
140
+ #endif
128
141
  return (ticks * 10) / ticks_per_ten_us;
129
142
  }
130
143
  RemoteComponentBase *remote_base_;
144
+ #if ESP_IDF_VERSION_MAJOR >= 5
145
+ uint32_t clock_resolution_{1000000};
146
+ uint32_t rmt_symbols_;
147
+ #else
131
148
  rmt_channel_t channel_{RMT_CHANNEL_0};
132
149
  uint8_t mem_block_num_;
133
150
  uint8_t clock_divider_{80};
151
+ #endif
134
152
  };
135
153
  #endif
136
154
 
@@ -0,0 +1,100 @@
1
+ #include "toto_protocol.h"
2
+ #include "esphome/core/log.h"
3
+
4
+ namespace esphome {
5
+ namespace remote_base {
6
+
7
+ static const char *const TAG = "remote.toto";
8
+
9
+ static const uint32_t PREAMBLE_HIGH_US = 6200;
10
+ static const uint32_t PREAMBLE_LOW_US = 2800;
11
+ static const uint32_t BIT_HIGH_US = 550;
12
+ static const uint32_t BIT_ONE_LOW_US = 1700;
13
+ static const uint32_t BIT_ZERO_LOW_US = 550;
14
+ static const uint32_t TOTO_HEADER = 0x2008;
15
+
16
+ void TotoProtocol::encode(RemoteTransmitData *dst, const TotoData &data) {
17
+ uint32_t payload = 0;
18
+
19
+ payload = data.rc_code_1 << 20;
20
+ payload |= data.rc_code_2 << 16;
21
+ payload |= data.command << 8;
22
+ payload |= ((payload & 0xFF0000) >> 16) ^ ((payload & 0x00FF00) >> 8);
23
+
24
+ dst->reserve(80);
25
+ dst->set_carrier_frequency(38000);
26
+ dst->item(PREAMBLE_HIGH_US, PREAMBLE_LOW_US);
27
+
28
+ for (uint32_t mask = 1UL << 14; mask; mask >>= 1) {
29
+ if (TOTO_HEADER & mask) {
30
+ dst->item(BIT_HIGH_US, BIT_ONE_LOW_US);
31
+ } else {
32
+ dst->item(BIT_HIGH_US, BIT_ZERO_LOW_US);
33
+ }
34
+ }
35
+
36
+ for (uint32_t mask = 1UL << 23; mask; mask >>= 1) {
37
+ if (payload & mask) {
38
+ dst->item(BIT_HIGH_US, BIT_ONE_LOW_US);
39
+ } else {
40
+ dst->item(BIT_HIGH_US, BIT_ZERO_LOW_US);
41
+ }
42
+ }
43
+
44
+ dst->mark(BIT_HIGH_US);
45
+ }
46
+ optional<TotoData> TotoProtocol::decode(RemoteReceiveData src) {
47
+ uint16_t header = 0;
48
+ uint32_t payload = 0;
49
+
50
+ TotoData data{
51
+ .rc_code_1 = 0,
52
+ .rc_code_2 = 0,
53
+ .command = 0,
54
+ };
55
+
56
+ if (!src.expect_item(PREAMBLE_HIGH_US, PREAMBLE_LOW_US)) {
57
+ return {};
58
+ }
59
+
60
+ for (uint32_t mask = 1UL << 14; mask; mask >>= 1) {
61
+ if (src.expect_item(BIT_HIGH_US, BIT_ONE_LOW_US)) {
62
+ header |= mask;
63
+ } else if (src.expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
64
+ header &= ~mask;
65
+ } else {
66
+ return {};
67
+ }
68
+ }
69
+
70
+ if (header != TOTO_HEADER) {
71
+ return {};
72
+ }
73
+
74
+ for (uint32_t mask = 1UL << 23; mask; mask >>= 1) {
75
+ if (src.expect_item(BIT_HIGH_US, BIT_ONE_LOW_US)) {
76
+ payload |= mask;
77
+ } else if (src.expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
78
+ payload &= ~mask;
79
+ } else {
80
+ return {};
81
+ }
82
+ }
83
+
84
+ if ((((payload & 0xFF0000) >> 16) ^ ((payload & 0x00FF00) >> 8)) != (payload & 0x0000FF)) {
85
+ return {};
86
+ }
87
+
88
+ data.rc_code_1 = (payload & 0xF00000) >> 20;
89
+ data.rc_code_2 = (payload & 0x0F0000) >> 16;
90
+ data.command = (payload & 0x00FF00) >> 8;
91
+
92
+ return data;
93
+ }
94
+ void TotoProtocol::dump(const TotoData &data) {
95
+ ESP_LOGI(TAG, "Received Toto data: rc_code_1=0x%01X, rc_code_2=0x%01X, command=0x%02X", data.rc_code_1,
96
+ data.rc_code_2, data.command);
97
+ }
98
+
99
+ } // namespace remote_base
100
+ } // namespace esphome
@@ -0,0 +1,45 @@
1
+ #pragma once
2
+
3
+ #include "remote_base.h"
4
+
5
+ namespace esphome {
6
+ namespace remote_base {
7
+
8
+ struct TotoData {
9
+ uint8_t rc_code_1 : 4;
10
+ uint8_t rc_code_2 : 4;
11
+ uint8_t command;
12
+
13
+ bool operator==(const TotoData &rhs) const {
14
+ return (rc_code_1 == rhs.rc_code_1) && (rc_code_2 == rhs.rc_code_2) && (command == rhs.command);
15
+ }
16
+ };
17
+
18
+ class TotoProtocol : public RemoteProtocol<TotoData> {
19
+ public:
20
+ void encode(RemoteTransmitData *dst, const TotoData &data) override;
21
+ optional<TotoData> decode(RemoteReceiveData src) override;
22
+ void dump(const TotoData &data) override;
23
+ };
24
+
25
+ DECLARE_REMOTE_PROTOCOL(Toto)
26
+
27
+ template<typename... Ts> class TotoAction : public RemoteTransmitterActionBase<Ts...> {
28
+ public:
29
+ TEMPLATABLE_VALUE(uint8_t, rc_code_1)
30
+ TEMPLATABLE_VALUE(uint8_t, rc_code_2)
31
+ TEMPLATABLE_VALUE(uint8_t, command)
32
+
33
+ void encode(RemoteTransmitData *dst, Ts... x) override {
34
+ TotoData data{};
35
+ data.rc_code_1 = this->rc_code_1_.value(x...);
36
+ data.rc_code_2 = this->rc_code_2_.value(x...);
37
+ data.command = this->command_.value(x...);
38
+ this->set_send_times(this->send_times_.value_or(x..., 3));
39
+ this->set_send_wait(this->send_wait_.value_or(x..., 32000));
40
+ TotoProtocol().encode(dst, data);
41
+ }
42
+ };
43
+
44
+ } // namespace remote_base
45
+ } // namespace esphome
@@ -5,6 +5,7 @@ import esphome.config_validation as cv
5
5
  from esphome.const import (
6
6
  CONF_BUFFER_SIZE,
7
7
  CONF_CLOCK_DIVIDER,
8
+ CONF_CLOCK_RESOLUTION,
8
9
  CONF_DUMP,
9
10
  CONF_FILTER,
10
11
  CONF_ID,
@@ -12,12 +13,17 @@ from esphome.const import (
12
13
  CONF_MEMORY_BLOCKS,
13
14
  CONF_PIN,
14
15
  CONF_RMT_CHANNEL,
16
+ CONF_RMT_SYMBOLS,
15
17
  CONF_TOLERANCE,
16
18
  CONF_TYPE,
19
+ CONF_USE_DMA,
17
20
  CONF_VALUE,
18
21
  )
19
22
  from esphome.core import CORE, TimePeriod
20
23
 
24
+ CONF_FILTER_SYMBOLS = "filter_symbols"
25
+ CONF_RECEIVE_SYMBOLS = "receive_symbols"
26
+
21
27
  AUTO_LOAD = ["remote_base"]
22
28
  remote_receiver_ns = cg.esphome_ns.namespace("remote_receiver")
23
29
  remote_base_ns = cg.esphome_ns.namespace("remote_base")
@@ -97,15 +103,43 @@ CONFIG_SCHEMA = remote_base.validate_triggers(
97
103
  cv.positive_time_period_microseconds,
98
104
  cv.Range(max=TimePeriod(microseconds=4294967295)),
99
105
  ),
100
- cv.SplitDefault(CONF_CLOCK_DIVIDER, esp32=80): cv.All(
101
- cv.only_on_esp32, cv.Range(min=1, max=255)
106
+ cv.SplitDefault(CONF_CLOCK_DIVIDER, esp32_arduino=80): cv.All(
107
+ cv.only_on_esp32,
108
+ cv.only_with_arduino,
109
+ cv.int_range(min=1, max=255),
110
+ ),
111
+ cv.Optional(CONF_CLOCK_RESOLUTION): cv.All(
112
+ cv.only_on_esp32,
113
+ cv.only_with_esp_idf,
114
+ esp32_rmt.validate_clock_resolution(),
102
115
  ),
103
116
  cv.Optional(CONF_IDLE, default="10ms"): cv.All(
104
117
  cv.positive_time_period_microseconds,
105
118
  cv.Range(max=TimePeriod(microseconds=4294967295)),
106
119
  ),
107
- cv.Optional(CONF_MEMORY_BLOCKS, default=3): cv.Range(min=1, max=8),
108
- cv.Optional(CONF_RMT_CHANNEL): esp32_rmt.validate_rmt_channel(tx=False),
120
+ cv.SplitDefault(CONF_MEMORY_BLOCKS, esp32_arduino=3): cv.All(
121
+ cv.only_with_arduino, cv.int_range(min=1, max=8)
122
+ ),
123
+ cv.Optional(CONF_RMT_CHANNEL): cv.All(
124
+ cv.only_with_arduino, esp32_rmt.validate_rmt_channel(tx=False)
125
+ ),
126
+ cv.SplitDefault(
127
+ CONF_RMT_SYMBOLS,
128
+ esp32_idf=192,
129
+ esp32_s2_idf=192,
130
+ esp32_s3_idf=192,
131
+ esp32_c3_idf=96,
132
+ esp32_c6_idf=96,
133
+ esp32_h2_idf=96,
134
+ ): cv.All(cv.only_with_esp_idf, cv.int_range(min=2)),
135
+ cv.Optional(CONF_FILTER_SYMBOLS): cv.All(
136
+ cv.only_with_esp_idf, cv.int_range(min=0)
137
+ ),
138
+ cv.SplitDefault(
139
+ CONF_RECEIVE_SYMBOLS,
140
+ esp32_idf=192,
141
+ ): cv.All(cv.only_with_esp_idf, cv.int_range(min=2)),
142
+ cv.Optional(CONF_USE_DMA): cv.All(cv.only_with_esp_idf, cv.boolean),
109
143
  }
110
144
  ).extend(cv.COMPONENT_SCHEMA)
111
145
  )
@@ -114,13 +148,24 @@ CONFIG_SCHEMA = remote_base.validate_triggers(
114
148
  async def to_code(config):
115
149
  pin = await cg.gpio_pin_expression(config[CONF_PIN])
116
150
  if CORE.is_esp32:
117
- if (rmt_channel := config.get(CONF_RMT_CHANNEL, None)) is not None:
118
- var = cg.new_Pvariable(
119
- config[CONF_ID], pin, rmt_channel, config[CONF_MEMORY_BLOCKS]
120
- )
151
+ if esp32_rmt.use_new_rmt_driver():
152
+ var = cg.new_Pvariable(config[CONF_ID], pin)
153
+ cg.add(var.set_rmt_symbols(config[CONF_RMT_SYMBOLS]))
154
+ cg.add(var.set_receive_symbols(config[CONF_RECEIVE_SYMBOLS]))
155
+ if CONF_USE_DMA in config:
156
+ cg.add(var.set_with_dma(config[CONF_USE_DMA]))
157
+ if CONF_CLOCK_RESOLUTION in config:
158
+ cg.add(var.set_clock_resolution(config[CONF_CLOCK_RESOLUTION]))
159
+ if CONF_FILTER_SYMBOLS in config:
160
+ cg.add(var.set_filter_symbols(config[CONF_FILTER_SYMBOLS]))
121
161
  else:
122
- var = cg.new_Pvariable(config[CONF_ID], pin, config[CONF_MEMORY_BLOCKS])
123
- cg.add(var.set_clock_divider(config[CONF_CLOCK_DIVIDER]))
162
+ if (rmt_channel := config.get(CONF_RMT_CHANNEL, None)) is not None:
163
+ var = cg.new_Pvariable(
164
+ config[CONF_ID], pin, rmt_channel, config[CONF_MEMORY_BLOCKS]
165
+ )
166
+ else:
167
+ var = cg.new_Pvariable(config[CONF_ID], pin, config[CONF_MEMORY_BLOCKS])
168
+ cg.add(var.set_clock_divider(config[CONF_CLOCK_DIVIDER]))
124
169
  else:
125
170
  var = cg.new_Pvariable(config[CONF_ID], pin)
126
171
 
@@ -5,6 +5,10 @@
5
5
 
6
6
  #include <cinttypes>
7
7
 
8
+ #if defined(USE_ESP32) && ESP_IDF_VERSION_MAJOR >= 5
9
+ #include <driver/rmt_rx.h>
10
+ #endif
11
+
8
12
  namespace esphome {
9
13
  namespace remote_receiver {
10
14
 
@@ -25,6 +29,21 @@ struct RemoteReceiverComponentStore {
25
29
  uint32_t filter_us{10};
26
30
  ISRInternalGPIOPin pin;
27
31
  };
32
+ #elif defined(USE_ESP32) && ESP_IDF_VERSION_MAJOR >= 5
33
+ struct RemoteReceiverComponentStore {
34
+ /// Stores RMT symbols and rx done event data
35
+ volatile uint8_t *buffer{nullptr};
36
+ /// The position last written to
37
+ volatile uint32_t buffer_write{0};
38
+ /// The position last read from
39
+ volatile uint32_t buffer_read{0};
40
+ bool overflow{false};
41
+ uint32_t buffer_size{1000};
42
+ uint32_t receive_size{0};
43
+ uint32_t filter_symbols{0};
44
+ esp_err_t error{ESP_OK};
45
+ rmt_receive_config_t config;
46
+ };
28
47
  #endif
29
48
 
30
49
  class RemoteReceiverComponent : public remote_base::RemoteReceiverBase,
@@ -33,9 +52,10 @@ class RemoteReceiverComponent : public remote_base::RemoteReceiverBase,
33
52
  ,
34
53
  public remote_base::RemoteRMTChannel
35
54
  #endif
55
+
36
56
  {
37
57
  public:
38
- #ifdef USE_ESP32
58
+ #if defined(USE_ESP32) && ESP_IDF_VERSION_MAJOR < 5
39
59
  RemoteReceiverComponent(InternalGPIOPin *pin, uint8_t mem_block_num = 1)
40
60
  : RemoteReceiverBase(pin), remote_base::RemoteRMTChannel(mem_block_num) {}
41
61
 
@@ -49,19 +69,32 @@ class RemoteReceiverComponent : public remote_base::RemoteReceiverBase,
49
69
  void loop() override;
50
70
  float get_setup_priority() const override { return setup_priority::DATA; }
51
71
 
72
+ #if defined(USE_ESP32) && ESP_IDF_VERSION_MAJOR >= 5
73
+ void set_filter_symbols(uint32_t filter_symbols) { this->filter_symbols_ = filter_symbols; }
74
+ void set_receive_symbols(uint32_t receive_symbols) { this->receive_symbols_ = receive_symbols; }
75
+ void set_with_dma(bool with_dma) { this->with_dma_ = with_dma; }
76
+ #endif
52
77
  void set_buffer_size(uint32_t buffer_size) { this->buffer_size_ = buffer_size; }
53
78
  void set_filter_us(uint32_t filter_us) { this->filter_us_ = filter_us; }
54
79
  void set_idle_us(uint32_t idle_us) { this->idle_us_ = idle_us; }
55
80
 
56
81
  protected:
57
82
  #ifdef USE_ESP32
58
- void decode_rmt_(rmt_item32_t *item, size_t len);
83
+ #if ESP_IDF_VERSION_MAJOR >= 5
84
+ void decode_rmt_(rmt_symbol_word_t *item, size_t item_count);
85
+ rmt_channel_handle_t channel_{NULL};
86
+ uint32_t filter_symbols_{0};
87
+ uint32_t receive_symbols_{0};
88
+ bool with_dma_{false};
89
+ #else
90
+ void decode_rmt_(rmt_item32_t *item, size_t item_count);
59
91
  RingbufHandle_t ringbuf_;
92
+ #endif
60
93
  esp_err_t error_code_{ESP_OK};
61
94
  std::string error_string_{""};
62
95
  #endif
63
96
 
64
- #if defined(USE_ESP8266) || defined(USE_LIBRETINY)
97
+ #if defined(USE_ESP8266) || defined(USE_LIBRETINY) || (defined(USE_ESP32) && ESP_IDF_VERSION_MAJOR >= 5)
65
98
  RemoteReceiverComponentStore store_;
66
99
  HighFrequencyLoopRequester high_freq_;
67
100
  #endif