esphome 2025.8.3__py3-none-any.whl → 2025.9.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 (370) hide show
  1. esphome/__main__.py +177 -105
  2. esphome/components/absolute_humidity/absolute_humidity.cpp +3 -5
  3. esphome/components/adc/__init__.py +1 -26
  4. esphome/components/adc/adc_sensor_esp32.cpp +29 -6
  5. esphome/components/adc/sensor.py +20 -0
  6. esphome/components/ade7880/ade7880.cpp +1 -1
  7. esphome/components/ags10/ags10.cpp +3 -18
  8. esphome/components/ags10/ags10.h +2 -12
  9. esphome/components/aht10/aht10.cpp +3 -3
  10. esphome/components/airthings_ble/__init__.py +2 -2
  11. esphome/components/alarm_control_panel/__init__.py +2 -2
  12. esphome/components/am2315c/am2315c.cpp +1 -17
  13. esphome/components/am2315c/am2315c.h +2 -3
  14. esphome/components/api/__init__.py +2 -2
  15. esphome/components/api/api_connection.cpp +38 -34
  16. esphome/components/api/api_connection.h +20 -40
  17. esphome/components/api/api_frame_helper.cpp +25 -25
  18. esphome/components/api/api_frame_helper.h +3 -3
  19. esphome/components/api/api_frame_helper_noise.cpp +75 -40
  20. esphome/components/api/api_frame_helper_noise.h +3 -7
  21. esphome/components/api/api_frame_helper_plaintext.cpp +17 -4
  22. esphome/components/api/api_frame_helper_plaintext.h +1 -4
  23. esphome/components/api/api_pb2.cpp +12 -2
  24. esphome/components/api/api_pb2.h +144 -143
  25. esphome/components/api/api_pb2_dump.cpp +6 -1
  26. esphome/components/api/api_pb2_service.cpp +0 -14
  27. esphome/components/api/api_pb2_service.h +1 -3
  28. esphome/components/api/client.py +5 -3
  29. esphome/components/api/proto.cpp +33 -37
  30. esphome/components/async_tcp/__init__.py +2 -2
  31. esphome/components/atm90e26/sensor.py +2 -0
  32. esphome/components/atm90e32/sensor.py +4 -2
  33. esphome/components/audio_adc/__init__.py +2 -2
  34. esphome/components/audio_dac/__init__.py +2 -2
  35. esphome/components/axs15231/touchscreen/axs15231_touchscreen.cpp +1 -1
  36. esphome/components/bedjet/bedjet_hub.cpp +1 -1
  37. esphome/components/binary_sensor/__init__.py +2 -2
  38. esphome/components/binary_sensor/binary_sensor.cpp +13 -0
  39. esphome/components/binary_sensor/binary_sensor.h +4 -7
  40. esphome/components/bl0940/__init__.py +6 -1
  41. esphome/components/bl0940/bl0940.cpp +178 -41
  42. esphome/components/bl0940/bl0940.h +121 -76
  43. esphome/components/bl0940/button/__init__.py +27 -0
  44. esphome/components/bl0940/button/calibration_reset_button.cpp +20 -0
  45. esphome/components/bl0940/button/calibration_reset_button.h +19 -0
  46. esphome/components/bl0940/number/__init__.py +94 -0
  47. esphome/components/bl0940/number/calibration_number.cpp +29 -0
  48. esphome/components/bl0940/number/calibration_number.h +26 -0
  49. esphome/components/bl0940/sensor.py +151 -2
  50. esphome/components/bl0942/bl0942.cpp +1 -1
  51. esphome/components/ble_client/output/__init__.py +4 -4
  52. esphome/components/bluetooth_proxy/__init__.py +1 -1
  53. esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -1
  54. esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +15 -7
  55. esphome/components/bluetooth_proxy/bluetooth_proxy.h +6 -3
  56. esphome/components/button/__init__.py +2 -2
  57. esphome/components/button/button.cpp +13 -0
  58. esphome/components/button/button.h +4 -7
  59. esphome/components/camera/buffer.h +18 -0
  60. esphome/components/camera/buffer_impl.cpp +20 -0
  61. esphome/components/camera/buffer_impl.h +26 -0
  62. esphome/components/camera/camera.h +43 -0
  63. esphome/components/camera/encoder.h +69 -0
  64. esphome/components/camera_encoder/__init__.py +62 -0
  65. esphome/components/camera_encoder/encoder_buffer_impl.cpp +23 -0
  66. esphome/components/camera_encoder/encoder_buffer_impl.h +25 -0
  67. esphome/components/camera_encoder/esp32_camera_jpeg_encoder.cpp +82 -0
  68. esphome/components/camera_encoder/esp32_camera_jpeg_encoder.h +39 -0
  69. esphome/components/captive_portal/__init__.py +2 -2
  70. esphome/components/captive_portal/captive_index.h +77 -97
  71. esphome/components/captive_portal/captive_portal.cpp +35 -12
  72. esphome/components/captive_portal/captive_portal.h +3 -3
  73. esphome/components/ccs811/ccs811.cpp +3 -3
  74. esphome/components/climate/__init__.py +2 -2
  75. esphome/components/climate/climate.cpp +1 -1
  76. esphome/components/cover/__init__.py +5 -5
  77. esphome/components/cover/cover.cpp +1 -1
  78. esphome/components/cover/cover.h +2 -2
  79. esphome/components/dallas_temp/dallas_temp.cpp +2 -2
  80. esphome/components/datetime/__init__.py +2 -2
  81. esphome/components/datetime/date_entity.h +2 -2
  82. esphome/components/datetime/datetime_entity.h +2 -2
  83. esphome/components/datetime/time_entity.h +2 -2
  84. esphome/components/debug/debug_esp32.cpp +1 -1
  85. esphome/components/display/__init__.py +4 -4
  86. esphome/components/duty_time/duty_time_sensor.cpp +1 -1
  87. esphome/components/esp32/__init__.py +0 -5
  88. esphome/components/esp32/gpio.cpp +27 -23
  89. esphome/components/esp32/gpio.h +26 -11
  90. esphome/components/esp32/preferences.cpp +8 -4
  91. esphome/components/esp32_ble/__init__.py +7 -2
  92. esphome/components/esp32_ble/ble_uuid.cpp +30 -9
  93. esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +4 -3
  94. esphome/components/esp32_ble_client/ble_client_base.cpp +7 -3
  95. esphome/components/esp32_ble_client/ble_client_base.h +8 -5
  96. esphome/components/esp32_ble_tracker/__init__.py +2 -2
  97. esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +11 -47
  98. esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +2 -14
  99. esphome/components/esp8266/__init__.py +2 -2
  100. esphome/components/esp8266/core.cpp +2 -2
  101. esphome/components/esp8266/gpio.py +4 -4
  102. esphome/components/esp8266/preferences.cpp +30 -28
  103. esphome/components/esphome/ota/__init__.py +2 -2
  104. esphome/components/esphome/ota/ota_esphome.cpp +21 -19
  105. esphome/components/esphome/ota/ota_esphome.h +6 -5
  106. esphome/components/ethernet/__init__.py +18 -2
  107. esphome/components/ethernet/ethernet_component.cpp +53 -3
  108. esphome/components/ethernet/ethernet_component.h +4 -0
  109. esphome/components/event/__init__.py +2 -2
  110. esphome/components/event/event.h +4 -4
  111. esphome/components/factory_reset/button/factory_reset_button.cpp +18 -1
  112. esphome/components/factory_reset/button/factory_reset_button.h +6 -1
  113. esphome/components/factory_reset/switch/factory_reset_switch.cpp +18 -1
  114. esphome/components/factory_reset/switch/factory_reset_switch.h +5 -1
  115. esphome/components/fan/__init__.py +2 -2
  116. esphome/components/fan/fan.cpp +2 -1
  117. esphome/components/gdk101/gdk101.cpp +4 -4
  118. esphome/components/globals/__init__.py +2 -2
  119. esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp +19 -18
  120. esphome/components/gpio_expander/cached_gpio.h +36 -16
  121. esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp +5 -5
  122. esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +1 -1
  123. esphome/components/haier/haier_base.cpp +1 -1
  124. esphome/components/haier/hon_climate.cpp +1 -1
  125. esphome/components/hlw8012/hlw8012.cpp +5 -5
  126. esphome/components/honeywellabp2_i2c/honeywellabp2.cpp +4 -4
  127. esphome/components/host/preferences.h +3 -2
  128. esphome/components/hte501/hte501.cpp +3 -21
  129. esphome/components/hte501/hte501.h +2 -3
  130. esphome/components/http_request/ota/__init__.py +2 -2
  131. esphome/components/i2c/__init__.py +2 -2
  132. esphome/components/i2c/i2c.cpp +13 -9
  133. esphome/components/i2c/i2c_bus.h +36 -6
  134. esphome/components/i2s_audio/__init__.py +8 -2
  135. esphome/components/i2s_audio/media_player/__init__.py +1 -1
  136. esphome/components/i2s_audio/microphone/__init__.py +1 -1
  137. esphome/components/i2s_audio/speaker/__init__.py +1 -1
  138. esphome/components/ina2xx_base/__init__.py +4 -2
  139. esphome/components/inkplate/__init__.py +1 -0
  140. esphome/components/inkplate/const.py +105 -0
  141. esphome/components/inkplate/display.py +238 -0
  142. esphome/components/{inkplate6 → inkplate}/inkplate.cpp +156 -74
  143. esphome/components/{inkplate6 → inkplate}/inkplate.h +28 -68
  144. esphome/components/inkplate6/__init__.py +0 -1
  145. esphome/components/inkplate6/display.py +2 -211
  146. esphome/components/integration/integration_sensor.cpp +1 -1
  147. esphome/components/json/__init__.py +2 -2
  148. esphome/components/kmeteriso/kmeteriso.cpp +1 -1
  149. esphome/components/lc709203f/lc709203f.cpp +4 -17
  150. esphome/components/lc709203f/lc709203f.h +2 -3
  151. esphome/components/ld2420/text_sensor/{text_sensor.cpp → ld2420_text_sensor.cpp} +1 -1
  152. esphome/components/ld2450/ld2450.cpp +1 -1
  153. esphome/components/libretiny/preferences.cpp +13 -5
  154. esphome/components/light/__init__.py +2 -2
  155. esphome/components/light/addressable_light_effect.h +7 -0
  156. esphome/components/light/base_light_effects.h +8 -0
  157. esphome/components/light/light_call.cpp +22 -20
  158. esphome/components/light/light_effect.cpp +36 -0
  159. esphome/components/light/light_effect.h +14 -0
  160. esphome/components/light/light_json_schema.cpp +9 -1
  161. esphome/components/light/light_state.cpp +2 -2
  162. esphome/components/light/light_state.h +39 -0
  163. esphome/components/lock/__init__.py +2 -2
  164. esphome/components/lock/lock.h +2 -2
  165. esphome/components/logger/__init__.py +2 -2
  166. esphome/components/logger/logger.cpp +25 -4
  167. esphome/components/logger/logger.h +1 -1
  168. esphome/components/logger/logger_esp32.cpp +16 -8
  169. esphome/components/logger/logger_esp8266.cpp +11 -3
  170. esphome/components/logger/logger_libretiny.cpp +13 -3
  171. esphome/components/logger/logger_rp2040.cpp +14 -3
  172. esphome/components/logger/logger_zephyr.cpp +15 -4
  173. esphome/components/lvgl/defines.py +1 -0
  174. esphome/components/lvgl/hello_world.py +96 -33
  175. esphome/components/lvgl/number/lvgl_number.h +1 -1
  176. esphome/components/lvgl/select/lvgl_select.h +1 -1
  177. esphome/components/lvgl/widgets/__init__.py +0 -1
  178. esphome/components/lvgl/widgets/spinbox.py +20 -11
  179. esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.cpp +1 -1
  180. esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.cpp +1 -1
  181. esphome/components/mapping/__init__.py +13 -5
  182. esphome/components/mapping/mapping.h +69 -0
  183. esphome/components/max17043/max17043.cpp +2 -2
  184. esphome/components/mcp23016/__init__.py +1 -0
  185. esphome/components/mcp23016/mcp23016.cpp +20 -5
  186. esphome/components/mcp23016/mcp23016.h +10 -4
  187. esphome/components/mcp23x08_base/mcp23x08_base.cpp +1 -1
  188. esphome/components/mcp23x17_base/mcp23x17_base.cpp +2 -2
  189. esphome/components/md5/md5.cpp +3 -2
  190. esphome/components/mdns/__init__.py +2 -2
  191. esphome/components/mdns/mdns_component.cpp +145 -54
  192. esphome/components/media_player/__init__.py +2 -2
  193. esphome/components/micro_wake_word/__init__.py +2 -2
  194. esphome/components/microphone/__init__.py +2 -2
  195. esphome/components/mipi/__init__.py +77 -33
  196. esphome/components/mipi_rgb/__init__.py +2 -0
  197. esphome/components/mipi_rgb/display.py +321 -0
  198. esphome/components/mipi_rgb/mipi_rgb.cpp +388 -0
  199. esphome/components/mipi_rgb/mipi_rgb.h +127 -0
  200. esphome/components/mipi_rgb/models/guition.py +24 -0
  201. esphome/components/mipi_rgb/models/lilygo.py +228 -0
  202. esphome/components/mipi_rgb/models/rpi.py +9 -0
  203. esphome/components/mipi_rgb/models/st7701s.py +214 -0
  204. esphome/components/mipi_rgb/models/waveshare.py +64 -0
  205. esphome/components/mipi_spi/models/jc.py +229 -0
  206. esphome/components/mlx90614/mlx90614.cpp +1 -16
  207. esphome/components/mlx90614/mlx90614.h +0 -1
  208. esphome/components/mqtt/__init__.py +2 -2
  209. esphome/components/mqtt/mqtt_client.cpp +1 -1
  210. esphome/components/mqtt/mqtt_sensor.cpp +7 -2
  211. esphome/components/ms5611/ms5611.cpp +7 -6
  212. esphome/components/network/__init__.py +2 -2
  213. esphome/components/nextion/nextion_upload.cpp +4 -1
  214. esphome/components/nrf52/__init__.py +49 -6
  215. esphome/components/nrf52/const.py +1 -0
  216. esphome/components/nrf52/dfu.cpp +51 -0
  217. esphome/components/nrf52/dfu.h +24 -0
  218. esphome/components/ntc/ntc.cpp +1 -1
  219. esphome/components/number/__init__.py +2 -2
  220. esphome/components/number/automation.cpp +1 -1
  221. esphome/components/number/number.cpp +21 -0
  222. esphome/components/number/number.h +4 -13
  223. esphome/components/opentherm/hub.h +6 -6
  224. esphome/components/opentherm/number/{number.cpp → opentherm_number.cpp} +2 -2
  225. esphome/components/opentherm/output/{output.cpp → opentherm_output.cpp} +1 -1
  226. esphome/components/opentherm/switch/{switch.cpp → opentherm_switch.cpp} +1 -1
  227. esphome/components/openthread/openthread.cpp +41 -7
  228. esphome/components/openthread/openthread.h +11 -0
  229. esphome/components/ota/__init__.py +2 -2
  230. esphome/components/pca6416a/__init__.py +1 -0
  231. esphome/components/pca6416a/pca6416a.cpp +20 -5
  232. esphome/components/pca6416a/pca6416a.h +12 -5
  233. esphome/components/pca9554/__init__.py +2 -1
  234. esphome/components/pca9554/pca9554.cpp +12 -18
  235. esphome/components/pca9554/pca9554.h +10 -9
  236. esphome/components/pcf8574/__init__.py +1 -0
  237. esphome/components/pcf8574/pcf8574.cpp +14 -5
  238. esphome/components/pcf8574/pcf8574.h +13 -6
  239. esphome/components/pi4ioe5v6408/pi4ioe5v6408.cpp +7 -7
  240. esphome/components/pipsolar/__init__.py +3 -3
  241. esphome/components/pipsolar/output/__init__.py +4 -4
  242. esphome/components/pulse_width/pulse_width.cpp +2 -2
  243. esphome/components/qmp6988/qmp6988.cpp +81 -126
  244. esphome/components/qmp6988/qmp6988.h +31 -37
  245. esphome/components/radon_eye_ble/__init__.py +2 -2
  246. esphome/components/remote_base/__init__.py +6 -8
  247. esphome/components/rotary_encoder/rotary_encoder.cpp +1 -1
  248. esphome/components/rp2040/__init__.py +2 -2
  249. esphome/components/runtime_stats/runtime_stats.cpp +10 -23
  250. esphome/components/runtime_stats/runtime_stats.h +4 -10
  251. esphome/components/safe_mode/__init__.py +2 -2
  252. esphome/components/safe_mode/safe_mode.cpp +33 -31
  253. esphome/components/script/script.cpp +6 -0
  254. esphome/components/script/script.h +19 -5
  255. esphome/components/sdm_meter/sensor.py +3 -1
  256. esphome/components/select/__init__.py +2 -2
  257. esphome/components/select/select.cpp +3 -3
  258. esphome/components/select/select.h +2 -2
  259. esphome/components/select/select_call.cpp +1 -1
  260. esphome/components/sen5x/sen5x.cpp +58 -55
  261. esphome/components/sen5x/sen5x.h +21 -15
  262. esphome/components/sen5x/sensor.py +67 -44
  263. esphome/components/sensirion_common/i2c_sensirion.cpp +18 -47
  264. esphome/components/sensirion_common/i2c_sensirion.h +39 -55
  265. esphome/components/sensor/__init__.py +2 -2
  266. esphome/components/sensor/automation.h +1 -1
  267. esphome/components/sensor/sensor.cpp +34 -6
  268. esphome/components/sensor/sensor.h +4 -21
  269. esphome/components/sgp30/sgp30.cpp +34 -35
  270. esphome/components/sgp30/sgp30.h +11 -10
  271. esphome/components/sgp4x/sgp4x.cpp +2 -2
  272. esphome/components/shelly_dimmer/light.py +7 -7
  273. esphome/components/sht4x/sht4x.cpp +1 -1
  274. esphome/components/sntp/sntp_component.cpp +36 -9
  275. esphome/components/sntp/sntp_component.h +7 -0
  276. esphome/components/sound_level/sound_level.cpp +1 -1
  277. esphome/components/speaker/__init__.py +2 -2
  278. esphome/components/speaker/media_player/__init__.py +2 -2
  279. esphome/components/speaker/media_player/speaker_media_player.cpp +1 -1
  280. esphome/components/spi/__init__.py +2 -2
  281. esphome/components/sprinkler/sprinkler.cpp +1 -1
  282. esphome/components/sps30/sps30.cpp +18 -23
  283. esphome/components/sps30/sps30.h +3 -3
  284. esphome/components/status_led/__init__.py +2 -2
  285. esphome/components/stepper/__init__.py +2 -2
  286. esphome/components/switch/__init__.py +2 -2
  287. esphome/components/switch/switch.cpp +5 -5
  288. esphome/components/sx1509/__init__.py +1 -1
  289. esphome/components/sx1509/sx1509.cpp +12 -7
  290. esphome/components/sx1509/sx1509.h +11 -4
  291. esphome/components/tca9555/tca9555.cpp +5 -5
  292. esphome/components/tee501/tee501.cpp +2 -21
  293. esphome/components/tee501/tee501.h +2 -4
  294. esphome/components/template/alarm_control_panel/template_alarm_control_panel.cpp +1 -1
  295. esphome/components/template/datetime/template_date.cpp +1 -1
  296. esphome/components/template/datetime/template_datetime.cpp +2 -2
  297. esphome/components/template/datetime/template_time.cpp +1 -1
  298. esphome/components/template/number/template_number.cpp +1 -1
  299. esphome/components/template/select/template_select.cpp +1 -1
  300. esphome/components/template/text/template_text.cpp +1 -1
  301. esphome/components/text/__init__.py +2 -2
  302. esphome/components/text/text.h +2 -2
  303. esphome/components/text_sensor/__init__.py +2 -2
  304. esphome/components/text_sensor/text_sensor.h +4 -4
  305. esphome/components/thermostat/climate.py +11 -7
  306. esphome/components/thermostat/thermostat_climate.cpp +237 -206
  307. esphome/components/thermostat/thermostat_climate.h +52 -41
  308. esphome/components/time/__init__.py +2 -2
  309. esphome/components/tmp1075/tmp1075.cpp +1 -1
  310. esphome/components/total_daily_energy/total_daily_energy.cpp +1 -1
  311. esphome/components/touchscreen/__init__.py +2 -2
  312. esphome/components/tuya/number/tuya_number.cpp +1 -1
  313. esphome/components/udp/udp_component.cpp +3 -3
  314. esphome/components/ufire_ec/ufire_ec.cpp +4 -4
  315. esphome/components/ufire_ise/ufire_ise.cpp +4 -4
  316. esphome/components/update/__init__.py +2 -2
  317. esphome/components/usb_uart/usb_uart.cpp +1 -1
  318. esphome/components/valve/__init__.py +5 -5
  319. esphome/components/valve/valve.cpp +1 -1
  320. esphome/components/valve/valve.h +2 -2
  321. esphome/components/wake_on_lan/wake_on_lan.cpp +2 -2
  322. esphome/components/waveshare_epaper/waveshare_213v3.cpp +1 -1
  323. esphome/components/web_server/__init__.py +2 -2
  324. esphome/components/web_server/ota/__init__.py +2 -2
  325. esphome/components/web_server/ota/ota_web_server.cpp +11 -0
  326. esphome/components/web_server/server_index_v2.h +149 -149
  327. esphome/components/web_server/web_server.cpp +58 -12
  328. esphome/components/web_server_base/__init__.py +2 -2
  329. esphome/components/wifi/__init__.py +5 -5
  330. esphome/components/wifi/wifi_component.cpp +4 -4
  331. esphome/components/wifi/wifi_component_esp_idf.cpp +2 -0
  332. esphome/components/wifi_info/wifi_info_text_sensor.h +3 -2
  333. esphome/config_validation.py +2 -2
  334. esphome/const.py +3 -1
  335. esphome/core/__init__.py +1 -0
  336. esphome/core/application.cpp +89 -51
  337. esphome/core/application.h +1 -0
  338. esphome/core/component.cpp +41 -19
  339. esphome/core/component.h +17 -13
  340. esphome/core/config.py +7 -7
  341. esphome/core/defines.h +5 -0
  342. esphome/core/entity_base.cpp +22 -8
  343. esphome/core/entity_base.h +43 -0
  344. esphome/core/helpers.cpp +34 -20
  345. esphome/core/helpers.h +33 -3
  346. esphome/core/ring_buffer.cpp +6 -2
  347. esphome/core/ring_buffer.h +2 -1
  348. esphome/core/scheduler.cpp +178 -97
  349. esphome/core/scheduler.h +67 -36
  350. esphome/core/time.cpp +6 -20
  351. esphome/coroutine.py +80 -3
  352. esphome/cpp_generator.py +13 -0
  353. esphome/cpp_helpers.py +2 -2
  354. esphome/dashboard/web_server.py +69 -15
  355. esphome/espota2.py +13 -6
  356. esphome/helpers.py +68 -83
  357. esphome/resolver.py +67 -0
  358. esphome/util.py +9 -6
  359. esphome/wizard.py +81 -34
  360. esphome/writer.py +13 -0
  361. {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/METADATA +9 -9
  362. {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/RECORD +370 -339
  363. /esphome/components/ld2420/text_sensor/{text_sensor.h → ld2420_text_sensor.h} +0 -0
  364. /esphome/components/opentherm/number/{number.h → opentherm_number.h} +0 -0
  365. /esphome/components/opentherm/output/{output.h → opentherm_output.h} +0 -0
  366. /esphome/components/opentherm/switch/{switch.h → opentherm_switch.h} +0 -0
  367. {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/WHEEL +0 -0
  368. {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/entry_points.txt +0 -0
  369. {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/licenses/LICENSE +0 -0
  370. {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  #pragma once
2
2
 
3
+ #include "esphome/components/i2c/i2c.h"
4
+ #include "esphome/components/sensor/sensor.h"
3
5
  #include "esphome/core/automation.h"
4
6
  #include "esphome/core/component.h"
5
- #include "esphome/components/sensor/sensor.h"
6
- #include "esphome/components/i2c/i2c.h"
7
7
 
8
8
  namespace esphome {
9
9
  namespace ags10 {
@@ -99,16 +99,6 @@ class AGS10Component : public PollingComponent, public i2c::I2CDevice {
99
99
  * Read, checks and returns data from the sensor.
100
100
  */
101
101
  template<size_t N> optional<std::array<uint8_t, N>> read_and_check_(uint8_t a_register);
102
-
103
- /**
104
- * Calculates CRC8 value.
105
- *
106
- * CRC8 calculation, initial value: 0xFF, polynomial: 0x31 (x8+ x5+ x4+1)
107
- *
108
- * @param[in] dat the data buffer
109
- * @param num number of bytes in the buffer
110
- */
111
- template<size_t N> uint8_t calc_crc8_(std::array<uint8_t, N> dat, uint8_t num);
112
102
  };
113
103
 
114
104
  template<typename... Ts> class AGS10NewI2cAddressAction : public Action<Ts...>, public Parented<AGS10Component> {
@@ -96,7 +96,7 @@ void AHT10Component::read_data_() {
96
96
  ESP_LOGD(TAG, "Read attempt %d at %ums", this->read_count_, (unsigned) (millis() - this->start_time_));
97
97
  }
98
98
  if (this->read(data, 6) != i2c::ERROR_OK) {
99
- this->status_set_warning("Read failed, will retry");
99
+ this->status_set_warning(LOG_STR("Read failed, will retry"));
100
100
  this->restart_read_();
101
101
  return;
102
102
  }
@@ -113,7 +113,7 @@ void AHT10Component::read_data_() {
113
113
  } else {
114
114
  ESP_LOGD(TAG, "Invalid humidity, retrying");
115
115
  if (this->write(AHT10_MEASURE_CMD, sizeof(AHT10_MEASURE_CMD)) != i2c::ERROR_OK) {
116
- this->status_set_warning(ESP_LOG_MSG_COMM_FAIL);
116
+ this->status_set_warning(LOG_STR(ESP_LOG_MSG_COMM_FAIL));
117
117
  }
118
118
  this->restart_read_();
119
119
  return;
@@ -144,7 +144,7 @@ void AHT10Component::update() {
144
144
  return;
145
145
  this->start_time_ = millis();
146
146
  if (this->write(AHT10_MEASURE_CMD, sizeof(AHT10_MEASURE_CMD)) != i2c::ERROR_OK) {
147
- this->status_set_warning(ESP_LOG_MSG_COMM_FAIL);
147
+ this->status_set_warning(LOG_STR(ESP_LOG_MSG_COMM_FAIL));
148
148
  return;
149
149
  }
150
150
  this->restart_read_();
@@ -18,6 +18,6 @@ CONFIG_SCHEMA = cv.Schema(
18
18
  ).extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA)
19
19
 
20
20
 
21
- def to_code(config):
21
+ async def to_code(config):
22
22
  var = cg.new_Pvariable(config[CONF_ID])
23
- yield esp32_ble_tracker.register_ble_device(var, config)
23
+ await esp32_ble_tracker.register_ble_device(var, config)
@@ -13,7 +13,7 @@ from esphome.const import (
13
13
  CONF_TRIGGER_ID,
14
14
  CONF_WEB_SERVER,
15
15
  )
16
- from esphome.core import CORE, coroutine_with_priority
16
+ from esphome.core import CORE, CoroPriority, coroutine_with_priority
17
17
  from esphome.core.entity_helpers import entity_duplicate_validator, setup_entity
18
18
  from esphome.cpp_generator import MockObjClass
19
19
 
@@ -345,6 +345,6 @@ async def alarm_control_panel_is_armed_to_code(
345
345
  return cg.new_Pvariable(condition_id, template_arg, paren)
346
346
 
347
347
 
348
- @coroutine_with_priority(100.0)
348
+ @coroutine_with_priority(CoroPriority.CORE)
349
349
  async def to_code(config):
350
350
  cg.add_global(alarm_control_panel_ns.using)
@@ -29,22 +29,6 @@ namespace am2315c {
29
29
 
30
30
  static const char *const TAG = "am2315c";
31
31
 
32
- uint8_t AM2315C::crc8_(uint8_t *data, uint8_t len) {
33
- uint8_t crc = 0xFF;
34
- while (len--) {
35
- crc ^= *data++;
36
- for (uint8_t i = 0; i < 8; i++) {
37
- if (crc & 0x80) {
38
- crc <<= 1;
39
- crc ^= 0x31;
40
- } else {
41
- crc <<= 1;
42
- }
43
- }
44
- }
45
- return crc;
46
- }
47
-
48
32
  bool AM2315C::reset_register_(uint8_t reg) {
49
33
  // code based on demo code sent by www.aosong.com
50
34
  // no further documentation.
@@ -86,7 +70,7 @@ bool AM2315C::convert_(uint8_t *data, float &humidity, float &temperature) {
86
70
  humidity = raw * 9.5367431640625e-5;
87
71
  raw = ((data[3] & 0x0F) << 16) | (data[4] << 8) | data[5];
88
72
  temperature = raw * 1.9073486328125e-4 - 50;
89
- return this->crc8_(data, 6) == data[6];
73
+ return crc8(data, 6, 0xFF, 0x31, true) == data[6];
90
74
  }
91
75
 
92
76
  void AM2315C::setup() {
@@ -21,9 +21,9 @@
21
21
  // SOFTWARE.
22
22
  #pragma once
23
23
 
24
- #include "esphome/core/component.h"
25
- #include "esphome/components/sensor/sensor.h"
26
24
  #include "esphome/components/i2c/i2c.h"
25
+ #include "esphome/components/sensor/sensor.h"
26
+ #include "esphome/core/component.h"
27
27
 
28
28
  namespace esphome {
29
29
  namespace am2315c {
@@ -39,7 +39,6 @@ class AM2315C : public PollingComponent, public i2c::I2CDevice {
39
39
  void set_humidity_sensor(sensor::Sensor *humidity_sensor) { this->humidity_sensor_ = humidity_sensor; }
40
40
 
41
41
  protected:
42
- uint8_t crc8_(uint8_t *data, uint8_t len);
43
42
  bool convert_(uint8_t *data, float &humidity, float &temperature);
44
43
  bool reset_register_(uint8_t reg);
45
44
 
@@ -24,7 +24,7 @@ from esphome.const import (
24
24
  CONF_TRIGGER_ID,
25
25
  CONF_VARIABLES,
26
26
  )
27
- from esphome.core import CORE, coroutine_with_priority
27
+ from esphome.core import CORE, CoroPriority, coroutine_with_priority
28
28
 
29
29
  DOMAIN = "api"
30
30
  DEPENDENCIES = ["network"]
@@ -134,7 +134,7 @@ CONFIG_SCHEMA = cv.All(
134
134
  )
135
135
 
136
136
 
137
- @coroutine_with_priority(40.0)
137
+ @coroutine_with_priority(CoroPriority.WEB)
138
138
  async def to_code(config):
139
139
  var = cg.new_Pvariable(config[CONF_ID])
140
140
  await cg.register_component(var, config)
@@ -42,6 +42,8 @@ static constexpr uint8_t MAX_PING_RETRIES = 60;
42
42
  static constexpr uint16_t PING_RETRY_INTERVAL = 1000;
43
43
  static constexpr uint32_t KEEPALIVE_DISCONNECT_TIMEOUT = (KEEPALIVE_TIMEOUT_MS * 5) / 2;
44
44
 
45
+ static constexpr auto ESPHOME_VERSION_REF = StringRef::from_lit(ESPHOME_VERSION);
46
+
45
47
  static const char *const TAG = "api.connection";
46
48
  #ifdef USE_CAMERA
47
49
  static const int CAMERA_STOP_STREAM = 5000;
@@ -112,7 +114,7 @@ void APIConnection::start() {
112
114
  APIError err = this->helper_->init();
113
115
  if (err != APIError::OK) {
114
116
  on_fatal_error();
115
- this->log_warning_("Helper init failed", err);
117
+ this->log_warning_(LOG_STR("Helper init failed"), err);
116
118
  return;
117
119
  }
118
120
  this->client_info_.peername = helper_->getpeername();
@@ -159,7 +161,7 @@ void APIConnection::loop() {
159
161
  break;
160
162
  } else if (err != APIError::OK) {
161
163
  on_fatal_error();
162
- this->log_warning_("Reading failed", err);
164
+ this->log_warning_(LOG_STR("Reading failed"), err);
163
165
  return;
164
166
  } else {
165
167
  this->last_traffic_ = now;
@@ -289,16 +291,26 @@ uint16_t APIConnection::encode_message_to_buffer(ProtoMessage &msg, uint8_t mess
289
291
  return 0; // Doesn't fit
290
292
  }
291
293
 
292
- // Allocate buffer space - pass payload size, allocation functions add header/footer space
293
- ProtoWriteBuffer buffer = is_single ? conn->allocate_single_message_buffer(calculated_size)
294
- : conn->allocate_batch_message_buffer(calculated_size);
295
-
296
294
  // Get buffer size after allocation (which includes header padding)
297
295
  std::vector<uint8_t> &shared_buf = conn->parent_->get_shared_buffer_ref();
298
- size_t size_before_encode = shared_buf.size();
296
+
297
+ if (is_single || conn->flags_.batch_first_message) {
298
+ // Single message or first batch message
299
+ conn->prepare_first_message_buffer(shared_buf, header_padding, total_calculated_size);
300
+ if (conn->flags_.batch_first_message) {
301
+ conn->flags_.batch_first_message = false;
302
+ }
303
+ } else {
304
+ // Batch message second or later
305
+ // Add padding for previous message footer + this message header
306
+ size_t current_size = shared_buf.size();
307
+ shared_buf.reserve(current_size + total_calculated_size);
308
+ shared_buf.resize(current_size + footer_size + header_padding);
309
+ }
299
310
 
300
311
  // Encode directly into buffer
301
- msg.encode(buffer);
312
+ size_t size_before_encode = shared_buf.size();
313
+ msg.encode({&shared_buf});
302
314
 
303
315
  // Calculate actual encoded size (not including header that was already added)
304
316
  size_t actual_payload_size = shared_buf.size() - size_before_encode;
@@ -1060,16 +1072,16 @@ void APIConnection::camera_image(const CameraImageRequest &msg) {
1060
1072
 
1061
1073
  #ifdef USE_HOMEASSISTANT_TIME
1062
1074
  void APIConnection::on_get_time_response(const GetTimeResponse &value) {
1063
- if (homeassistant::global_homeassistant_time != nullptr)
1075
+ if (homeassistant::global_homeassistant_time != nullptr) {
1064
1076
  homeassistant::global_homeassistant_time->set_epoch_time(value.epoch_seconds);
1065
- }
1077
+ #ifdef USE_TIME_TIMEZONE
1078
+ if (!value.timezone.empty() && value.timezone != homeassistant::global_homeassistant_time->get_timezone()) {
1079
+ homeassistant::global_homeassistant_time->set_timezone(value.timezone);
1080
+ }
1066
1081
  #endif
1067
-
1068
- bool APIConnection::send_get_time_response(const GetTimeRequest &msg) {
1069
- GetTimeResponse resp;
1070
- resp.epoch_seconds = ::time(nullptr);
1071
- return this->send_message(resp, GetTimeResponse::MESSAGE_TYPE);
1082
+ }
1072
1083
  }
1084
+ #endif
1073
1085
 
1074
1086
  #ifdef USE_BLUETOOTH_PROXY
1075
1087
  void APIConnection::subscribe_bluetooth_le_advertisements(const SubscribeBluetoothLEAdvertisementsRequest &msg) {
@@ -1360,9 +1372,8 @@ bool APIConnection::send_hello_response(const HelloRequest &msg) {
1360
1372
  HelloResponse resp;
1361
1373
  resp.api_version_major = 1;
1362
1374
  resp.api_version_minor = 12;
1363
- // Temporary string for concatenation - will be valid during send_message call
1364
- std::string server_info = App.get_name() + " (esphome v" ESPHOME_VERSION ")";
1365
- resp.set_server_info(StringRef(server_info));
1375
+ // Send only the version string - the client only logs this for debugging and doesn't use it otherwise
1376
+ resp.set_server_info(ESPHOME_VERSION_REF);
1366
1377
  resp.set_name(StringRef(App.get_name()));
1367
1378
 
1368
1379
  #ifdef USE_API_PASSWORD
@@ -1409,8 +1420,6 @@ bool APIConnection::send_device_info_response(const DeviceInfoRequest &msg) {
1409
1420
  std::string mac_address = get_mac_address_pretty();
1410
1421
  resp.set_mac_address(StringRef(mac_address));
1411
1422
 
1412
- // Compile-time StringRef constants
1413
- static constexpr auto ESPHOME_VERSION_REF = StringRef::from_lit(ESPHOME_VERSION);
1414
1423
  resp.set_esphome_version(ESPHOME_VERSION_REF);
1415
1424
 
1416
1425
  resp.set_compilation_time(App.get_compilation_time_ref());
@@ -1555,7 +1564,7 @@ bool APIConnection::send_buffer(ProtoWriteBuffer buffer, uint8_t message_type) {
1555
1564
  return false;
1556
1565
  if (err != APIError::OK) {
1557
1566
  on_fatal_error();
1558
- this->log_warning_("Packet write failed", err);
1567
+ this->log_warning_(LOG_STR("Packet write failed"), err);
1559
1568
  return false;
1560
1569
  }
1561
1570
  // Do not set last_traffic_ on send
@@ -1616,14 +1625,6 @@ bool APIConnection::schedule_batch_() {
1616
1625
  return true;
1617
1626
  }
1618
1627
 
1619
- ProtoWriteBuffer APIConnection::allocate_single_message_buffer(uint16_t size) { return this->create_buffer(size); }
1620
-
1621
- ProtoWriteBuffer APIConnection::allocate_batch_message_buffer(uint16_t size) {
1622
- ProtoWriteBuffer result = this->prepare_message_buffer(size, this->flags_.batch_first_message);
1623
- this->flags_.batch_first_message = false;
1624
- return result;
1625
- }
1626
-
1627
1628
  void APIConnection::process_batch_() {
1628
1629
  // Ensure PacketInfo remains trivially destructible for our placement new approach
1629
1630
  static_assert(std::is_trivially_destructible<PacketInfo>::value,
@@ -1731,7 +1732,7 @@ void APIConnection::process_batch_() {
1731
1732
  }
1732
1733
  remaining_size -= payload_size;
1733
1734
  // Calculate where the next message's header padding will start
1734
- // Current buffer size + footer space (that prepare_message_buffer will add for this message)
1735
+ // Current buffer size + footer space for this message
1735
1736
  current_offset = shared_buf.size() + footer_size;
1736
1737
  }
1737
1738
 
@@ -1750,7 +1751,7 @@ void APIConnection::process_batch_() {
1750
1751
  std::span<const PacketInfo>(packet_info, packet_count));
1751
1752
  if (err != APIError::OK && err != APIError::WOULD_BLOCK) {
1752
1753
  on_fatal_error();
1753
- this->log_warning_("Batch write failed", err);
1754
+ this->log_warning_(LOG_STR("Batch write failed"), err);
1754
1755
  }
1755
1756
 
1756
1757
  #ifdef HAS_PROTO_MESSAGE_DUMP
@@ -1828,11 +1829,14 @@ void APIConnection::process_state_subscriptions_() {
1828
1829
  }
1829
1830
  #endif // USE_API_HOMEASSISTANT_STATES
1830
1831
 
1831
- void APIConnection::log_warning_(const char *message, APIError err) {
1832
- ESP_LOGW(TAG, "%s: %s %s errno=%d", this->get_client_combined_info().c_str(), message, api_error_to_str(err), errno);
1832
+ void APIConnection::log_warning_(const LogString *message, APIError err) {
1833
+ ESP_LOGW(TAG, "%s: %s %s errno=%d", this->get_client_combined_info().c_str(), LOG_STR_ARG(message),
1834
+ LOG_STR_ARG(api_error_to_logstr(err)), errno);
1833
1835
  }
1834
1836
 
1835
- void APIConnection::log_socket_operation_failed_(APIError err) { this->log_warning_("Socket operation failed", err); }
1837
+ void APIConnection::log_socket_operation_failed_(APIError err) {
1838
+ this->log_warning_(LOG_STR("Socket operation failed"), err);
1839
+ }
1836
1840
 
1837
1841
  } // namespace esphome::api
1838
1842
  #endif
@@ -44,7 +44,7 @@ static constexpr size_t MAX_PACKETS_PER_BATCH = 64; // ESP32 has 8KB+ stack, HO
44
44
  static constexpr size_t MAX_PACKETS_PER_BATCH = 32; // ESP8266/RP2040/etc have smaller stacks
45
45
  #endif
46
46
 
47
- class APIConnection : public APIServerConnection {
47
+ class APIConnection final : public APIServerConnection {
48
48
  public:
49
49
  friend class APIServer;
50
50
  friend class ListEntitiesIterator;
@@ -219,7 +219,6 @@ class APIConnection : public APIServerConnection {
219
219
  #ifdef USE_API_HOMEASSISTANT_STATES
220
220
  void subscribe_home_assistant_states(const SubscribeHomeAssistantStatesRequest &msg) override;
221
221
  #endif
222
- bool send_get_time_response(const GetTimeRequest &msg) override;
223
222
  #ifdef USE_API_SERVICES
224
223
  void execute_service(const ExecuteServiceRequest &msg) override;
225
224
  #endif
@@ -252,44 +251,21 @@ class APIConnection : public APIServerConnection {
252
251
 
253
252
  // Get header padding size - used for both reserve and insert
254
253
  uint8_t header_padding = this->helper_->frame_header_padding();
255
-
256
254
  // Get shared buffer from parent server
257
255
  std::vector<uint8_t> &shared_buf = this->parent_->get_shared_buffer_ref();
256
+ this->prepare_first_message_buffer(shared_buf, header_padding,
257
+ reserve_size + header_padding + this->helper_->frame_footer_size());
258
+ return {&shared_buf};
259
+ }
260
+
261
+ void prepare_first_message_buffer(std::vector<uint8_t> &shared_buf, size_t header_padding, size_t total_size) {
258
262
  shared_buf.clear();
259
263
  // Reserve space for header padding + message + footer
260
264
  // - Header padding: space for protocol headers (7 bytes for Noise, 6 for Plaintext)
261
265
  // - Footer: space for MAC (16 bytes for Noise, 0 for Plaintext)
262
- shared_buf.reserve(reserve_size + header_padding + this->helper_->frame_footer_size());
266
+ shared_buf.reserve(total_size);
263
267
  // Resize to add header padding so message encoding starts at the correct position
264
268
  shared_buf.resize(header_padding);
265
- return {&shared_buf};
266
- }
267
-
268
- // Prepare buffer for next message in batch
269
- ProtoWriteBuffer prepare_message_buffer(uint16_t message_size, bool is_first_message) {
270
- // Get reference to shared buffer (it maintains state between batch messages)
271
- std::vector<uint8_t> &shared_buf = this->parent_->get_shared_buffer_ref();
272
-
273
- if (is_first_message) {
274
- shared_buf.clear();
275
- }
276
-
277
- size_t current_size = shared_buf.size();
278
-
279
- // Calculate padding to add:
280
- // - First message: just header padding
281
- // - Subsequent messages: footer for previous message + header padding for this message
282
- size_t padding_to_add = is_first_message
283
- ? this->helper_->frame_header_padding()
284
- : this->helper_->frame_header_padding() + this->helper_->frame_footer_size();
285
-
286
- // Reserve space for padding + message
287
- shared_buf.reserve(current_size + padding_to_add + message_size);
288
-
289
- // Resize to add the padding bytes
290
- shared_buf.resize(current_size + padding_to_add);
291
-
292
- return {&shared_buf};
293
269
  }
294
270
 
295
271
  bool try_to_clear_buffer(bool log_out_of_space);
@@ -297,10 +273,6 @@ class APIConnection : public APIServerConnection {
297
273
 
298
274
  std::string get_client_combined_info() const { return this->client_info_.get_combined_info(); }
299
275
 
300
- // Buffer allocator methods for batch processing
301
- ProtoWriteBuffer allocate_single_message_buffer(uint16_t size);
302
- ProtoWriteBuffer allocate_batch_message_buffer(uint16_t size);
303
-
304
276
  protected:
305
277
  // Helper function to handle authentication completion
306
278
  void complete_authentication_();
@@ -328,9 +300,17 @@ class APIConnection : public APIServerConnection {
328
300
  APIConnection *conn, uint32_t remaining_size, bool is_single) {
329
301
  // Set common fields that are shared by all entity types
330
302
  msg.key = entity->get_object_id_hash();
331
- // IMPORTANT: get_object_id() may return a temporary std::string
332
- std::string object_id = entity->get_object_id();
333
- msg.set_object_id(StringRef(object_id));
303
+ // Try to use static reference first to avoid allocation
304
+ StringRef static_ref = entity->get_object_id_ref_for_api_();
305
+ // Store dynamic string outside the if-else to maintain lifetime
306
+ std::string object_id;
307
+ if (!static_ref.empty()) {
308
+ msg.set_object_id(static_ref);
309
+ } else {
310
+ // Dynamic case - need to allocate
311
+ object_id = entity->get_object_id();
312
+ msg.set_object_id(StringRef(object_id));
313
+ }
334
314
 
335
315
  if (entity->has_own_name()) {
336
316
  msg.set_name(entity->get_name());
@@ -751,7 +731,7 @@ class APIConnection : public APIServerConnection {
751
731
  }
752
732
 
753
733
  // Helper function to log API errors with errno
754
- void log_warning_(const char *message, APIError err);
734
+ void log_warning_(const LogString *message, APIError err);
755
735
  // Specific helper for duplicated error message
756
736
  void log_socket_operation_failed_(APIError err);
757
737
  };
@@ -23,59 +23,59 @@ static const char *const TAG = "api.frame_helper";
23
23
  #define LOG_PACKET_SENDING(data, len) ((void) 0)
24
24
  #endif
25
25
 
26
- const char *api_error_to_str(APIError err) {
26
+ const LogString *api_error_to_logstr(APIError err) {
27
27
  // not using switch to ensure compiler doesn't try to build a big table out of it
28
28
  if (err == APIError::OK) {
29
- return "OK";
29
+ return LOG_STR("OK");
30
30
  } else if (err == APIError::WOULD_BLOCK) {
31
- return "WOULD_BLOCK";
31
+ return LOG_STR("WOULD_BLOCK");
32
32
  } else if (err == APIError::BAD_INDICATOR) {
33
- return "BAD_INDICATOR";
33
+ return LOG_STR("BAD_INDICATOR");
34
34
  } else if (err == APIError::BAD_DATA_PACKET) {
35
- return "BAD_DATA_PACKET";
35
+ return LOG_STR("BAD_DATA_PACKET");
36
36
  } else if (err == APIError::TCP_NODELAY_FAILED) {
37
- return "TCP_NODELAY_FAILED";
37
+ return LOG_STR("TCP_NODELAY_FAILED");
38
38
  } else if (err == APIError::TCP_NONBLOCKING_FAILED) {
39
- return "TCP_NONBLOCKING_FAILED";
39
+ return LOG_STR("TCP_NONBLOCKING_FAILED");
40
40
  } else if (err == APIError::CLOSE_FAILED) {
41
- return "CLOSE_FAILED";
41
+ return LOG_STR("CLOSE_FAILED");
42
42
  } else if (err == APIError::SHUTDOWN_FAILED) {
43
- return "SHUTDOWN_FAILED";
43
+ return LOG_STR("SHUTDOWN_FAILED");
44
44
  } else if (err == APIError::BAD_STATE) {
45
- return "BAD_STATE";
45
+ return LOG_STR("BAD_STATE");
46
46
  } else if (err == APIError::BAD_ARG) {
47
- return "BAD_ARG";
47
+ return LOG_STR("BAD_ARG");
48
48
  } else if (err == APIError::SOCKET_READ_FAILED) {
49
- return "SOCKET_READ_FAILED";
49
+ return LOG_STR("SOCKET_READ_FAILED");
50
50
  } else if (err == APIError::SOCKET_WRITE_FAILED) {
51
- return "SOCKET_WRITE_FAILED";
51
+ return LOG_STR("SOCKET_WRITE_FAILED");
52
52
  } else if (err == APIError::OUT_OF_MEMORY) {
53
- return "OUT_OF_MEMORY";
53
+ return LOG_STR("OUT_OF_MEMORY");
54
54
  } else if (err == APIError::CONNECTION_CLOSED) {
55
- return "CONNECTION_CLOSED";
55
+ return LOG_STR("CONNECTION_CLOSED");
56
56
  }
57
57
  #ifdef USE_API_NOISE
58
58
  else if (err == APIError::BAD_HANDSHAKE_PACKET_LEN) {
59
- return "BAD_HANDSHAKE_PACKET_LEN";
59
+ return LOG_STR("BAD_HANDSHAKE_PACKET_LEN");
60
60
  } else if (err == APIError::HANDSHAKESTATE_READ_FAILED) {
61
- return "HANDSHAKESTATE_READ_FAILED";
61
+ return LOG_STR("HANDSHAKESTATE_READ_FAILED");
62
62
  } else if (err == APIError::HANDSHAKESTATE_WRITE_FAILED) {
63
- return "HANDSHAKESTATE_WRITE_FAILED";
63
+ return LOG_STR("HANDSHAKESTATE_WRITE_FAILED");
64
64
  } else if (err == APIError::HANDSHAKESTATE_BAD_STATE) {
65
- return "HANDSHAKESTATE_BAD_STATE";
65
+ return LOG_STR("HANDSHAKESTATE_BAD_STATE");
66
66
  } else if (err == APIError::CIPHERSTATE_DECRYPT_FAILED) {
67
- return "CIPHERSTATE_DECRYPT_FAILED";
67
+ return LOG_STR("CIPHERSTATE_DECRYPT_FAILED");
68
68
  } else if (err == APIError::CIPHERSTATE_ENCRYPT_FAILED) {
69
- return "CIPHERSTATE_ENCRYPT_FAILED";
69
+ return LOG_STR("CIPHERSTATE_ENCRYPT_FAILED");
70
70
  } else if (err == APIError::HANDSHAKESTATE_SETUP_FAILED) {
71
- return "HANDSHAKESTATE_SETUP_FAILED";
71
+ return LOG_STR("HANDSHAKESTATE_SETUP_FAILED");
72
72
  } else if (err == APIError::HANDSHAKESTATE_SPLIT_FAILED) {
73
- return "HANDSHAKESTATE_SPLIT_FAILED";
73
+ return LOG_STR("HANDSHAKESTATE_SPLIT_FAILED");
74
74
  } else if (err == APIError::BAD_HANDSHAKE_ERROR_BYTE) {
75
- return "BAD_HANDSHAKE_ERROR_BYTE";
75
+ return LOG_STR("BAD_HANDSHAKE_ERROR_BYTE");
76
76
  }
77
77
  #endif
78
- return "UNKNOWN";
78
+ return LOG_STR("UNKNOWN");
79
79
  }
80
80
 
81
81
  // Default implementation for loop - handles sending buffered data
@@ -66,7 +66,7 @@ enum class APIError : uint16_t {
66
66
  #endif
67
67
  };
68
68
 
69
- const char *api_error_to_str(APIError err);
69
+ const LogString *api_error_to_logstr(APIError err);
70
70
 
71
71
  class APIFrameHelper {
72
72
  public:
@@ -104,9 +104,9 @@ class APIFrameHelper {
104
104
  // The buffer contains all messages with appropriate padding before each
105
105
  virtual APIError write_protobuf_packets(ProtoWriteBuffer buffer, std::span<const PacketInfo> packets) = 0;
106
106
  // Get the frame header padding required by this protocol
107
- virtual uint8_t frame_header_padding() = 0;
107
+ uint8_t frame_header_padding() const { return frame_header_padding_; }
108
108
  // Get the frame footer size required by this protocol
109
- virtual uint8_t frame_footer_size() = 0;
109
+ uint8_t frame_footer_size() const { return frame_footer_size_; }
110
110
  // Check if socket has data ready to read
111
111
  bool is_socket_ready() const { return socket_ != nullptr && socket_->ready(); }
112
112