esphome 2024.12.4__py3-none-any.whl → 2025.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) 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/api/client.py +8 -3
  21. esphome/components/audio/__init__.py +112 -0
  22. esphome/components/audio/audio.cpp +67 -0
  23. esphome/components/audio/audio.h +125 -7
  24. esphome/components/audio/audio_decoder.cpp +361 -0
  25. esphome/components/audio/audio_decoder.h +135 -0
  26. esphome/components/audio/audio_reader.cpp +308 -0
  27. esphome/components/audio/audio_reader.h +85 -0
  28. esphome/components/audio/audio_resampler.cpp +159 -0
  29. esphome/components/audio/audio_resampler.h +101 -0
  30. esphome/components/audio/audio_transfer_buffer.cpp +165 -0
  31. esphome/components/audio/audio_transfer_buffer.h +139 -0
  32. esphome/components/audio_adc/__init__.py +41 -0
  33. esphome/components/audio_adc/audio_adc.h +17 -0
  34. esphome/components/audio_adc/automation.h +23 -0
  35. esphome/components/bk72xx/__init__.py +1 -0
  36. esphome/components/ble_client/ble_client.cpp +1 -2
  37. esphome/components/ble_client/sensor/__init__.py +1 -1
  38. esphome/components/ble_client/text_sensor/__init__.py +1 -1
  39. esphome/components/bluetooth_proxy/bluetooth_connection.cpp +5 -0
  40. esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -0
  41. esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
  42. esphome/components/ch422g/ch422g.h +2 -0
  43. esphome/components/climate/__init__.py +1 -1
  44. esphome/components/climate_ir/climate_ir.cpp +2 -1
  45. esphome/components/coolix/coolix.cpp +2 -1
  46. esphome/components/cse7766/cse7766.cpp +8 -16
  47. esphome/components/custom/__init__.py +0 -3
  48. esphome/components/custom/binary_sensor/__init__.py +2 -28
  49. esphome/components/custom/climate/__init__.py +2 -27
  50. esphome/components/custom/cover/__init__.py +2 -27
  51. esphome/components/custom/light/__init__.py +2 -27
  52. esphome/components/custom/output/__init__.py +2 -58
  53. esphome/components/custom/sensor/__init__.py +2 -24
  54. esphome/components/custom/switch/__init__.py +2 -24
  55. esphome/components/custom/text_sensor/__init__.py +2 -29
  56. esphome/components/custom_component/__init__.py +3 -27
  57. esphome/components/daly_bms/daly_bms.cpp +6 -0
  58. esphome/components/daly_bms/daly_bms.h +2 -0
  59. esphome/components/daly_bms/sensor.py +6 -0
  60. esphome/components/debug/debug_component.cpp +4 -0
  61. esphome/components/debug/debug_component.h +14 -0
  62. esphome/components/debug/debug_esp32.cpp +154 -74
  63. esphome/components/dfplayer/dfplayer.cpp +15 -2
  64. esphome/components/dfrobot_sen0395/dfrobot_sen0395.cpp +2 -1
  65. esphome/components/dht/dht.cpp +4 -2
  66. esphome/components/dht/sensor.py +1 -1
  67. esphome/components/display/__init__.py +18 -5
  68. esphome/components/display/display.cpp +16 -3
  69. esphome/components/display/rect.cpp +2 -1
  70. esphome/components/es7210/__init__.py +0 -0
  71. esphome/components/es7210/audio_adc.py +51 -0
  72. esphome/components/es7210/es7210.cpp +228 -0
  73. esphome/components/es7210/es7210.h +62 -0
  74. esphome/components/es7210/es7210_const.h +129 -0
  75. esphome/components/es7243e/__init__.py +0 -0
  76. esphome/components/es7243e/audio_adc.py +34 -0
  77. esphome/components/es7243e/es7243e.cpp +125 -0
  78. esphome/components/es7243e/es7243e.h +37 -0
  79. esphome/components/es7243e/es7243e_const.h +54 -0
  80. esphome/components/es8156/__init__.py +0 -0
  81. esphome/components/es8156/audio_dac.py +27 -0
  82. esphome/components/es8156/es8156.cpp +87 -0
  83. esphome/components/es8156/es8156.h +51 -0
  84. esphome/components/es8156/es8156_const.h +68 -0
  85. esphome/components/es8311/audio_dac.py +1 -2
  86. esphome/components/esp32/__init__.py +1 -0
  87. esphome/components/esp32/core.cpp +5 -1
  88. esphome/components/esp32/gpio.h +2 -0
  89. esphome/components/esp32_ble/__init__.py +39 -0
  90. esphome/components/esp32_ble/queue.h +4 -4
  91. esphome/components/esp32_ble_client/ble_client_base.cpp +46 -0
  92. esphome/components/esp32_ble_client/ble_client_base.h +2 -0
  93. esphome/components/esp32_ble_server/__init__.py +582 -12
  94. esphome/components/esp32_ble_server/ble_characteristic.cpp +48 -60
  95. esphome/components/esp32_ble_server/ble_characteristic.h +24 -17
  96. esphome/components/esp32_ble_server/ble_descriptor.cpp +21 -9
  97. esphome/components/esp32_ble_server/ble_descriptor.h +17 -6
  98. esphome/components/esp32_ble_server/ble_server.cpp +62 -67
  99. esphome/components/esp32_ble_server/ble_server.h +28 -32
  100. esphome/components/esp32_ble_server/ble_server_automations.cpp +77 -0
  101. esphome/components/esp32_ble_server/ble_server_automations.h +115 -0
  102. esphome/components/esp32_ble_server/ble_service.cpp +17 -15
  103. esphome/components/esp32_ble_server/ble_service.h +10 -14
  104. esphome/components/esp32_ble_tracker/__init__.py +6 -39
  105. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +33 -10
  106. esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +8 -4
  107. esphome/components/esp32_dac/esp32_dac.cpp +16 -7
  108. esphome/components/esp32_dac/esp32_dac.h +8 -0
  109. esphome/components/esp32_dac/output.py +16 -4
  110. esphome/components/esp32_improv/__init__.py +2 -8
  111. esphome/components/esp32_improv/esp32_improv_component.cpp +21 -20
  112. esphome/components/esp32_improv/esp32_improv_component.h +3 -4
  113. esphome/components/esp32_rmt/__init__.py +28 -3
  114. esphome/components/esp32_rmt_led_strip/led_strip.cpp +73 -6
  115. esphome/components/esp32_rmt_led_strip/led_strip.h +21 -3
  116. esphome/components/esp32_rmt_led_strip/light.py +72 -7
  117. esphome/components/esp32_touch/esp32_touch.cpp +5 -0
  118. esphome/components/esp8266/__init__.py +1 -0
  119. esphome/components/esp8266/gpio.h +1 -0
  120. esphome/components/ethernet/__init__.py +10 -10
  121. esphome/components/event/event.cpp +4 -2
  122. esphome/components/event/event.h +2 -0
  123. esphome/components/event_emitter/__init__.py +5 -0
  124. esphome/components/event_emitter/event_emitter.cpp +14 -0
  125. esphome/components/event_emitter/event_emitter.h +63 -0
  126. esphome/components/font/__init__.py +1 -1
  127. esphome/components/gcja5/gcja5.cpp +2 -1
  128. esphome/components/graph/graph.cpp +4 -9
  129. esphome/components/haier/haier_base.cpp +2 -1
  130. esphome/components/haier/hon_climate.cpp +2 -1
  131. esphome/components/heatpumpir/heatpumpir.cpp +2 -1
  132. esphome/components/host/__init__.py +1 -0
  133. esphome/components/host/gpio.h +1 -0
  134. esphome/components/http_request/http_request.h +2 -2
  135. esphome/components/http_request/http_request_arduino.cpp +1 -1
  136. esphome/components/http_request/http_request_idf.cpp +1 -1
  137. esphome/components/i2c/i2c_bus_esp_idf.cpp +4 -0
  138. esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +7 -5
  139. esphome/components/i2s_audio/speaker/__init__.py +53 -6
  140. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +92 -46
  141. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -0
  142. esphome/components/ili9xxx/display.py +29 -11
  143. esphome/components/ili9xxx/ili9xxx_display.cpp +2 -5
  144. esphome/components/ili9xxx/ili9xxx_display.h +2 -1
  145. esphome/components/image/__init__.py +443 -255
  146. esphome/components/image/image.cpp +115 -61
  147. esphome/components/image/image.h +15 -24
  148. esphome/components/json/json_util.cpp +8 -34
  149. esphome/components/libretiny/__init__.py +1 -0
  150. esphome/components/libretiny/gpio_arduino.h +1 -0
  151. esphome/components/light/light_color_values.h +1 -1
  152. esphome/components/logger/__init__.py +45 -9
  153. esphome/components/logger/logger.cpp +16 -14
  154. esphome/components/logger/logger.h +11 -7
  155. esphome/components/logger/select/__init__.py +29 -0
  156. esphome/components/logger/select/logger_level_select.cpp +27 -0
  157. esphome/components/logger/select/logger_level_select.h +15 -0
  158. esphome/components/lvgl/__init__.py +96 -73
  159. esphome/components/lvgl/automation.py +39 -7
  160. esphome/components/lvgl/defines.py +8 -2
  161. esphome/components/lvgl/lvgl_esphome.cpp +8 -15
  162. esphome/components/lvgl/lvgl_esphome.h +20 -5
  163. esphome/components/lvgl/schemas.py +25 -14
  164. esphome/components/lvgl/trigger.py +27 -3
  165. esphome/components/lvgl/widgets/dropdown.py +1 -1
  166. esphome/components/lvgl/widgets/keyboard.py +8 -1
  167. esphome/components/lvgl/widgets/meter.py +2 -1
  168. esphome/components/lvgl/widgets/msgbox.py +1 -1
  169. esphome/components/lvgl/widgets/obj.py +1 -12
  170. esphome/components/lvgl/widgets/page.py +37 -2
  171. esphome/components/lvgl/widgets/tabview.py +1 -1
  172. esphome/components/max6956/max6956.h +2 -0
  173. esphome/components/mcp23016/mcp23016.h +2 -0
  174. esphome/components/mcp23xxx_base/mcp23xxx_base.h +2 -0
  175. esphome/components/mdns/__init__.py +1 -1
  176. esphome/components/media_player/__init__.py +37 -8
  177. esphome/components/media_player/automation.h +11 -2
  178. esphome/components/media_player/media_player.cpp +8 -0
  179. esphome/components/media_player/media_player.h +8 -4
  180. esphome/components/micronova/switch/micronova_switch.cpp +4 -2
  181. esphome/components/midea/ac_automations.h +3 -1
  182. esphome/components/midea/air_conditioner.cpp +7 -5
  183. esphome/components/midea/air_conditioner.h +1 -1
  184. esphome/components/midea/climate.py +4 -2
  185. esphome/components/midea/ir_transmitter.h +36 -5
  186. esphome/components/mixer/__init__.py +0 -0
  187. esphome/components/mixer/speaker/__init__.py +172 -0
  188. esphome/components/mixer/speaker/automation.h +19 -0
  189. esphome/components/mixer/speaker/mixer_speaker.cpp +624 -0
  190. esphome/components/mixer/speaker/mixer_speaker.h +207 -0
  191. esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp +7 -13
  192. esphome/components/mpr121/mpr121.h +2 -0
  193. esphome/components/mqtt/__init__.py +1 -1
  194. esphome/components/mqtt/mqtt_client.cpp +7 -1
  195. esphome/components/mqtt/mqtt_client.h +1 -1
  196. esphome/components/mqtt/mqtt_climate.cpp +2 -2
  197. esphome/components/network/ip_address.h +2 -0
  198. esphome/components/nextion/automation.h +17 -0
  199. esphome/components/nextion/display.py +42 -17
  200. esphome/components/nextion/nextion.cpp +4 -10
  201. esphome/components/nextion/nextion.h +89 -82
  202. esphome/components/nextion/nextion_commands.cpp +10 -10
  203. esphome/components/ntc/sensor.py +2 -4
  204. esphome/components/online_image/__init__.py +98 -46
  205. esphome/components/online_image/bmp_image.cpp +101 -0
  206. esphome/components/online_image/bmp_image.h +40 -0
  207. esphome/components/online_image/image_decoder.cpp +31 -2
  208. esphome/components/online_image/image_decoder.h +24 -15
  209. esphome/components/online_image/jpeg_image.cpp +92 -0
  210. esphome/components/online_image/jpeg_image.h +34 -0
  211. esphome/components/online_image/online_image.cpp +118 -58
  212. esphome/components/online_image/online_image.h +39 -9
  213. esphome/components/online_image/png_image.cpp +7 -3
  214. esphome/components/online_image/png_image.h +2 -1
  215. esphome/components/opentherm/__init__.py +73 -7
  216. esphome/components/opentherm/automation.h +25 -0
  217. esphome/components/opentherm/const.py +1 -0
  218. esphome/components/opentherm/generate.py +39 -6
  219. esphome/components/opentherm/hub.cpp +117 -79
  220. esphome/components/opentherm/hub.h +31 -15
  221. esphome/components/opentherm/opentherm.cpp +47 -23
  222. esphome/components/opentherm/opentherm.h +27 -6
  223. esphome/components/opentherm/opentherm_macros.h +11 -0
  224. esphome/components/opentherm/schema.py +78 -1
  225. esphome/components/opentherm/validate.py +7 -2
  226. esphome/components/pca6416a/pca6416a.h +2 -0
  227. esphome/components/pca9554/pca9554.h +2 -0
  228. esphome/components/pcf8574/pcf8574.h +2 -0
  229. esphome/components/preferences/__init__.py +2 -4
  230. esphome/components/preferences/syncer.h +10 -3
  231. esphome/components/prometheus/prometheus_handler.cpp +313 -0
  232. esphome/components/prometheus/prometheus_handler.h +48 -7
  233. esphome/components/psram/psram.cpp +8 -1
  234. esphome/components/pulse_counter/pulse_counter_sensor.cpp +14 -9
  235. esphome/components/pulse_counter/pulse_counter_sensor.h +4 -4
  236. esphome/components/pulse_meter/pulse_meter_sensor.cpp +2 -0
  237. esphome/components/qspi_dbi/__init__.py +3 -0
  238. esphome/components/qspi_dbi/display.py +74 -47
  239. esphome/components/qspi_dbi/models.py +245 -2
  240. esphome/components/qspi_dbi/qspi_dbi.cpp +9 -16
  241. esphome/components/qspi_dbi/qspi_dbi.h +2 -2
  242. esphome/components/remote_base/__init__.py +77 -25
  243. esphome/components/remote_base/remote_base.cpp +1 -1
  244. esphome/components/remote_base/remote_base.h +20 -2
  245. esphome/components/remote_base/toto_protocol.cpp +100 -0
  246. esphome/components/remote_base/toto_protocol.h +45 -0
  247. esphome/components/remote_receiver/__init__.py +55 -10
  248. esphome/components/remote_receiver/remote_receiver.h +36 -3
  249. esphome/components/remote_receiver/remote_receiver_esp32.cpp +145 -6
  250. esphome/components/remote_transmitter/__init__.py +62 -4
  251. esphome/components/remote_transmitter/remote_transmitter.h +21 -2
  252. esphome/components/remote_transmitter/remote_transmitter_esp32.cpp +140 -4
  253. esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +3 -3
  254. esphome/components/remote_transmitter/remote_transmitter_libretiny.cpp +3 -3
  255. esphome/components/resampler/__init__.py +0 -0
  256. esphome/components/resampler/speaker/__init__.py +103 -0
  257. esphome/components/resampler/speaker/resampler_speaker.cpp +318 -0
  258. esphome/components/resampler/speaker/resampler_speaker.h +107 -0
  259. esphome/components/resistance/resistance_sensor.h +2 -3
  260. esphome/components/resistance/sensor.py +2 -9
  261. esphome/components/rotary_encoder/rotary_encoder.cpp +8 -4
  262. esphome/components/rp2040/__init__.py +1 -0
  263. esphome/components/rp2040/gpio.h +1 -0
  264. esphome/components/rtl87xx/__init__.py +2 -0
  265. esphome/components/scd30/sensor.py +1 -1
  266. esphome/components/sdl/binary_sensor.py +270 -0
  267. esphome/components/sdl/sdl_esphome.cpp +16 -0
  268. esphome/components/sdl/sdl_esphome.h +9 -0
  269. esphome/components/seeed_mr60bha2/binary_sensor.py +25 -0
  270. esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +26 -2
  271. esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +9 -20
  272. esphome/components/seeed_mr60bha2/sensor.py +9 -1
  273. esphome/components/sn74hc165/sn74hc165.h +3 -0
  274. esphome/components/sn74hc595/sn74hc595.h +3 -0
  275. esphome/components/speaker/__init__.py +5 -4
  276. esphome/components/speaker/media_player/__init__.py +458 -0
  277. esphome/components/speaker/media_player/audio_pipeline.cpp +568 -0
  278. esphome/components/speaker/media_player/audio_pipeline.h +159 -0
  279. esphome/components/speaker/media_player/automation.h +26 -0
  280. esphome/components/speaker/media_player/speaker_media_player.cpp +577 -0
  281. esphome/components/speaker/media_player/speaker_media_player.h +160 -0
  282. esphome/components/speaker/speaker.h +20 -0
  283. esphome/components/spi/__init__.py +1 -5
  284. esphome/components/spi/spi.cpp +7 -1
  285. esphome/components/spi/spi.h +21 -2
  286. esphome/components/spi_led_strip/light.py +3 -5
  287. esphome/components/spi_led_strip/spi_led_strip.cpp +67 -0
  288. esphome/components/spi_led_strip/spi_led_strip.h +8 -60
  289. esphome/components/sprinkler/sprinkler.cpp +3 -1
  290. esphome/components/sx1509/sx1509_gpio_pin.h +2 -0
  291. esphome/components/tca9555/tca9555.h +2 -0
  292. esphome/components/toshiba/toshiba.cpp +2 -1
  293. esphome/components/tuya/light/tuya_light.cpp +4 -2
  294. esphome/components/uart/uart_component_esp32_arduino.cpp +2 -2
  295. esphome/components/uart/uart_component_esp_idf.cpp +2 -2
  296. esphome/components/udp/__init__.py +8 -2
  297. esphome/components/udp/udp_component.cpp +25 -56
  298. esphome/components/udp/udp_component.h +3 -0
  299. esphome/components/uponor_smatrix/sensor/__init__.py +14 -4
  300. esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.cpp +5 -0
  301. esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.h +1 -0
  302. esphome/components/uptime/text_sensor/__init__.py +19 -0
  303. esphome/components/uptime/text_sensor/uptime_text_sensor.cpp +63 -0
  304. esphome/components/uptime/text_sensor/uptime_text_sensor.h +25 -0
  305. esphome/components/voice_assistant/voice_assistant.cpp +24 -14
  306. esphome/components/voice_assistant/voice_assistant.h +8 -0
  307. esphome/components/waveshare_epaper/display.py +22 -1
  308. esphome/components/waveshare_epaper/waveshare_213v3.cpp +9 -3
  309. esphome/components/waveshare_epaper/waveshare_epaper.cpp +1155 -44
  310. esphome/components/waveshare_epaper/waveshare_epaper.h +208 -7
  311. esphome/components/web_server/web_server.cpp +28 -6
  312. esphome/components/weikai/weikai.h +2 -0
  313. esphome/components/wifi/__init__.py +6 -6
  314. esphome/components/wifi/wifi_component.cpp +1 -1
  315. esphome/components/wifi/wifi_component_esp32_arduino.cpp +30 -1
  316. esphome/components/wireguard/__init__.py +2 -2
  317. esphome/components/xl9535/xl9535.h +2 -0
  318. esphome/components/xxtea/__init__.py +3 -0
  319. esphome/components/xxtea/xxtea.cpp +46 -0
  320. esphome/components/xxtea/xxtea.h +26 -0
  321. esphome/components/yashima/yashima.cpp +2 -1
  322. esphome/config.py +9 -5
  323. esphome/config_validation.py +55 -17
  324. esphome/const.py +7 -10
  325. esphome/core/__init__.py +6 -13
  326. esphome/core/base_automation.h +1 -0
  327. esphome/core/config.py +59 -72
  328. esphome/core/defines.h +9 -1
  329. esphome/core/gpio.h +7 -0
  330. esphome/core/helpers.cpp +19 -15
  331. esphome/core/helpers.h +57 -8
  332. esphome/core/log.h +9 -7
  333. esphome/cpp_generator.py +2 -2
  334. esphome/dashboard/web_server.py +1 -1
  335. esphome/espota2.py +3 -2
  336. esphome/loader.py +12 -4
  337. esphome/log.py +5 -7
  338. esphome/yaml_util.py +2 -2
  339. {esphome-2024.12.4.dist-info → esphome-2025.2.0.dist-info}/METADATA +14 -9
  340. {esphome-2024.12.4.dist-info → esphome-2025.2.0.dist-info}/RECORD +349 -300
  341. esphome/components/custom/binary_sensor/custom_binary_sensor.cpp +0 -16
  342. esphome/components/custom/binary_sensor/custom_binary_sensor.h +0 -26
  343. esphome/components/custom/climate/custom_climate.h +0 -22
  344. esphome/components/custom/cover/custom_cover.h +0 -21
  345. esphome/components/custom/light/custom_light_output.h +0 -24
  346. esphome/components/custom/output/custom_output.h +0 -37
  347. esphome/components/custom/sensor/custom_sensor.cpp +0 -16
  348. esphome/components/custom/sensor/custom_sensor.h +0 -24
  349. esphome/components/custom/switch/custom_switch.cpp +0 -16
  350. esphome/components/custom/switch/custom_switch.h +0 -24
  351. esphome/components/custom/text_sensor/custom_text_sensor.cpp +0 -16
  352. esphome/components/custom/text_sensor/custom_text_sensor.h +0 -26
  353. esphome/components/custom_component/custom_component.h +0 -28
  354. esphome/components/esp32_ble_server/ble_2901.cpp +0 -18
  355. esphome/components/esp32_ble_server/ble_2901.h +0 -19
  356. esphome/components/resistance_sampler/__init__.py +0 -6
  357. esphome/components/resistance_sampler/resistance_sampler.h +0 -10
  358. esphome/components/uptime/{sensor.py → sensor/__init__.py} +3 -3
  359. /esphome/components/uptime/{uptime_seconds_sensor.cpp → sensor/uptime_seconds_sensor.cpp} +0 -0
  360. /esphome/components/uptime/{uptime_seconds_sensor.h → sensor/uptime_seconds_sensor.h} +0 -0
  361. /esphome/components/uptime/{uptime_timestamp_sensor.cpp → sensor/uptime_timestamp_sensor.cpp} +0 -0
  362. /esphome/components/uptime/{uptime_timestamp_sensor.h → sensor/uptime_timestamp_sensor.h} +0 -0
  363. {esphome-2024.12.4.dist-info → esphome-2025.2.0.dist-info}/LICENSE +0 -0
  364. {esphome-2024.12.4.dist-info → esphome-2025.2.0.dist-info}/WHEEL +0 -0
  365. {esphome-2024.12.4.dist-info → esphome-2025.2.0.dist-info}/entry_points.txt +0 -0
  366. {esphome-2024.12.4.dist-info → esphome-2025.2.0.dist-info}/top_level.txt +0 -0
@@ -3,6 +3,7 @@
3
3
  from contextlib import contextmanager
4
4
  from dataclasses import dataclass
5
5
  from datetime import datetime
6
+ from ipaddress import AddressValueError, IPv4Address, ip_address
6
7
  import logging
7
8
  import os
8
9
  import re
@@ -67,7 +68,6 @@ from esphome.const import (
67
68
  from esphome.core import (
68
69
  CORE,
69
70
  HexInt,
70
- IPAddress,
71
71
  Lambda,
72
72
  TimePeriod,
73
73
  TimePeriodMicroseconds,
@@ -1130,7 +1130,7 @@ def domain(value):
1130
1130
  if re.match(vol.DOMAIN_REGEX, value) is not None:
1131
1131
  return value
1132
1132
  try:
1133
- return str(ipv4(value))
1133
+ return str(ipaddress(value))
1134
1134
  except Invalid as err:
1135
1135
  raise Invalid(f"Invalid domain: {value}") from err
1136
1136
 
@@ -1160,21 +1160,29 @@ def ssid(value):
1160
1160
  return value
1161
1161
 
1162
1162
 
1163
- def ipv4(value):
1164
- if isinstance(value, list):
1165
- parts = value
1166
- elif isinstance(value, str):
1167
- parts = value.split(".")
1168
- elif isinstance(value, IPAddress):
1169
- return value
1170
- else:
1171
- raise Invalid("IPv4 address must consist of either string or integer list")
1172
- if len(parts) != 4:
1173
- raise Invalid("IPv4 address must consist of four point-separated integers")
1174
- parts_ = list(map(int, parts))
1175
- if not all(0 <= x < 256 for x in parts_):
1176
- raise Invalid("IPv4 address parts must be in range from 0 to 255")
1177
- return IPAddress(*parts_)
1163
+ def ipv4address(value):
1164
+ try:
1165
+ address = IPv4Address(value)
1166
+ except AddressValueError as exc:
1167
+ raise Invalid(f"{value} is not a valid IPv4 address") from exc
1168
+ return address
1169
+
1170
+
1171
+ def ipv4address_multi_broadcast(value):
1172
+ address = ipv4address(value)
1173
+ if not (address.is_multicast or (address == IPv4Address("255.255.255.255"))):
1174
+ raise Invalid(
1175
+ f"{value} is not a multicasst address nor local broadcast address"
1176
+ )
1177
+ return address
1178
+
1179
+
1180
+ def ipaddress(value):
1181
+ try:
1182
+ address = ip_address(value)
1183
+ except ValueError as exc:
1184
+ raise Invalid(f"{value} is not a valid IP address") from exc
1185
+ return address
1178
1186
 
1179
1187
 
1180
1188
  def _valid_topic(value):
@@ -1660,6 +1668,12 @@ class SplitDefault(Optional):
1660
1668
  esp32_c3=vol.UNDEFINED,
1661
1669
  esp32_c3_arduino=vol.UNDEFINED,
1662
1670
  esp32_c3_idf=vol.UNDEFINED,
1671
+ esp32_c6=vol.UNDEFINED,
1672
+ esp32_c6_arduino=vol.UNDEFINED,
1673
+ esp32_c6_idf=vol.UNDEFINED,
1674
+ esp32_h2=vol.UNDEFINED,
1675
+ esp32_h2_arduino=vol.UNDEFINED,
1676
+ esp32_h2_idf=vol.UNDEFINED,
1663
1677
  rp2040=vol.UNDEFINED,
1664
1678
  bk72xx=vol.UNDEFINED,
1665
1679
  rtl87xx=vol.UNDEFINED,
@@ -1691,6 +1705,18 @@ class SplitDefault(Optional):
1691
1705
  self._esp32_c3_idf_default = vol.default_factory(
1692
1706
  _get_priority_default(esp32_c3_idf, esp32_c3, esp32_idf, esp32)
1693
1707
  )
1708
+ self._esp32_c6_arduino_default = vol.default_factory(
1709
+ _get_priority_default(esp32_c6_arduino, esp32_c6, esp32_arduino, esp32)
1710
+ )
1711
+ self._esp32_c6_idf_default = vol.default_factory(
1712
+ _get_priority_default(esp32_c6_idf, esp32_c6, esp32_idf, esp32)
1713
+ )
1714
+ self._esp32_h2_arduino_default = vol.default_factory(
1715
+ _get_priority_default(esp32_h2_arduino, esp32_h2, esp32_arduino, esp32)
1716
+ )
1717
+ self._esp32_h2_idf_default = vol.default_factory(
1718
+ _get_priority_default(esp32_h2_idf, esp32_h2, esp32_idf, esp32)
1719
+ )
1694
1720
  self._rp2040_default = vol.default_factory(rp2040)
1695
1721
  self._bk72xx_default = vol.default_factory(bk72xx)
1696
1722
  self._rtl87xx_default = vol.default_factory(rtl87xx)
@@ -1704,6 +1730,8 @@ class SplitDefault(Optional):
1704
1730
  from esphome.components.esp32 import get_esp32_variant
1705
1731
  from esphome.components.esp32.const import (
1706
1732
  VARIANT_ESP32C3,
1733
+ VARIANT_ESP32C6,
1734
+ VARIANT_ESP32H2,
1707
1735
  VARIANT_ESP32S2,
1708
1736
  VARIANT_ESP32S3,
1709
1737
  )
@@ -1724,6 +1752,16 @@ class SplitDefault(Optional):
1724
1752
  return self._esp32_c3_arduino_default
1725
1753
  if CORE.using_esp_idf:
1726
1754
  return self._esp32_c3_idf_default
1755
+ elif variant == VARIANT_ESP32C6:
1756
+ if CORE.using_arduino:
1757
+ return self._esp32_c6_arduino_default
1758
+ if CORE.using_esp_idf:
1759
+ return self._esp32_c6_idf_default
1760
+ elif variant == VARIANT_ESP32H2:
1761
+ if CORE.using_arduino:
1762
+ return self._esp32_h2_arduino_default
1763
+ if CORE.using_esp_idf:
1764
+ return self._esp32_h2_idf_default
1727
1765
  else:
1728
1766
  if CORE.using_arduino:
1729
1767
  return self._esp32_arduino_default
esphome/const.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Constants used by esphome."""
2
2
 
3
- __version__ = "2024.12.4"
3
+ __version__ = "2025.2.0"
4
4
 
5
5
  ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
6
6
  VALID_SUBSTITUTIONS_CHARACTERS = (
@@ -15,15 +15,6 @@ PLATFORM_LIBRETINY_OLDSTYLE = "libretiny"
15
15
  PLATFORM_RP2040 = "rp2040"
16
16
  PLATFORM_RTL87XX = "rtl87xx"
17
17
 
18
- TARGET_PLATFORMS = [
19
- PLATFORM_BK72XX,
20
- PLATFORM_ESP32,
21
- PLATFORM_ESP8266,
22
- PLATFORM_HOST,
23
- PLATFORM_LIBRETINY_OLDSTYLE,
24
- PLATFORM_RP2040,
25
- PLATFORM_RTL87XX,
26
- ]
27
18
 
28
19
  SOURCE_FILE_EXTENSIONS = {".cpp", ".hpp", ".h", ".c", ".tcc", ".ino"}
29
20
  HEADER_FILE_EXTENSIONS = {".h", ".hpp", ".tcc"}
@@ -103,6 +94,7 @@ CONF_BRIGHTNESS = "brightness"
103
94
  CONF_BRIGHTNESS_LIMITS = "brightness_limits"
104
95
  CONF_BROKER = "broker"
105
96
  CONF_BSSID = "bssid"
97
+ CONF_BUFFER_DURATION = "buffer_duration"
106
98
  CONF_BUFFER_SIZE = "buffer_size"
107
99
  CONF_BUILD_PATH = "build_path"
108
100
  CONF_BUS_VOLTAGE = "bus_voltage"
@@ -490,6 +482,7 @@ CONF_MEMORY_BLOCKS = "memory_blocks"
490
482
  CONF_MESSAGE = "message"
491
483
  CONF_METHANE = "methane"
492
484
  CONF_METHOD = "method"
485
+ CONF_MIC_GAIN = "mic_gain"
493
486
  CONF_MICROPHONE = "microphone"
494
487
  CONF_MIN_BRIGHTNESS = "min_brightness"
495
488
  CONF_MIN_COOLING_OFF_TIME = "min_cooling_off_time"
@@ -535,9 +528,11 @@ CONF_NAME_FONT = "name_font"
535
528
  CONF_NBITS = "nbits"
536
529
  CONF_NEC = "nec"
537
530
  CONF_NETWORKS = "networks"
531
+ CONF_NEVER = "never"
538
532
  CONF_NEW_PASSWORD = "new_password"
539
533
  CONF_NITROGEN_DIOXIDE = "nitrogen_dioxide"
540
534
  CONF_NOISE_LEVEL = "noise_level"
535
+ CONF_NOTIFY = "notify"
541
536
  CONF_NUM_ATTEMPTS = "num_attempts"
542
537
  CONF_NUM_CHANNELS = "num_channels"
543
538
  CONF_NUM_CHIPS = "num_chips"
@@ -622,6 +617,7 @@ CONF_OTA = "ota"
622
617
  CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature"
623
618
  CONF_OUTPUT = "output"
624
619
  CONF_OUTPUT_ID = "output_id"
620
+ CONF_OUTPUT_SPEAKER = "output_speaker"
625
621
  CONF_OUTPUTS = "outputs"
626
622
  CONF_OVERSAMPLING = "oversampling"
627
623
  CONF_PACKAGES = "packages"
@@ -866,6 +862,7 @@ CONF_TARGET_TEMPERATURE_LOW = "target_temperature_low"
866
862
  CONF_TARGET_TEMPERATURE_LOW_COMMAND_TOPIC = "target_temperature_low_command_topic"
867
863
  CONF_TARGET_TEMPERATURE_LOW_STATE_TOPIC = "target_temperature_low_state_topic"
868
864
  CONF_TARGET_TEMPERATURE_STATE_TOPIC = "target_temperature_state_topic"
865
+ CONF_TASK_STACK_IN_PSRAM = "task_stack_in_psram"
869
866
  CONF_TEMPERATURE = "temperature"
870
867
  CONF_TEMPERATURE_COMPENSATION = "temperature_compensation"
871
868
  CONF_TEMPERATURE_OFFSET = "temperature_offset"
esphome/core/__init__.py CHANGED
@@ -54,16 +54,6 @@ class HexInt(int):
54
54
  return f"{sign}0x{value:X}"
55
55
 
56
56
 
57
- class IPAddress:
58
- def __init__(self, *args):
59
- if len(args) != 4:
60
- raise ValueError("IPAddress must consist of 4 items")
61
- self.args = args
62
-
63
- def __str__(self):
64
- return ".".join(str(x) for x in self.args)
65
-
66
-
67
57
  class MACAddress:
68
58
  def __init__(self, *parts):
69
59
  if len(parts) != 6:
@@ -592,7 +582,7 @@ class EsphomeCore:
592
582
 
593
583
  @property
594
584
  def config_dir(self):
595
- return os.path.dirname(self.config_path)
585
+ return os.path.abspath(os.path.dirname(self.config_path))
596
586
 
597
587
  @property
598
588
  def data_dir(self):
@@ -699,7 +689,7 @@ class EsphomeCore:
699
689
  _LOGGER.debug("Adding: %s", expression)
700
690
  return expression
701
691
 
702
- def add_global(self, expression):
692
+ def add_global(self, expression, prepend=False):
703
693
  from esphome.cpp_generator import Expression, Statement, statement
704
694
 
705
695
  if isinstance(expression, Expression):
@@ -708,7 +698,10 @@ class EsphomeCore:
708
698
  raise ValueError(
709
699
  f"Add '{expression}' must be expression or statement, not {type(expression)}"
710
700
  )
711
- self.global_statements.append(expression)
701
+ if prepend:
702
+ self.global_statements.insert(0, expression)
703
+ else:
704
+ self.global_statements.append(expression)
712
705
  _LOGGER.debug("Adding global: %s", expression)
713
706
  return expression
714
707
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  #include "esphome/core/automation.h"
4
4
  #include "esphome/core/component.h"
5
+ #include "esphome/core/hal.h"
5
6
  #include "esphome/core/defines.h"
6
7
  #include "esphome/core/preferences.h"
7
8
 
esphome/core/config.py CHANGED
@@ -1,21 +1,17 @@
1
1
  import logging
2
2
  import multiprocessing
3
3
  import os
4
- import re
4
+ from pathlib import Path
5
5
 
6
6
  from esphome import automation
7
7
  import esphome.codegen as cg
8
8
  import esphome.config_validation as cv
9
9
  from esphome.const import (
10
- CONF_ARDUINO_VERSION,
11
10
  CONF_AREA,
12
- CONF_BOARD,
13
- CONF_BOARD_FLASH_MODE,
14
11
  CONF_BUILD_PATH,
15
12
  CONF_COMMENT,
16
13
  CONF_COMPILE_PROCESS_LIMIT,
17
14
  CONF_ESPHOME,
18
- CONF_FRAMEWORK,
19
15
  CONF_FRIENDLY_NAME,
20
16
  CONF_INCLUDES,
21
17
  CONF_LIBRARIES,
@@ -30,13 +26,9 @@ from esphome.const import (
30
26
  CONF_PLATFORMIO_OPTIONS,
31
27
  CONF_PRIORITY,
32
28
  CONF_PROJECT,
33
- CONF_SOURCE,
34
29
  CONF_TRIGGER_ID,
35
- CONF_TYPE,
36
30
  CONF_VERSION,
37
31
  KEY_CORE,
38
- PLATFORM_ESP8266,
39
- TARGET_PLATFORMS,
40
32
  __version__ as ESPHOME_VERSION,
41
33
  )
42
34
  from esphome.core import CORE, coroutine_with_priority
@@ -44,7 +36,6 @@ from esphome.helpers import copy_file_if_changed, get_str_env, walk_files
44
36
 
45
37
  _LOGGER = logging.getLogger(__name__)
46
38
 
47
- BUILD_FLASH_MODES = ["qio", "qout", "dio", "dout"]
48
39
  StartupTrigger = cg.esphome_ns.class_(
49
40
  "StartupTrigger", cg.Component, automation.Trigger.template()
50
41
  )
@@ -58,8 +49,6 @@ ProjectUpdateTrigger = cg.esphome_ns.class_(
58
49
  "ProjectUpdateTrigger", cg.Component, automation.Trigger.template(cg.std_string)
59
50
  )
60
51
 
61
- VERSION_REGEX = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+(?:[ab]\d+)?$")
62
-
63
52
 
64
53
  VALID_INCLUDE_EXTS = {".h", ".hpp", ".tcc", ".ino", ".cpp", ".c"}
65
54
 
@@ -83,6 +72,9 @@ def validate_hostname(config):
83
72
 
84
73
 
85
74
  def valid_include(value):
75
+ # Look for "<...>" includes
76
+ if value.startswith("<") and value.endswith(">"):
77
+ return value
86
78
  try:
87
79
  return cv.directory(value)
88
80
  except cv.Invalid:
@@ -111,7 +103,6 @@ else:
111
103
  _compile_process_limit_default = cv.UNDEFINED
112
104
 
113
105
 
114
- CONF_ESP8266_RESTORE_FROM_FLASH = "esp8266_restore_from_flash"
115
106
  CONFIG_SCHEMA = cv.All(
116
107
  cv.Schema(
117
108
  {
@@ -175,14 +166,9 @@ PRELOAD_CONFIG_SCHEMA = cv.Schema(
175
166
  {
176
167
  cv.Required(CONF_NAME): cv.valid_name,
177
168
  cv.Optional(CONF_BUILD_PATH): cv.string,
178
- # Compat options, these were moved to target-platform specific sections
179
- # but we'll keep these around for a long time because every config would
180
- # be impacted
181
- cv.Optional(CONF_PLATFORM): cv.one_of(*TARGET_PLATFORMS, lower=True),
182
- cv.Optional(CONF_BOARD): cv.string_strict,
183
- cv.Optional(CONF_ESP8266_RESTORE_FROM_FLASH): cv.valid,
184
- cv.Optional(CONF_BOARD_FLASH_MODE): cv.valid,
185
- cv.Optional(CONF_ARDUINO_VERSION): cv.valid,
169
+ cv.Optional(CONF_PLATFORM): cv.invalid(
170
+ "Please remove the `platform` key from the [esphome] block and use the correct platform component. This style of configuration has now been removed."
171
+ ),
186
172
  cv.Optional(CONF_MIN_VERSION, default=ESPHOME_VERSION): cv.All(
187
173
  cv.version_number, cv.validate_esphome_version
188
174
  ),
@@ -191,7 +177,31 @@ PRELOAD_CONFIG_SCHEMA = cv.Schema(
191
177
  )
192
178
 
193
179
 
194
- def preload_core_config(config, result):
180
+ def _is_target_platform(name):
181
+ from esphome.loader import get_component
182
+
183
+ try:
184
+ if get_component(name, True).is_target_platform:
185
+ return True
186
+ except KeyError:
187
+ pass
188
+ return False
189
+
190
+
191
+ def _list_target_platforms():
192
+ target_platforms = []
193
+ root = Path(__file__).parents[1]
194
+ for path in (root / "components").iterdir():
195
+ if not path.is_dir():
196
+ continue
197
+ if not (path / "__init__.py").is_file():
198
+ continue
199
+ if _is_target_platform(path.name):
200
+ target_platforms += [path.name]
201
+ return target_platforms
202
+
203
+
204
+ def preload_core_config(config, result) -> str:
195
205
  with cv.prepend_path(CONF_ESPHOME):
196
206
  conf = PRELOAD_CONFIG_SCHEMA(config[CONF_ESPHOME])
197
207
 
@@ -204,63 +214,28 @@ def preload_core_config(config, result):
204
214
  conf[CONF_BUILD_PATH] = os.path.join(build_path, CORE.name)
205
215
  CORE.build_path = CORE.relative_internal_path(conf[CONF_BUILD_PATH])
206
216
 
207
- has_oldstyle = CONF_PLATFORM in conf
208
- newstyle_found = [key for key in TARGET_PLATFORMS if key in config]
209
- oldstyle_opts = [
210
- CONF_ESP8266_RESTORE_FROM_FLASH,
211
- CONF_BOARD_FLASH_MODE,
212
- CONF_ARDUINO_VERSION,
213
- CONF_BOARD,
214
- ]
217
+ target_platforms = []
215
218
 
216
- if not has_oldstyle and not newstyle_found:
219
+ for domain, _ in config.items():
220
+ if domain.startswith("."):
221
+ continue
222
+ if _is_target_platform(domain):
223
+ target_platforms += [domain]
224
+
225
+ if not target_platforms:
217
226
  raise cv.Invalid(
218
227
  "Platform missing. You must include one of the available platform keys: "
219
- + ", ".join(TARGET_PLATFORMS),
228
+ + ", ".join(_list_target_platforms()),
220
229
  [CONF_ESPHOME],
221
230
  )
222
- if has_oldstyle and newstyle_found:
231
+ if len(target_platforms) > 1:
223
232
  raise cv.Invalid(
224
- f"Please remove the `platform` key from the [esphome] block. You're already using the new style with the [{conf[CONF_PLATFORM]}] block",
225
- [CONF_ESPHOME, CONF_PLATFORM],
233
+ f"Found multiple target platform blocks: {', '.join(target_platforms)}. Only one is allowed.",
234
+ [target_platforms[0]],
226
235
  )
227
- if len(newstyle_found) > 1:
228
- raise cv.Invalid(
229
- f"Found multiple target platform blocks: {', '.join(newstyle_found)}. Only one is allowed.",
230
- [newstyle_found[0]],
231
- )
232
- if newstyle_found:
233
- # Convert to newstyle
234
- for key in oldstyle_opts:
235
- if key in conf:
236
- raise cv.Invalid(
237
- f"Please move {key} to the [{newstyle_found[0]}] block.",
238
- [CONF_ESPHOME, key],
239
- )
240
-
241
- if has_oldstyle:
242
- plat = conf.pop(CONF_PLATFORM)
243
- plat_conf = {}
244
- if CONF_ESP8266_RESTORE_FROM_FLASH in conf:
245
- plat_conf["restore_from_flash"] = conf.pop(CONF_ESP8266_RESTORE_FROM_FLASH)
246
- if CONF_BOARD_FLASH_MODE in conf:
247
- plat_conf[CONF_BOARD_FLASH_MODE] = conf.pop(CONF_BOARD_FLASH_MODE)
248
- if CONF_ARDUINO_VERSION in conf:
249
- plat_conf[CONF_FRAMEWORK] = {}
250
- if plat != PLATFORM_ESP8266:
251
- plat_conf[CONF_FRAMEWORK][CONF_TYPE] = "arduino"
252
-
253
- try:
254
- if conf[CONF_ARDUINO_VERSION] not in ("recommended", "latest", "dev"):
255
- cv.Version.parse(conf[CONF_ARDUINO_VERSION])
256
- plat_conf[CONF_FRAMEWORK][CONF_VERSION] = conf.pop(CONF_ARDUINO_VERSION)
257
- except ValueError:
258
- plat_conf[CONF_FRAMEWORK][CONF_SOURCE] = conf.pop(CONF_ARDUINO_VERSION)
259
- if CONF_BOARD in conf:
260
- plat_conf[CONF_BOARD] = conf.pop(CONF_BOARD)
261
- # Insert generated target platform config to main config
262
- config[plat] = plat_conf
236
+
263
237
  config[CONF_ESPHOME] = conf
238
+ return target_platforms[0]
264
239
 
265
240
 
266
241
  def include_file(path, basename):
@@ -390,7 +365,19 @@ async def to_code(config):
390
365
  CORE.add_job(add_arduino_global_workaround)
391
366
 
392
367
  if config[CONF_INCLUDES]:
393
- CORE.add_job(add_includes, config[CONF_INCLUDES])
368
+ # Get the <...> includes
369
+ system_includes = []
370
+ other_includes = []
371
+ for include in config[CONF_INCLUDES]:
372
+ if include.startswith("<") and include.endswith(">"):
373
+ system_includes.append(include)
374
+ else:
375
+ other_includes.append(include)
376
+ # <...> includes should be at the start
377
+ for include in system_includes:
378
+ cg.add_global(cg.RawStatement(f"#include {include}"), prepend=True)
379
+ # Other includes should be at the end
380
+ CORE.add_job(add_includes, other_includes)
394
381
 
395
382
  if project_conf := config.get(CONF_PROJECT):
396
383
  cg.add_define("ESPHOME_PROJECT_NAME", project_conf[CONF_NAME])
esphome/core/defines.h CHANGED
@@ -14,8 +14,13 @@
14
14
  #define ESPHOME_PROJECT_VERSION_30 "v2"
15
15
  #define ESPHOME_VARIANT "ESP32"
16
16
 
17
+ // logger
18
+ #define ESPHOME_LOG_LEVEL ESPHOME_LOG_LEVEL_VERY_VERBOSE
19
+
17
20
  // Feature flags
18
21
  #define USE_ALARM_CONTROL_PANEL
22
+ #define USE_AUDIO_FLAC_SUPPORT
23
+ #define USE_AUDIO_MP3_SUPPORT
19
24
  #define USE_API
20
25
  #define USE_API_NOISE
21
26
  #define USE_API_PLAINTEXT
@@ -49,6 +54,7 @@
49
54
  #define USE_LVGL_IMAGE
50
55
  #define USE_LVGL_KEY_LISTENER
51
56
  #define USE_LVGL_KEYBOARD
57
+ #define USE_LVGL_METER
52
58
  #define USE_LVGL_ROLLER
53
59
  #define USE_LVGL_ROTARY_ENCODER
54
60
  #define USE_LVGL_TOUCHSCREEN
@@ -59,7 +65,9 @@
59
65
  #define USE_NETWORK
60
66
  #define USE_NEXTION_TFT_UPLOAD
61
67
  #define USE_NUMBER
68
+ #define USE_ONLINE_IMAGE_BMP_SUPPORT
62
69
  #define USE_ONLINE_IMAGE_PNG_SUPPORT
70
+ #define USE_ONLINE_IMAGE_JPEG_SUPPORT
63
71
  #define USE_OTA
64
72
  #define USE_OTA_PASSWORD
65
73
  #define USE_OTA_STATE_CALLBACK
@@ -119,7 +127,7 @@
119
127
  #endif
120
128
 
121
129
  #ifdef USE_ESP_IDF
122
- #define USE_ESP_IDF_VERSION_CODE VERSION_CODE(4, 4, 2)
130
+ #define USE_ESP_IDF_VERSION_CODE VERSION_CODE(5, 1, 5)
123
131
  #endif
124
132
 
125
133
  #if defined(USE_ESP32_VARIANT_ESP32S2)
esphome/core/gpio.h CHANGED
@@ -53,6 +53,13 @@ class GPIOPin {
53
53
 
54
54
  virtual void pin_mode(gpio::Flags flags) = 0;
55
55
 
56
+ /**
57
+ * @brief Retrieve GPIO pin flags.
58
+ *
59
+ * @return The GPIO flags describing the pin mode and properties.
60
+ */
61
+ virtual gpio::Flags get_flags() const = 0;
62
+
56
63
  virtual bool digital_read() = 0;
57
64
 
58
65
  virtual void digital_write(bool value) = 0;
esphome/core/helpers.cpp CHANGED
@@ -45,7 +45,9 @@
45
45
  #endif
46
46
  #ifdef USE_ESP32
47
47
  #include "esp32/rom/crc.h"
48
-
48
+ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 2)
49
+ #include "esp_mac.h"
50
+ #endif
49
51
  #include "esp_efuse.h"
50
52
  #include "esp_efuse_table.h"
51
53
  #endif
@@ -126,19 +128,21 @@ uint16_t crc16(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t reverse
126
128
  }
127
129
  } else
128
130
  #endif
129
- if (reverse_poly == 0xa001) {
130
- while (len--) {
131
- uint8_t combo = crc ^ (uint8_t) *data++;
132
- crc = (crc >> 8) ^ CRC16_A001_LE_LUT_L[combo & 0x0F] ^ CRC16_A001_LE_LUT_H[combo >> 4];
133
- }
134
- } else {
135
- while (len--) {
136
- crc ^= *data++;
137
- for (uint8_t i = 0; i < 8; i++) {
138
- if (crc & 0x0001) {
139
- crc = (crc >> 1) ^ reverse_poly;
140
- } else {
141
- crc >>= 1;
131
+ {
132
+ if (reverse_poly == 0xa001) {
133
+ while (len--) {
134
+ uint8_t combo = crc ^ (uint8_t) *data++;
135
+ crc = (crc >> 8) ^ CRC16_A001_LE_LUT_L[combo & 0x0F] ^ CRC16_A001_LE_LUT_H[combo >> 4];
136
+ }
137
+ } else {
138
+ while (len--) {
139
+ crc ^= *data++;
140
+ for (uint8_t i = 0; i < 8; i++) {
141
+ if (crc & 0x0001) {
142
+ crc = (crc >> 1) ^ reverse_poly;
143
+ } else {
144
+ crc >>= 1;
145
+ }
142
146
  }
143
147
  }
144
148
  }
@@ -259,7 +263,7 @@ bool random_bytes(uint8_t *data, size_t len) {
259
263
  bool str_equals_case_insensitive(const std::string &a, const std::string &b) {
260
264
  return strcasecmp(a.c_str(), b.c_str()) == 0;
261
265
  }
262
- #if ESP_IDF_VERSION_MAJOR >= 5
266
+ #if __cplusplus >= 202002L
263
267
  bool str_startswith(const std::string &str, const std::string &start) { return str.starts_with(start); }
264
268
  bool str_endswith(const std::string &str, const std::string &end) { return str.ends_with(end); }
265
269
  #else
esphome/core/helpers.h CHANGED
@@ -11,6 +11,14 @@
11
11
 
12
12
  #include "esphome/core/optional.h"
13
13
 
14
+ #ifdef USE_ESP8266
15
+ #include <Esp.h>
16
+ #endif
17
+
18
+ #ifdef USE_RP2040
19
+ #include <Arduino.h>
20
+ #endif
21
+
14
22
  #ifdef USE_ESP32
15
23
  #include <esp_heap_caps.h>
16
24
  #endif
@@ -155,7 +163,7 @@ template<typename T, typename U> T remap(U value, U min, U max, T min_out, T max
155
163
  return (value - min) * (max_out - min_out) / (max - min) + min_out;
156
164
  }
157
165
 
158
- /// Calculate a CRC-8 checksum of \p data with size \p len.
166
+ /// Calculate a CRC-8 checksum of \p data with size \p len using the CRC-8-Dallas/Maxim polynomial.
159
167
  uint8_t crc8(const uint8_t *data, uint8_t len);
160
168
 
161
169
  /// Calculate a CRC-16 checksum of \p data with size \p len.
@@ -684,20 +692,23 @@ template<class T> class RAMAllocator {
684
692
  };
685
693
 
686
694
  RAMAllocator() = default;
687
- RAMAllocator(uint8_t flags) : flags_{flags} {}
695
+ RAMAllocator(uint8_t flags) {
696
+ // default is both external and internal
697
+ flags &= ALLOC_INTERNAL | ALLOC_EXTERNAL;
698
+ if (flags != 0)
699
+ this->flags_ = flags;
700
+ }
688
701
  template<class U> constexpr RAMAllocator(const RAMAllocator<U> &other) : flags_{other.flags_} {}
689
702
 
690
703
  T *allocate(size_t n) {
691
704
  size_t size = n * sizeof(T);
692
705
  T *ptr = nullptr;
693
706
  #ifdef USE_ESP32
694
- // External allocation by default or if explicitely requested
695
- if ((this->flags_ & Flags::ALLOC_EXTERNAL) || ((this->flags_ & Flags::ALLOC_INTERNAL) == 0)) {
707
+ if (this->flags_ & Flags::ALLOC_EXTERNAL) {
696
708
  ptr = static_cast<T *>(heap_caps_malloc(size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));
697
709
  }
698
- // Fallback to internal allocation if explicitely requested or no flag is specified
699
- if (ptr == nullptr && ((this->flags_ & Flags::ALLOC_INTERNAL) || (this->flags_ & Flags::ALLOC_EXTERNAL) == 0)) {
700
- ptr = static_cast<T *>(malloc(size)); // NOLINT(cppcoreguidelines-owning-memory,cppcoreguidelines-no-malloc)
710
+ if (ptr == nullptr && this->flags_ & Flags::ALLOC_INTERNAL) {
711
+ ptr = static_cast<T *>(heap_caps_malloc(size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT));
701
712
  }
702
713
  #else
703
714
  // Ignore ALLOC_EXTERNAL/ALLOC_INTERNAL flags if external allocation is not supported
@@ -710,8 +721,46 @@ template<class T> class RAMAllocator {
710
721
  free(p); // NOLINT(cppcoreguidelines-owning-memory,cppcoreguidelines-no-malloc)
711
722
  }
712
723
 
724
+ /**
725
+ * Return the total heap space available via this allocator
726
+ */
727
+ size_t get_free_heap_size() const {
728
+ #ifdef USE_ESP8266
729
+ return ESP.getFreeHeap(); // NOLINT(readability-static-accessed-through-instance)
730
+ #elif defined(USE_ESP32)
731
+ auto max_internal =
732
+ this->flags_ & ALLOC_INTERNAL ? heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL) : 0;
733
+ auto max_external =
734
+ this->flags_ & ALLOC_EXTERNAL ? heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM) : 0;
735
+ return max_internal + max_external;
736
+ #elif defined(USE_RP2040)
737
+ return ::rp2040.getFreeHeap();
738
+ #elif defined(USE_LIBRETINY)
739
+ return lt_heap_get_free();
740
+ #else
741
+ return 100000;
742
+ #endif
743
+ }
744
+
745
+ /**
746
+ * Return the maximum size block this allocator could allocate. This may be an approximation on some platforms
747
+ */
748
+ size_t get_max_free_block_size() const {
749
+ #ifdef USE_ESP8266
750
+ return ESP.getMaxFreeBlockSize(); // NOLINT(readability-static-accessed-through-instance)
751
+ #elif defined(USE_ESP32)
752
+ auto max_internal =
753
+ this->flags_ & ALLOC_INTERNAL ? heap_caps_get_largest_free_block(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL) : 0;
754
+ auto max_external =
755
+ this->flags_ & ALLOC_EXTERNAL ? heap_caps_get_largest_free_block(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM) : 0;
756
+ return std::max(max_internal, max_external);
757
+ #else
758
+ return this->get_free_heap_size();
759
+ #endif
760
+ }
761
+
713
762
  private:
714
- uint8_t flags_{Flags::ALLOW_FAILURE};
763
+ uint8_t flags_{ALLOC_INTERNAL | ALLOC_EXTERNAL};
715
764
  };
716
765
 
717
766
  template<class T> using ExternalRAMAllocator = RAMAllocator<T>;