esphome 2025.8.3__py3-none-any.whl → 2025.9.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 (345) hide show
  1. esphome/__main__.py +36 -42
  2. esphome/components/absolute_humidity/absolute_humidity.cpp +3 -5
  3. esphome/components/adc/adc_sensor_esp32.cpp +29 -6
  4. esphome/components/ags10/ags10.cpp +3 -18
  5. esphome/components/ags10/ags10.h +2 -12
  6. esphome/components/aht10/aht10.cpp +3 -3
  7. esphome/components/airthings_ble/__init__.py +2 -2
  8. esphome/components/alarm_control_panel/__init__.py +2 -2
  9. esphome/components/am2315c/am2315c.cpp +1 -17
  10. esphome/components/am2315c/am2315c.h +2 -3
  11. esphome/components/api/__init__.py +2 -2
  12. esphome/components/api/api_connection.cpp +34 -23
  13. esphome/components/api/api_connection.h +20 -39
  14. esphome/components/api/api_frame_helper.cpp +25 -25
  15. esphome/components/api/api_frame_helper.h +3 -3
  16. esphome/components/api/api_frame_helper_noise.cpp +75 -40
  17. esphome/components/api/api_frame_helper_noise.h +3 -7
  18. esphome/components/api/api_frame_helper_plaintext.cpp +17 -4
  19. esphome/components/api/api_frame_helper_plaintext.h +1 -4
  20. esphome/components/api/api_pb2.cpp +20 -2
  21. esphome/components/api/api_pb2.h +146 -141
  22. esphome/components/api/api_pb2_dump.cpp +12 -1
  23. esphome/components/api/proto.cpp +33 -37
  24. esphome/components/async_tcp/__init__.py +2 -2
  25. esphome/components/atm90e26/sensor.py +2 -0
  26. esphome/components/atm90e32/sensor.py +4 -2
  27. esphome/components/audio_adc/__init__.py +2 -2
  28. esphome/components/audio_dac/__init__.py +2 -2
  29. esphome/components/axs15231/touchscreen/axs15231_touchscreen.cpp +1 -1
  30. esphome/components/bedjet/bedjet_hub.cpp +1 -1
  31. esphome/components/binary_sensor/__init__.py +2 -2
  32. esphome/components/binary_sensor/binary_sensor.cpp +13 -0
  33. esphome/components/binary_sensor/binary_sensor.h +4 -7
  34. esphome/components/bl0940/__init__.py +6 -1
  35. esphome/components/bl0940/bl0940.cpp +178 -41
  36. esphome/components/bl0940/bl0940.h +121 -76
  37. esphome/components/bl0940/button/__init__.py +27 -0
  38. esphome/components/bl0940/button/calibration_reset_button.cpp +20 -0
  39. esphome/components/bl0940/button/calibration_reset_button.h +19 -0
  40. esphome/components/bl0940/number/__init__.py +94 -0
  41. esphome/components/bl0940/number/calibration_number.cpp +29 -0
  42. esphome/components/bl0940/number/calibration_number.h +26 -0
  43. esphome/components/bl0940/sensor.py +151 -2
  44. esphome/components/bl0942/bl0942.cpp +1 -1
  45. esphome/components/ble_client/output/__init__.py +4 -4
  46. esphome/components/bluetooth_proxy/__init__.py +1 -1
  47. esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -1
  48. esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +15 -7
  49. esphome/components/bluetooth_proxy/bluetooth_proxy.h +3 -2
  50. esphome/components/button/__init__.py +2 -2
  51. esphome/components/button/button.cpp +13 -0
  52. esphome/components/button/button.h +4 -7
  53. esphome/components/camera/buffer.h +18 -0
  54. esphome/components/camera/buffer_impl.cpp +20 -0
  55. esphome/components/camera/buffer_impl.h +26 -0
  56. esphome/components/camera/camera.h +43 -0
  57. esphome/components/camera/encoder.h +69 -0
  58. esphome/components/camera_encoder/__init__.py +62 -0
  59. esphome/components/camera_encoder/encoder_buffer_impl.cpp +23 -0
  60. esphome/components/camera_encoder/encoder_buffer_impl.h +25 -0
  61. esphome/components/camera_encoder/esp32_camera_jpeg_encoder.cpp +82 -0
  62. esphome/components/camera_encoder/esp32_camera_jpeg_encoder.h +39 -0
  63. esphome/components/captive_portal/__init__.py +2 -2
  64. esphome/components/captive_portal/captive_portal.cpp +35 -12
  65. esphome/components/captive_portal/captive_portal.h +3 -3
  66. esphome/components/ccs811/ccs811.cpp +3 -3
  67. esphome/components/climate/__init__.py +2 -2
  68. esphome/components/climate/climate.cpp +1 -1
  69. esphome/components/cover/__init__.py +5 -5
  70. esphome/components/cover/cover.cpp +1 -1
  71. esphome/components/cover/cover.h +2 -2
  72. esphome/components/dallas_temp/dallas_temp.cpp +2 -2
  73. esphome/components/datetime/__init__.py +2 -2
  74. esphome/components/datetime/date_entity.h +2 -2
  75. esphome/components/datetime/datetime_entity.h +2 -2
  76. esphome/components/datetime/time_entity.h +2 -2
  77. esphome/components/debug/debug_esp32.cpp +1 -1
  78. esphome/components/display/__init__.py +4 -4
  79. esphome/components/duty_time/duty_time_sensor.cpp +1 -1
  80. esphome/components/esp32/__init__.py +0 -5
  81. esphome/components/esp32/gpio.cpp +27 -23
  82. esphome/components/esp32/gpio.h +26 -11
  83. esphome/components/esp32/preferences.cpp +8 -4
  84. esphome/components/esp32_ble/__init__.py +7 -2
  85. esphome/components/esp32_ble_client/ble_client_base.cpp +7 -3
  86. esphome/components/esp32_ble_tracker/__init__.py +2 -2
  87. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +9 -44
  88. esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +2 -14
  89. esphome/components/esp8266/__init__.py +2 -2
  90. esphome/components/esp8266/core.cpp +2 -2
  91. esphome/components/esp8266/gpio.py +4 -4
  92. esphome/components/esp8266/preferences.cpp +30 -28
  93. esphome/components/esphome/ota/__init__.py +2 -2
  94. esphome/components/esphome/ota/ota_esphome.cpp +21 -19
  95. esphome/components/esphome/ota/ota_esphome.h +6 -5
  96. esphome/components/ethernet/__init__.py +7 -2
  97. esphome/components/ethernet/ethernet_component.cpp +1 -1
  98. esphome/components/event/__init__.py +2 -2
  99. esphome/components/event/event.h +4 -4
  100. esphome/components/fan/__init__.py +2 -2
  101. esphome/components/fan/fan.cpp +2 -1
  102. esphome/components/gdk101/gdk101.cpp +4 -4
  103. esphome/components/globals/__init__.py +2 -2
  104. esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp +19 -18
  105. esphome/components/gpio_expander/cached_gpio.h +36 -16
  106. esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp +5 -5
  107. esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +1 -1
  108. esphome/components/haier/haier_base.cpp +1 -1
  109. esphome/components/haier/hon_climate.cpp +1 -1
  110. esphome/components/hlw8012/hlw8012.cpp +5 -5
  111. esphome/components/honeywellabp2_i2c/honeywellabp2.cpp +4 -4
  112. esphome/components/host/preferences.h +3 -2
  113. esphome/components/hte501/hte501.cpp +3 -21
  114. esphome/components/hte501/hte501.h +2 -3
  115. esphome/components/http_request/ota/__init__.py +2 -2
  116. esphome/components/i2c/__init__.py +2 -2
  117. esphome/components/i2c/i2c.cpp +13 -9
  118. esphome/components/i2c/i2c_bus.h +36 -6
  119. esphome/components/i2s_audio/__init__.py +8 -2
  120. esphome/components/i2s_audio/media_player/__init__.py +1 -1
  121. esphome/components/i2s_audio/microphone/__init__.py +1 -1
  122. esphome/components/i2s_audio/speaker/__init__.py +1 -1
  123. esphome/components/inkplate/__init__.py +1 -0
  124. esphome/components/inkplate/const.py +105 -0
  125. esphome/components/inkplate/display.py +238 -0
  126. esphome/components/{inkplate6 → inkplate}/inkplate.cpp +156 -74
  127. esphome/components/{inkplate6 → inkplate}/inkplate.h +28 -68
  128. esphome/components/inkplate6/__init__.py +0 -1
  129. esphome/components/inkplate6/display.py +2 -211
  130. esphome/components/integration/integration_sensor.cpp +1 -1
  131. esphome/components/json/__init__.py +2 -2
  132. esphome/components/kmeteriso/kmeteriso.cpp +1 -1
  133. esphome/components/lc709203f/lc709203f.cpp +4 -17
  134. esphome/components/lc709203f/lc709203f.h +2 -3
  135. esphome/components/ld2420/text_sensor/{text_sensor.cpp → ld2420_text_sensor.cpp} +1 -1
  136. esphome/components/ld2450/ld2450.cpp +1 -1
  137. esphome/components/libretiny/preferences.cpp +13 -5
  138. esphome/components/light/__init__.py +2 -2
  139. esphome/components/light/addressable_light_effect.h +7 -0
  140. esphome/components/light/base_light_effects.h +8 -0
  141. esphome/components/light/light_call.cpp +22 -20
  142. esphome/components/light/light_effect.cpp +36 -0
  143. esphome/components/light/light_effect.h +14 -0
  144. esphome/components/light/light_json_schema.cpp +9 -1
  145. esphome/components/light/light_state.cpp +2 -2
  146. esphome/components/light/light_state.h +39 -0
  147. esphome/components/lock/__init__.py +2 -2
  148. esphome/components/lock/lock.h +2 -2
  149. esphome/components/logger/__init__.py +2 -2
  150. esphome/components/logger/logger.cpp +25 -4
  151. esphome/components/logger/logger.h +1 -1
  152. esphome/components/logger/logger_esp32.cpp +16 -8
  153. esphome/components/logger/logger_esp8266.cpp +11 -3
  154. esphome/components/logger/logger_libretiny.cpp +13 -3
  155. esphome/components/logger/logger_rp2040.cpp +14 -3
  156. esphome/components/logger/logger_zephyr.cpp +15 -4
  157. esphome/components/lvgl/defines.py +1 -0
  158. esphome/components/lvgl/hello_world.py +96 -33
  159. esphome/components/lvgl/number/lvgl_number.h +1 -1
  160. esphome/components/lvgl/select/lvgl_select.h +1 -1
  161. esphome/components/lvgl/widgets/__init__.py +0 -1
  162. esphome/components/lvgl/widgets/spinbox.py +20 -11
  163. esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.cpp +1 -1
  164. esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.cpp +1 -1
  165. esphome/components/mapping/__init__.py +13 -5
  166. esphome/components/mapping/mapping.h +69 -0
  167. esphome/components/max17043/max17043.cpp +2 -2
  168. esphome/components/mcp23016/__init__.py +1 -0
  169. esphome/components/mcp23016/mcp23016.cpp +20 -5
  170. esphome/components/mcp23016/mcp23016.h +10 -4
  171. esphome/components/mcp23x08_base/mcp23x08_base.cpp +1 -1
  172. esphome/components/mcp23x17_base/mcp23x17_base.cpp +2 -2
  173. esphome/components/mdns/__init__.py +2 -2
  174. esphome/components/mdns/mdns_component.cpp +145 -54
  175. esphome/components/media_player/__init__.py +2 -2
  176. esphome/components/micro_wake_word/__init__.py +2 -2
  177. esphome/components/microphone/__init__.py +2 -2
  178. esphome/components/mipi/__init__.py +77 -33
  179. esphome/components/mipi_rgb/__init__.py +2 -0
  180. esphome/components/mipi_rgb/display.py +321 -0
  181. esphome/components/mipi_rgb/mipi_rgb.cpp +388 -0
  182. esphome/components/mipi_rgb/mipi_rgb.h +127 -0
  183. esphome/components/mipi_rgb/models/guition.py +24 -0
  184. esphome/components/mipi_rgb/models/lilygo.py +228 -0
  185. esphome/components/mipi_rgb/models/rpi.py +9 -0
  186. esphome/components/mipi_rgb/models/st7701s.py +214 -0
  187. esphome/components/mipi_rgb/models/waveshare.py +64 -0
  188. esphome/components/mipi_spi/models/jc.py +229 -0
  189. esphome/components/mlx90614/mlx90614.cpp +1 -16
  190. esphome/components/mlx90614/mlx90614.h +0 -1
  191. esphome/components/mqtt/__init__.py +2 -2
  192. esphome/components/mqtt/mqtt_sensor.cpp +7 -2
  193. esphome/components/ms5611/ms5611.cpp +7 -6
  194. esphome/components/network/__init__.py +2 -2
  195. esphome/components/nextion/nextion_upload.cpp +4 -1
  196. esphome/components/nrf52/__init__.py +49 -6
  197. esphome/components/nrf52/const.py +1 -0
  198. esphome/components/nrf52/dfu.cpp +51 -0
  199. esphome/components/nrf52/dfu.h +24 -0
  200. esphome/components/ntc/ntc.cpp +1 -1
  201. esphome/components/number/__init__.py +2 -2
  202. esphome/components/number/automation.cpp +1 -1
  203. esphome/components/number/number.cpp +21 -0
  204. esphome/components/number/number.h +4 -13
  205. esphome/components/opentherm/hub.h +6 -6
  206. esphome/components/opentherm/number/{number.cpp → opentherm_number.cpp} +2 -2
  207. esphome/components/opentherm/output/{output.cpp → opentherm_output.cpp} +1 -1
  208. esphome/components/opentherm/switch/{switch.cpp → opentherm_switch.cpp} +1 -1
  209. esphome/components/ota/__init__.py +2 -2
  210. esphome/components/pca6416a/__init__.py +1 -0
  211. esphome/components/pca6416a/pca6416a.cpp +20 -5
  212. esphome/components/pca6416a/pca6416a.h +12 -5
  213. esphome/components/pca9554/__init__.py +2 -1
  214. esphome/components/pca9554/pca9554.cpp +12 -18
  215. esphome/components/pca9554/pca9554.h +10 -9
  216. esphome/components/pcf8574/__init__.py +1 -0
  217. esphome/components/pcf8574/pcf8574.cpp +14 -5
  218. esphome/components/pcf8574/pcf8574.h +13 -6
  219. esphome/components/pi4ioe5v6408/pi4ioe5v6408.cpp +7 -7
  220. esphome/components/pipsolar/__init__.py +3 -3
  221. esphome/components/pipsolar/output/__init__.py +4 -4
  222. esphome/components/pulse_width/pulse_width.cpp +2 -2
  223. esphome/components/qmp6988/qmp6988.cpp +81 -126
  224. esphome/components/qmp6988/qmp6988.h +31 -37
  225. esphome/components/radon_eye_ble/__init__.py +2 -2
  226. esphome/components/remote_base/__init__.py +6 -8
  227. esphome/components/rotary_encoder/rotary_encoder.cpp +1 -1
  228. esphome/components/rp2040/__init__.py +2 -2
  229. esphome/components/runtime_stats/runtime_stats.cpp +10 -23
  230. esphome/components/runtime_stats/runtime_stats.h +4 -10
  231. esphome/components/safe_mode/__init__.py +2 -2
  232. esphome/components/safe_mode/safe_mode.cpp +33 -31
  233. esphome/components/script/script.cpp +6 -0
  234. esphome/components/script/script.h +19 -5
  235. esphome/components/sdm_meter/sensor.py +3 -1
  236. esphome/components/select/__init__.py +2 -2
  237. esphome/components/select/select.h +2 -2
  238. esphome/components/sen5x/sen5x.cpp +58 -55
  239. esphome/components/sen5x/sen5x.h +21 -15
  240. esphome/components/sen5x/sensor.py +67 -44
  241. esphome/components/sensirion_common/i2c_sensirion.cpp +18 -47
  242. esphome/components/sensirion_common/i2c_sensirion.h +39 -55
  243. esphome/components/sensor/__init__.py +2 -2
  244. esphome/components/sensor/automation.h +1 -1
  245. esphome/components/sensor/sensor.cpp +34 -6
  246. esphome/components/sensor/sensor.h +4 -21
  247. esphome/components/sgp30/sgp30.cpp +34 -35
  248. esphome/components/sgp30/sgp30.h +11 -10
  249. esphome/components/sgp4x/sgp4x.cpp +2 -2
  250. esphome/components/shelly_dimmer/light.py +7 -7
  251. esphome/components/sht4x/sht4x.cpp +1 -1
  252. esphome/components/sntp/sntp_component.cpp +36 -9
  253. esphome/components/sntp/sntp_component.h +7 -0
  254. esphome/components/sound_level/sound_level.cpp +1 -1
  255. esphome/components/speaker/__init__.py +2 -2
  256. esphome/components/speaker/media_player/__init__.py +2 -2
  257. esphome/components/speaker/media_player/speaker_media_player.cpp +1 -1
  258. esphome/components/spi/__init__.py +2 -2
  259. esphome/components/sprinkler/sprinkler.cpp +1 -1
  260. esphome/components/sps30/sps30.cpp +18 -23
  261. esphome/components/sps30/sps30.h +3 -3
  262. esphome/components/status_led/__init__.py +2 -2
  263. esphome/components/stepper/__init__.py +2 -2
  264. esphome/components/switch/__init__.py +2 -2
  265. esphome/components/switch/switch.cpp +5 -5
  266. esphome/components/sx1509/__init__.py +1 -1
  267. esphome/components/sx1509/sx1509.cpp +12 -7
  268. esphome/components/sx1509/sx1509.h +11 -4
  269. esphome/components/tca9555/tca9555.cpp +5 -5
  270. esphome/components/tee501/tee501.cpp +2 -21
  271. esphome/components/tee501/tee501.h +2 -4
  272. esphome/components/template/alarm_control_panel/template_alarm_control_panel.cpp +1 -1
  273. esphome/components/template/datetime/template_date.cpp +1 -1
  274. esphome/components/template/datetime/template_datetime.cpp +2 -2
  275. esphome/components/template/datetime/template_time.cpp +1 -1
  276. esphome/components/template/number/template_number.cpp +1 -1
  277. esphome/components/template/select/template_select.cpp +1 -1
  278. esphome/components/template/text/template_text.cpp +1 -1
  279. esphome/components/text/__init__.py +2 -2
  280. esphome/components/text/text.h +2 -2
  281. esphome/components/text_sensor/__init__.py +2 -2
  282. esphome/components/text_sensor/text_sensor.h +4 -4
  283. esphome/components/thermostat/climate.py +11 -7
  284. esphome/components/thermostat/thermostat_climate.cpp +237 -206
  285. esphome/components/thermostat/thermostat_climate.h +52 -41
  286. esphome/components/time/__init__.py +2 -2
  287. esphome/components/tmp1075/tmp1075.cpp +1 -1
  288. esphome/components/total_daily_energy/total_daily_energy.cpp +1 -1
  289. esphome/components/touchscreen/__init__.py +2 -2
  290. esphome/components/tuya/number/tuya_number.cpp +1 -1
  291. esphome/components/udp/udp_component.cpp +3 -3
  292. esphome/components/ufire_ec/ufire_ec.cpp +4 -4
  293. esphome/components/ufire_ise/ufire_ise.cpp +4 -4
  294. esphome/components/update/__init__.py +2 -2
  295. esphome/components/usb_uart/usb_uart.cpp +1 -1
  296. esphome/components/valve/__init__.py +5 -5
  297. esphome/components/valve/valve.cpp +1 -1
  298. esphome/components/valve/valve.h +2 -2
  299. esphome/components/wake_on_lan/wake_on_lan.cpp +2 -2
  300. esphome/components/waveshare_epaper/waveshare_213v3.cpp +1 -1
  301. esphome/components/web_server/__init__.py +2 -2
  302. esphome/components/web_server/ota/__init__.py +2 -2
  303. esphome/components/web_server/ota/ota_web_server.cpp +11 -0
  304. esphome/components/web_server/web_server.cpp +58 -12
  305. esphome/components/web_server_base/__init__.py +2 -2
  306. esphome/components/wifi/__init__.py +5 -5
  307. esphome/components/wifi/wifi_component.cpp +3 -3
  308. esphome/components/wifi/wifi_component_esp_idf.cpp +2 -0
  309. esphome/config_validation.py +2 -2
  310. esphome/const.py +2 -1
  311. esphome/core/__init__.py +1 -0
  312. esphome/core/application.cpp +89 -51
  313. esphome/core/application.h +1 -0
  314. esphome/core/component.cpp +41 -19
  315. esphome/core/component.h +17 -13
  316. esphome/core/config.py +7 -7
  317. esphome/core/defines.h +4 -0
  318. esphome/core/entity_base.cpp +22 -8
  319. esphome/core/entity_base.h +43 -0
  320. esphome/core/helpers.cpp +26 -13
  321. esphome/core/helpers.h +4 -3
  322. esphome/core/ring_buffer.cpp +6 -2
  323. esphome/core/ring_buffer.h +2 -1
  324. esphome/core/scheduler.cpp +175 -94
  325. esphome/core/scheduler.h +66 -35
  326. esphome/core/time.cpp +6 -20
  327. esphome/coroutine.py +80 -3
  328. esphome/cpp_generator.py +13 -0
  329. esphome/cpp_helpers.py +2 -2
  330. esphome/dashboard/web_server.py +67 -10
  331. esphome/espota2.py +13 -6
  332. esphome/helpers.py +68 -83
  333. esphome/resolver.py +67 -0
  334. esphome/util.py +9 -6
  335. esphome/wizard.py +39 -26
  336. {esphome-2025.8.3.dist-info → esphome-2025.9.0b1.dist-info}/METADATA +9 -9
  337. {esphome-2025.8.3.dist-info → esphome-2025.9.0b1.dist-info}/RECORD +345 -314
  338. /esphome/components/ld2420/text_sensor/{text_sensor.h → ld2420_text_sensor.h} +0 -0
  339. /esphome/components/opentherm/number/{number.h → opentherm_number.h} +0 -0
  340. /esphome/components/opentherm/output/{output.h → opentherm_output.h} +0 -0
  341. /esphome/components/opentherm/switch/{switch.h → opentherm_switch.h} +0 -0
  342. {esphome-2025.8.3.dist-info → esphome-2025.9.0b1.dist-info}/WHEEL +0 -0
  343. {esphome-2025.8.3.dist-info → esphome-2025.9.0b1.dist-info}/entry_points.txt +0 -0
  344. {esphome-2025.8.3.dist-info → esphome-2025.9.0b1.dist-info}/licenses/LICENSE +0 -0
  345. {esphome-2025.8.3.dist-info → esphome-2025.9.0b1.dist-info}/top_level.txt +0 -0
@@ -8,7 +8,7 @@ from esphome.const import (
8
8
  CONF_TYPE,
9
9
  CONF_VALUE,
10
10
  )
11
- from esphome.core import coroutine_with_priority
11
+ from esphome.core import CoroPriority, coroutine_with_priority
12
12
 
13
13
  CODEOWNERS = ["@esphome/core"]
14
14
  globals_ns = cg.esphome_ns.namespace("globals")
@@ -35,7 +35,7 @@ CONFIG_SCHEMA = cv.Schema(
35
35
 
36
36
 
37
37
  # Run with low priority so that namespaces are registered first
38
- @coroutine_with_priority(-100.0)
38
+ @coroutine_with_priority(CoroPriority.LATE)
39
39
  async def to_code(config):
40
40
  type_ = cg.RawExpression(config[CONF_TYPE])
41
41
  restore = config[CONF_RESTORE_VALUE]
@@ -6,6 +6,23 @@ namespace gpio {
6
6
 
7
7
  static const char *const TAG = "gpio.binary_sensor";
8
8
 
9
+ static const LogString *interrupt_type_to_string(gpio::InterruptType type) {
10
+ switch (type) {
11
+ case gpio::INTERRUPT_RISING_EDGE:
12
+ return LOG_STR("RISING_EDGE");
13
+ case gpio::INTERRUPT_FALLING_EDGE:
14
+ return LOG_STR("FALLING_EDGE");
15
+ case gpio::INTERRUPT_ANY_EDGE:
16
+ return LOG_STR("ANY_EDGE");
17
+ default:
18
+ return LOG_STR("UNKNOWN");
19
+ }
20
+ }
21
+
22
+ static const LogString *gpio_mode_to_string(bool use_interrupt) {
23
+ return use_interrupt ? LOG_STR("interrupt") : LOG_STR("polling");
24
+ }
25
+
9
26
  void IRAM_ATTR GPIOBinarySensorStore::gpio_intr(GPIOBinarySensorStore *arg) {
10
27
  bool new_state = arg->isr_pin_.digital_read();
11
28
  if (new_state != arg->last_state_) {
@@ -51,25 +68,9 @@ void GPIOBinarySensor::setup() {
51
68
  void GPIOBinarySensor::dump_config() {
52
69
  LOG_BINARY_SENSOR("", "GPIO Binary Sensor", this);
53
70
  LOG_PIN(" Pin: ", this->pin_);
54
- const char *mode = this->use_interrupt_ ? "interrupt" : "polling";
55
- ESP_LOGCONFIG(TAG, " Mode: %s", mode);
71
+ ESP_LOGCONFIG(TAG, " Mode: %s", LOG_STR_ARG(gpio_mode_to_string(this->use_interrupt_)));
56
72
  if (this->use_interrupt_) {
57
- const char *interrupt_type;
58
- switch (this->interrupt_type_) {
59
- case gpio::INTERRUPT_RISING_EDGE:
60
- interrupt_type = "RISING_EDGE";
61
- break;
62
- case gpio::INTERRUPT_FALLING_EDGE:
63
- interrupt_type = "FALLING_EDGE";
64
- break;
65
- case gpio::INTERRUPT_ANY_EDGE:
66
- interrupt_type = "ANY_EDGE";
67
- break;
68
- default:
69
- interrupt_type = "UNKNOWN";
70
- break;
71
- }
72
- ESP_LOGCONFIG(TAG, " Interrupt Type: %s", interrupt_type);
73
+ ESP_LOGCONFIG(TAG, " Interrupt Type: %s", LOG_STR_ARG(interrupt_type_to_string(this->interrupt_type_)));
73
74
  }
74
75
  }
75
76
 
@@ -4,6 +4,7 @@
4
4
  #include <cstdint>
5
5
  #include <cstring>
6
6
  #include <limits>
7
+ #include <type_traits>
7
8
  #include "esphome/core/hal.h"
8
9
 
9
10
  namespace esphome::gpio_expander {
@@ -11,18 +12,27 @@ namespace esphome::gpio_expander {
11
12
  /// @brief A class to cache the read state of a GPIO expander.
12
13
  /// This class caches reads between GPIO Pins which are on the same bank.
13
14
  /// This means that for reading whole Port (ex. 8 pins) component needs only one
14
- /// I2C/SPI read per main loop call. It assumes, that one bit in byte identifies one GPIO pin
15
+ /// I2C/SPI read per main loop call. It assumes that one bit in byte identifies one GPIO pin.
16
+ ///
15
17
  /// Template parameters:
16
- /// T - Type which represents internal register. Could be uint8_t or uint16_t. Adjust to
17
- /// match size of your internal GPIO bank register.
18
- /// N - Number of pins
19
- template<typename T, T N> class CachedGpioExpander {
18
+ /// T - Type which represents internal bank register. Could be uint8_t or uint16_t.
19
+ /// Choose based on how your I/O expander reads pins:
20
+ /// * uint8_t: For chips that read banks separately (8 pins at a time)
21
+ /// Examples: MCP23017 (2x8-bit banks), TCA9555 (2x8-bit banks)
22
+ /// * uint16_t: For chips that read all pins at once (up to 16 pins)
23
+ /// Examples: PCF8574/8575 (8/16 pins), PCA9554/9555 (8/16 pins)
24
+ /// N - Total number of pins (maximum 65535)
25
+ /// P - Type for pin number parameters (automatically selected based on N:
26
+ /// uint8_t for N<=256, uint16_t for N>256). Can be explicitly specified
27
+ /// if needed (e.g., for components like SN74HC165 with >256 pins)
28
+ template<typename T, uint16_t N, typename P = typename std::conditional<(N > 256), uint16_t, uint8_t>::type>
29
+ class CachedGpioExpander {
20
30
  public:
21
31
  /// @brief Read the state of the given pin. This will invalidate the cache for the given pin number.
22
32
  /// @param pin Pin number to read
23
33
  /// @return Pin state
24
- bool digital_read(T pin) {
25
- const uint8_t bank = pin / BANK_SIZE;
34
+ bool digital_read(P pin) {
35
+ const P bank = pin / BANK_SIZE;
26
36
  const T pin_mask = (1 << (pin % BANK_SIZE));
27
37
  // Check if specific pin cache is valid
28
38
  if (this->read_cache_valid_[bank] & pin_mask) {
@@ -38,21 +48,31 @@ template<typename T, T N> class CachedGpioExpander {
38
48
  return this->digital_read_cache(pin);
39
49
  }
40
50
 
41
- void digital_write(T pin, bool value) { this->digital_write_hw(pin, value); }
51
+ void digital_write(P pin, bool value) { this->digital_write_hw(pin, value); }
42
52
 
43
53
  protected:
44
- /// @brief Call component low level function to read GPIO state from device
45
- virtual bool digital_read_hw(T pin) = 0;
46
- /// @brief Call component read function from internal cache.
47
- virtual bool digital_read_cache(T pin) = 0;
48
- /// @brief Call component low level function to write GPIO state to device
49
- virtual void digital_write_hw(T pin, bool value) = 0;
54
+ /// @brief Read GPIO bank from hardware into internal state
55
+ /// @param pin Pin number (used to determine which bank to read)
56
+ /// @return true if read succeeded, false on communication error
57
+ /// @note This does NOT return the pin state. It returns whether the read operation succeeded.
58
+ /// The actual pin state should be returned by digital_read_cache().
59
+ virtual bool digital_read_hw(P pin) = 0;
60
+
61
+ /// @brief Get cached pin value from internal state
62
+ /// @param pin Pin number to read
63
+ /// @return Pin state (true = HIGH, false = LOW)
64
+ virtual bool digital_read_cache(P pin) = 0;
65
+
66
+ /// @brief Write GPIO state to hardware
67
+ /// @param pin Pin number to write
68
+ /// @param value Pin state to write (true = HIGH, false = LOW)
69
+ virtual void digital_write_hw(P pin, bool value) = 0;
50
70
 
51
71
  /// @brief Invalidate cache. This function should be called in component loop().
52
72
  void reset_pin_cache_() { memset(this->read_cache_valid_, 0x00, CACHE_SIZE_BYTES); }
53
73
 
54
- static constexpr uint8_t BITS_PER_BYTE = 8;
55
- static constexpr uint8_t BANK_SIZE = sizeof(T) * BITS_PER_BYTE;
74
+ static constexpr uint16_t BITS_PER_BYTE = 8;
75
+ static constexpr uint16_t BANK_SIZE = sizeof(T) * BITS_PER_BYTE;
56
76
  static constexpr size_t BANKS = N / BANK_SIZE;
57
77
  static constexpr size_t CACHE_SIZE_BYTES = BANKS * sizeof(T);
58
78
 
@@ -57,11 +57,11 @@ void GroveGasMultichannelV2Component::update() {
57
57
  void GroveGasMultichannelV2Component::dump_config() {
58
58
  ESP_LOGCONFIG(TAG, "Grove Multichannel Gas Sensor V2");
59
59
  LOG_I2C_DEVICE(this)
60
- LOG_UPDATE_INTERVAL(this)
61
- LOG_SENSOR(" ", "Nitrogen Dioxide", this->nitrogen_dioxide_sensor_)
62
- LOG_SENSOR(" ", "Ethanol", this->ethanol_sensor_)
63
- LOG_SENSOR(" ", "Carbon Monoxide", this->carbon_monoxide_sensor_)
64
- LOG_SENSOR(" ", "TVOC", this->tvoc_sensor_)
60
+ LOG_UPDATE_INTERVAL(this);
61
+ LOG_SENSOR(" ", "Nitrogen Dioxide", this->nitrogen_dioxide_sensor_);
62
+ LOG_SENSOR(" ", "Ethanol", this->ethanol_sensor_);
63
+ LOG_SENSOR(" ", "Carbon Monoxide", this->carbon_monoxide_sensor_);
64
+ LOG_SENSOR(" ", "TVOC", this->tvoc_sensor_);
65
65
 
66
66
  if (this->is_failed()) {
67
67
  switch (this->error_code_) {
@@ -20,7 +20,7 @@ static const size_t MAX_BUTTONS = 4; // max number of buttons scanned
20
20
 
21
21
  #define ERROR_CHECK(err) \
22
22
  if ((err) != i2c::ERROR_OK) { \
23
- this->status_set_warning(ESP_LOG_MSG_COMM_FAIL); \
23
+ this->status_set_warning(LOG_STR(ESP_LOG_MSG_COMM_FAIL)); \
24
24
  return; \
25
25
  }
26
26
 
@@ -351,7 +351,7 @@ ClimateTraits HaierClimateBase::traits() { return traits_; }
351
351
  void HaierClimateBase::initialization() {
352
352
  constexpr uint32_t restore_settings_version = 0xA77D21EF;
353
353
  this->base_rtc_ =
354
- global_preferences->make_preference<HaierBaseSettings>(this->get_object_id_hash() ^ restore_settings_version);
354
+ global_preferences->make_preference<HaierBaseSettings>(this->get_preference_hash() ^ restore_settings_version);
355
355
  HaierBaseSettings recovered;
356
356
  if (!this->base_rtc_.load(&recovered)) {
357
357
  recovered = {false, true};
@@ -516,7 +516,7 @@ void HonClimate::initialization() {
516
516
  HaierClimateBase::initialization();
517
517
  constexpr uint32_t restore_settings_version = 0x57EB59DDUL;
518
518
  this->hon_rtc_ =
519
- global_preferences->make_preference<HonSettings>(this->get_object_id_hash() ^ restore_settings_version);
519
+ global_preferences->make_preference<HonSettings>(this->get_preference_hash() ^ restore_settings_version);
520
520
  HonSettings recovered;
521
521
  if (this->hon_rtc_.load(&recovered)) {
522
522
  this->settings_ = recovered;
@@ -42,11 +42,11 @@ void HLW8012Component::dump_config() {
42
42
  " Current resistor: %.1f mΩ\n"
43
43
  " Voltage Divider: %.1f",
44
44
  this->change_mode_every_, this->current_resistor_ * 1000.0f, this->voltage_divider_);
45
- LOG_UPDATE_INTERVAL(this)
46
- LOG_SENSOR(" ", "Voltage", this->voltage_sensor_)
47
- LOG_SENSOR(" ", "Current", this->current_sensor_)
48
- LOG_SENSOR(" ", "Power", this->power_sensor_)
49
- LOG_SENSOR(" ", "Energy", this->energy_sensor_)
45
+ LOG_UPDATE_INTERVAL(this);
46
+ LOG_SENSOR(" ", "Voltage", this->voltage_sensor_);
47
+ LOG_SENSOR(" ", "Current", this->current_sensor_);
48
+ LOG_SENSOR(" ", "Power", this->power_sensor_);
49
+ LOG_SENSOR(" ", "Energy", this->energy_sensor_);
50
50
  }
51
51
  float HLW8012Component::get_setup_priority() const { return setup_priority::DATA; }
52
52
  void HLW8012Component::update() {
@@ -15,7 +15,7 @@ static const char *const TAG = "honeywellabp2";
15
15
  void HONEYWELLABP2Sensor::read_sensor_data() {
16
16
  if (this->read(raw_data_, 7) != i2c::ERROR_OK) {
17
17
  ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
18
- this->status_set_warning("couldn't read sensor data");
18
+ this->status_set_warning(LOG_STR("couldn't read sensor data"));
19
19
  return;
20
20
  }
21
21
  float press_counts = encode_uint24(raw_data_[1], raw_data_[2], raw_data_[3]); // calculate digital pressure counts
@@ -31,7 +31,7 @@ void HONEYWELLABP2Sensor::read_sensor_data() {
31
31
  void HONEYWELLABP2Sensor::start_measurement() {
32
32
  if (this->write(i2c_cmd_, 3) != i2c::ERROR_OK) {
33
33
  ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
34
- this->status_set_warning("couldn't start measurement");
34
+ this->status_set_warning(LOG_STR("couldn't start measurement"));
35
35
  return;
36
36
  }
37
37
  this->measurement_running_ = true;
@@ -40,7 +40,7 @@ void HONEYWELLABP2Sensor::start_measurement() {
40
40
  bool HONEYWELLABP2Sensor::is_measurement_ready() {
41
41
  if (this->read(raw_data_, 1) != i2c::ERROR_OK) {
42
42
  ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
43
- this->status_set_warning("couldn't check measurement");
43
+ this->status_set_warning(LOG_STR("couldn't check measurement"));
44
44
  return false;
45
45
  }
46
46
  if ((raw_data_[0] & (0x1 << STATUS_BIT_BUSY)) > 0) {
@@ -53,7 +53,7 @@ bool HONEYWELLABP2Sensor::is_measurement_ready() {
53
53
  void HONEYWELLABP2Sensor::measurement_timeout() {
54
54
  ESP_LOGE(TAG, "Timeout!");
55
55
  this->measurement_running_ = false;
56
- this->status_set_warning("measurement timed out");
56
+ this->status_set_warning(LOG_STR("measurement timed out"));
57
57
  }
58
58
 
59
59
  float HONEYWELLABP2Sensor::get_pressure() { return this->last_pressure_; }
@@ -42,9 +42,10 @@ class HostPreferences : public ESPPreferences {
42
42
  if (len > 255)
43
43
  return false;
44
44
  this->setup_();
45
- if (this->data.count(key) == 0)
45
+ auto it = this->data.find(key);
46
+ if (it == this->data.end())
46
47
  return false;
47
- auto vec = this->data[key];
48
+ const auto &vec = it->second;
48
49
  if (vec.size() != len)
49
50
  return false;
50
51
  memcpy(data, vec.data(), len);
@@ -11,7 +11,7 @@ void HTE501Component::setup() {
11
11
  uint8_t address[] = {0x70, 0x29};
12
12
  uint8_t identification[9];
13
13
  this->write_read(address, sizeof address, identification, sizeof identification);
14
- if (identification[8] != calc_crc8_(identification, 0, 7)) {
14
+ if (identification[8] != crc8(identification, 8, 0xFF, 0x31, true)) {
15
15
  this->error_code_ = CRC_CHECK_FAILED;
16
16
  this->mark_failed();
17
17
  return;
@@ -45,7 +45,8 @@ void HTE501Component::update() {
45
45
  this->set_timeout(50, [this]() {
46
46
  uint8_t i2c_response[6];
47
47
  this->read(i2c_response, 6);
48
- if (i2c_response[2] != calc_crc8_(i2c_response, 0, 1) && i2c_response[5] != calc_crc8_(i2c_response, 3, 4)) {
48
+ if (i2c_response[2] != crc8(i2c_response, 2, 0xFF, 0x31, true) &&
49
+ i2c_response[5] != crc8(i2c_response + 3, 2, 0xFF, 0x31, true)) {
49
50
  this->error_code_ = CRC_CHECK_FAILED;
50
51
  this->status_set_warning();
51
52
  return;
@@ -66,24 +67,5 @@ void HTE501Component::update() {
66
67
  this->status_clear_warning();
67
68
  });
68
69
  }
69
-
70
- unsigned char HTE501Component::calc_crc8_(const unsigned char buf[], unsigned char from, unsigned char to) {
71
- unsigned char crc_val = 0xFF;
72
- unsigned char i = 0;
73
- unsigned char j = 0;
74
- for (i = from; i <= to; i++) {
75
- int cur_val = buf[i];
76
- for (j = 0; j < 8; j++) {
77
- if (((crc_val ^ cur_val) & 0x80) != 0) // If MSBs are not equal
78
- {
79
- crc_val = ((crc_val << 1) ^ 0x31);
80
- } else {
81
- crc_val = (crc_val << 1);
82
- }
83
- cur_val = cur_val << 1;
84
- }
85
- }
86
- return crc_val;
87
- }
88
70
  } // namespace hte501
89
71
  } // namespace esphome
@@ -1,8 +1,8 @@
1
1
  #pragma once
2
2
 
3
- #include "esphome/core/component.h"
4
- #include "esphome/components/sensor/sensor.h"
5
3
  #include "esphome/components/i2c/i2c.h"
4
+ #include "esphome/components/sensor/sensor.h"
5
+ #include "esphome/core/component.h"
6
6
 
7
7
  namespace esphome {
8
8
  namespace hte501 {
@@ -19,7 +19,6 @@ class HTE501Component : public PollingComponent, public i2c::I2CDevice {
19
19
  void update() override;
20
20
 
21
21
  protected:
22
- unsigned char calc_crc8_(const unsigned char buf[], unsigned char from, unsigned char to);
23
22
  sensor::Sensor *temperature_sensor_;
24
23
  sensor::Sensor *humidity_sensor_;
25
24
 
@@ -3,7 +3,7 @@ import esphome.codegen as cg
3
3
  from esphome.components.ota import BASE_OTA_SCHEMA, OTAComponent, ota_to_code
4
4
  import esphome.config_validation as cv
5
5
  from esphome.const import CONF_ID, CONF_PASSWORD, CONF_URL, CONF_USERNAME
6
- from esphome.core import coroutine_with_priority
6
+ from esphome.core import CoroPriority, coroutine_with_priority
7
7
 
8
8
  from .. import CONF_HTTP_REQUEST_ID, HttpRequestComponent, http_request_ns
9
9
 
@@ -40,7 +40,7 @@ CONFIG_SCHEMA = cv.All(
40
40
  )
41
41
 
42
42
 
43
- @coroutine_with_priority(52.0)
43
+ @coroutine_with_priority(CoroPriority.COMMUNICATION)
44
44
  async def to_code(config):
45
45
  var = cg.new_Pvariable(config[CONF_ID])
46
46
  await ota_to_code(var, config)
@@ -18,7 +18,7 @@ from esphome.const import (
18
18
  PLATFORM_RP2040,
19
19
  PlatformFramework,
20
20
  )
21
- from esphome.core import CORE, coroutine_with_priority
21
+ from esphome.core import CORE, CoroPriority, coroutine_with_priority
22
22
  import esphome.final_validate as fv
23
23
 
24
24
  LOGGER = logging.getLogger(__name__)
@@ -74,7 +74,7 @@ CONFIG_SCHEMA = cv.All(
74
74
  )
75
75
 
76
76
 
77
- @coroutine_with_priority(1.0)
77
+ @coroutine_with_priority(CoroPriority.BUS)
78
78
  async def to_code(config):
79
79
  cg.add_global(i2c_ns.using)
80
80
  cg.add_define("USE_I2C")
@@ -39,18 +39,22 @@ ErrorCode I2CDevice::read_register16(uint16_t a_register, uint8_t *data, size_t
39
39
  }
40
40
 
41
41
  ErrorCode I2CDevice::write_register(uint8_t a_register, const uint8_t *data, size_t len) const {
42
- std::vector<uint8_t> v{};
43
- v.push_back(a_register);
44
- v.insert(v.end(), data, data + len);
45
- return bus_->write_readv(this->address_, v.data(), v.size(), nullptr, 0);
42
+ SmallBufferWithHeapFallback<17> buffer_alloc; // Most I2C writes are <= 16 bytes
43
+ uint8_t *buffer = buffer_alloc.get(len + 1);
44
+
45
+ buffer[0] = a_register;
46
+ std::copy(data, data + len, buffer + 1);
47
+ return this->bus_->write_readv(this->address_, buffer, len + 1, nullptr, 0);
46
48
  }
47
49
 
48
50
  ErrorCode I2CDevice::write_register16(uint16_t a_register, const uint8_t *data, size_t len) const {
49
- std::vector<uint8_t> v(len + 2);
50
- v[0] = a_register >> 8;
51
- v[1] = a_register;
52
- std::copy(data, data + len, v.begin() + 2);
53
- return bus_->write_readv(this->address_, v.data(), v.size(), nullptr, 0);
51
+ SmallBufferWithHeapFallback<18> buffer_alloc; // Most I2C writes are <= 16 bytes + 2 for register
52
+ uint8_t *buffer = buffer_alloc.get(len + 2);
53
+
54
+ buffer[0] = a_register >> 8;
55
+ buffer[1] = a_register;
56
+ std::copy(data, data + len, buffer + 2);
57
+ return this->bus_->write_readv(this->address_, buffer, len + 2, nullptr, 0);
54
58
  }
55
59
 
56
60
  bool I2CDevice::read_bytes_16(uint8_t a_register, uint16_t *data, uint8_t len) {
@@ -2,6 +2,7 @@
2
2
  #include <cstddef>
3
3
  #include <cstdint>
4
4
  #include <cstring>
5
+ #include <memory>
5
6
  #include <utility>
6
7
  #include <vector>
7
8
 
@@ -10,6 +11,22 @@
10
11
  namespace esphome {
11
12
  namespace i2c {
12
13
 
14
+ /// @brief Helper class for efficient buffer allocation - uses stack for small sizes, heap for large
15
+ template<size_t STACK_SIZE> class SmallBufferWithHeapFallback {
16
+ public:
17
+ uint8_t *get(size_t size) {
18
+ if (size <= STACK_SIZE) {
19
+ return this->stack_buffer_;
20
+ }
21
+ this->heap_buffer_ = std::unique_ptr<uint8_t[]>(new uint8_t[size]);
22
+ return this->heap_buffer_.get();
23
+ }
24
+
25
+ private:
26
+ uint8_t stack_buffer_[STACK_SIZE];
27
+ std::unique_ptr<uint8_t[]> heap_buffer_;
28
+ };
29
+
13
30
  /// @brief Error codes returned by I2CBus and I2CDevice methods
14
31
  enum ErrorCode {
15
32
  NO_ERROR = 0, ///< No error found during execution of method
@@ -74,14 +91,17 @@ class I2CBus {
74
91
  for (size_t i = 0; i != count; i++) {
75
92
  total_len += read_buffers[i].len;
76
93
  }
77
- std::vector<uint8_t> buffer(total_len);
78
- auto err = this->write_readv(address, nullptr, 0, buffer.data(), total_len);
94
+
95
+ SmallBufferWithHeapFallback<128> buffer_alloc; // Most I2C reads are small
96
+ uint8_t *buffer = buffer_alloc.get(total_len);
97
+
98
+ auto err = this->write_readv(address, nullptr, 0, buffer, total_len);
79
99
  if (err != ERROR_OK)
80
100
  return err;
81
101
  size_t pos = 0;
82
102
  for (size_t i = 0; i != count; i++) {
83
103
  if (read_buffers[i].len != 0) {
84
- std::memcpy(read_buffers[i].data, buffer.data() + pos, read_buffers[i].len);
104
+ std::memcpy(read_buffers[i].data, buffer + pos, read_buffers[i].len);
85
105
  pos += read_buffers[i].len;
86
106
  }
87
107
  }
@@ -91,11 +111,21 @@ class I2CBus {
91
111
  ESPDEPRECATED("This method is deprecated and will be removed in ESPHome 2026.3.0. Use write_readv() instead.",
92
112
  "2025.9.0")
93
113
  ErrorCode writev(uint8_t address, const WriteBuffer *write_buffers, size_t count, bool stop = true) {
94
- std::vector<uint8_t> buffer{};
114
+ size_t total_len = 0;
95
115
  for (size_t i = 0; i != count; i++) {
96
- buffer.insert(buffer.end(), write_buffers[i].data, write_buffers[i].data + write_buffers[i].len);
116
+ total_len += write_buffers[i].len;
97
117
  }
98
- return this->write_readv(address, buffer.data(), buffer.size(), nullptr, 0);
118
+
119
+ SmallBufferWithHeapFallback<128> buffer_alloc; // Most I2C writes are small
120
+ uint8_t *buffer = buffer_alloc.get(total_len);
121
+
122
+ size_t pos = 0;
123
+ for (size_t i = 0; i != count; i++) {
124
+ std::memcpy(buffer + pos, write_buffers[i].data, write_buffers[i].len);
125
+ pos += write_buffers[i].len;
126
+ }
127
+
128
+ return this->write_readv(address, buffer, total_len, nullptr, 0);
99
129
  }
100
130
 
101
131
  protected:
@@ -4,6 +4,9 @@ from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant
4
4
  from esphome.components.esp32.const import (
5
5
  VARIANT_ESP32,
6
6
  VARIANT_ESP32C3,
7
+ VARIANT_ESP32C5,
8
+ VARIANT_ESP32C6,
9
+ VARIANT_ESP32H2,
7
10
  VARIANT_ESP32P4,
8
11
  VARIANT_ESP32S2,
9
12
  VARIANT_ESP32S3,
@@ -62,12 +65,15 @@ I2S_ROLE_OPTIONS = {
62
65
  CONF_SECONDARY: i2s_role_t.I2S_ROLE_SLAVE, # NOLINT
63
66
  }
64
67
 
65
- # https://github.com/espressif/esp-idf/blob/master/components/soc/{variant}/include/soc/soc_caps.h
68
+ # https://github.com/espressif/esp-idf/blob/master/components/soc/{variant}/include/soc/soc_caps.h (SOC_I2S_NUM)
66
69
  I2S_PORTS = {
67
70
  VARIANT_ESP32: 2,
68
71
  VARIANT_ESP32S2: 1,
69
72
  VARIANT_ESP32S3: 2,
70
73
  VARIANT_ESP32C3: 1,
74
+ VARIANT_ESP32C5: 1,
75
+ VARIANT_ESP32C6: 1,
76
+ VARIANT_ESP32H2: 1,
71
77
  VARIANT_ESP32P4: 3,
72
78
  }
73
79
 
@@ -212,7 +218,7 @@ def validate_use_legacy(value):
212
218
  f"All i2s_audio components must set {CONF_USE_LEGACY} to the same value."
213
219
  )
214
220
  if (not value[CONF_USE_LEGACY]) and (CORE.using_arduino):
215
- raise cv.Invalid("Arduino supports only the legacy i2s driver.")
221
+ raise cv.Invalid("Arduino supports only the legacy i2s driver")
216
222
  _use_legacy_driver = value[CONF_USE_LEGACY]
217
223
  return value
218
224
 
@@ -92,7 +92,7 @@ CONFIG_SCHEMA = cv.All(
92
92
 
93
93
  def _final_validate(_):
94
94
  if not use_legacy():
95
- raise cv.Invalid("I2S media player is only compatible with legacy i2s driver.")
95
+ raise cv.Invalid("I2S media player is only compatible with legacy i2s driver")
96
96
 
97
97
 
98
98
  FINAL_VALIDATE_SCHEMA = _final_validate
@@ -122,7 +122,7 @@ CONFIG_SCHEMA = cv.All(
122
122
 
123
123
  def _final_validate(config):
124
124
  if not use_legacy() and config[CONF_ADC_TYPE] == "internal":
125
- raise cv.Invalid("Internal ADC is only compatible with legacy i2s driver.")
125
+ raise cv.Invalid("Internal ADC is only compatible with legacy i2s driver")
126
126
 
127
127
 
128
128
  FINAL_VALIDATE_SCHEMA = _final_validate
@@ -163,7 +163,7 @@ CONFIG_SCHEMA = cv.All(
163
163
  def _final_validate(config):
164
164
  if not use_legacy():
165
165
  if config[CONF_DAC_TYPE] == "internal":
166
- raise cv.Invalid("Internal DAC is only compatible with legacy i2s driver.")
166
+ raise cv.Invalid("Internal DAC is only compatible with legacy i2s driver")
167
167
  if config[CONF_I2S_COMM_FMT] == "stand_max":
168
168
  raise cv.Invalid(
169
169
  "I2S standard max format only implemented with legacy i2s driver."
@@ -0,0 +1 @@
1
+ CODEOWNERS = ["@jesserockz", "@JosipKuci"]
@@ -0,0 +1,105 @@
1
+ WAVEFORMS = {
2
+ "inkplate_6": (
3
+ (0, 1, 1, 0, 0, 1, 1, 0, 0),
4
+ (0, 1, 2, 1, 1, 2, 1, 0, 0),
5
+ (1, 1, 1, 2, 2, 1, 0, 0, 0),
6
+ (0, 0, 0, 1, 1, 1, 2, 0, 0),
7
+ (2, 1, 1, 1, 2, 1, 2, 0, 0),
8
+ (2, 2, 1, 1, 2, 1, 2, 0, 0),
9
+ (1, 1, 1, 2, 1, 2, 2, 0, 0),
10
+ (0, 0, 0, 0, 0, 0, 2, 0, 0),
11
+ ),
12
+ "inkplate_10": (
13
+ (0, 0, 0, 0, 0, 0, 0, 1, 0),
14
+ (0, 0, 0, 2, 2, 2, 1, 1, 0),
15
+ (0, 0, 2, 1, 1, 2, 2, 1, 0),
16
+ (0, 1, 2, 2, 1, 2, 2, 1, 0),
17
+ (0, 0, 2, 1, 2, 2, 2, 1, 0),
18
+ (0, 2, 2, 2, 2, 2, 2, 1, 0),
19
+ (0, 0, 0, 0, 0, 2, 1, 2, 0),
20
+ (0, 0, 0, 2, 2, 2, 2, 2, 0),
21
+ ),
22
+ "inkplate_6_plus": (
23
+ (0, 0, 0, 0, 0, 2, 1, 1, 0),
24
+ (0, 0, 2, 1, 1, 1, 2, 1, 0),
25
+ (0, 2, 2, 2, 1, 1, 2, 1, 0),
26
+ (0, 0, 2, 2, 2, 1, 2, 1, 0),
27
+ (0, 0, 0, 0, 2, 2, 2, 1, 0),
28
+ (0, 0, 2, 1, 2, 1, 1, 2, 0),
29
+ (0, 0, 2, 2, 2, 1, 1, 2, 0),
30
+ (0, 0, 0, 0, 2, 2, 2, 2, 0),
31
+ ),
32
+ "inkplate_6_v2": (
33
+ (1, 0, 1, 0, 1, 1, 1, 0, 0),
34
+ (0, 0, 0, 1, 1, 1, 1, 0, 0),
35
+ (1, 1, 1, 1, 0, 2, 1, 0, 0),
36
+ (1, 1, 1, 2, 2, 1, 1, 0, 0),
37
+ (1, 1, 1, 1, 2, 2, 1, 0, 0),
38
+ (0, 1, 1, 1, 2, 2, 1, 0, 0),
39
+ (0, 0, 0, 0, 1, 1, 2, 0, 0),
40
+ (0, 0, 0, 0, 0, 1, 2, 0, 0),
41
+ ),
42
+ "inkplate_5": (
43
+ (0, 0, 1, 1, 0, 1, 1, 1, 0),
44
+ (0, 1, 1, 1, 1, 2, 0, 1, 0),
45
+ (1, 2, 2, 0, 2, 1, 1, 1, 0),
46
+ (1, 1, 1, 2, 0, 1, 1, 2, 0),
47
+ (0, 1, 1, 1, 2, 0, 1, 2, 0),
48
+ (0, 0, 0, 1, 1, 2, 1, 2, 0),
49
+ (1, 1, 1, 2, 0, 2, 1, 2, 0),
50
+ (0, 0, 0, 0, 0, 0, 0, 0, 0),
51
+ ),
52
+ "inkplate_5_v2": (
53
+ (0, 0, 1, 1, 2, 1, 1, 1, 0),
54
+ (1, 1, 2, 2, 1, 2, 1, 1, 0),
55
+ (0, 1, 2, 2, 1, 1, 2, 1, 0),
56
+ (0, 0, 1, 1, 1, 1, 1, 2, 0),
57
+ (1, 2, 1, 2, 1, 1, 1, 2, 0),
58
+ (0, 1, 1, 1, 2, 0, 1, 2, 0),
59
+ (1, 1, 1, 2, 2, 2, 1, 2, 0),
60
+ (0, 0, 0, 0, 0, 0, 0, 0, 0),
61
+ ),
62
+ }
63
+
64
+ INKPLATE_10_CUSTOM_WAVEFORMS = (
65
+ (
66
+ (0, 0, 0, 0, 0, 0, 0, 0, 0),
67
+ (0, 0, 0, 2, 1, 2, 1, 1, 0),
68
+ (0, 0, 0, 2, 2, 1, 2, 1, 0),
69
+ (0, 0, 2, 2, 1, 2, 2, 1, 0),
70
+ (0, 0, 0, 2, 1, 1, 1, 2, 0),
71
+ (0, 0, 2, 2, 2, 1, 1, 2, 0),
72
+ (0, 0, 0, 0, 0, 1, 2, 2, 0),
73
+ (0, 0, 0, 0, 2, 2, 2, 2, 0),
74
+ ),
75
+ (
76
+ (0, 3, 3, 3, 3, 3, 3, 3, 0),
77
+ (0, 1, 2, 1, 1, 2, 2, 1, 0),
78
+ (0, 2, 2, 2, 1, 2, 2, 1, 0),
79
+ (0, 0, 2, 2, 2, 2, 2, 1, 0),
80
+ (0, 3, 3, 2, 1, 1, 1, 2, 0),
81
+ (0, 3, 3, 2, 2, 1, 1, 2, 0),
82
+ (0, 2, 1, 2, 1, 2, 1, 2, 0),
83
+ (0, 3, 3, 3, 2, 2, 2, 2, 0),
84
+ ),
85
+ (
86
+ (0, 0, 0, 0, 0, 0, 0, 1, 0),
87
+ (0, 0, 0, 2, 2, 2, 1, 1, 0),
88
+ (0, 0, 2, 1, 1, 2, 2, 1, 0),
89
+ (1, 1, 2, 2, 1, 2, 2, 1, 0),
90
+ (0, 0, 2, 1, 2, 2, 2, 1, 0),
91
+ (0, 1, 2, 2, 2, 2, 2, 1, 0),
92
+ (0, 0, 0, 2, 2, 2, 1, 2, 0),
93
+ (0, 0, 0, 2, 2, 2, 2, 2, 0),
94
+ ),
95
+ (
96
+ (0, 0, 0, 0, 0, 0, 0, 1, 0),
97
+ (0, 0, 0, 2, 2, 2, 1, 1, 0),
98
+ (2, 2, 2, 1, 0, 2, 1, 0, 0),
99
+ (2, 1, 1, 2, 1, 1, 1, 2, 0),
100
+ (2, 2, 2, 1, 1, 1, 0, 2, 0),
101
+ (2, 2, 2, 1, 1, 2, 1, 2, 0),
102
+ (0, 0, 0, 0, 2, 1, 2, 2, 0),
103
+ (0, 0, 0, 0, 2, 2, 2, 2, 0),
104
+ ),
105
+ )