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,11 @@
1
1
  #include "sgp30.h"
2
- #include <cinttypes>
3
2
  #include "esphome/core/application.h"
4
3
  #include "esphome/core/hal.h"
4
+ #include "esphome/core/helpers.h"
5
5
  #include "esphome/core/log.h"
6
6
 
7
+ #include <cinttypes>
8
+
7
9
  namespace esphome {
8
10
  namespace sgp30 {
9
11
 
@@ -39,9 +41,8 @@ void SGP30Component::setup() {
39
41
  this->mark_failed();
40
42
  return;
41
43
  }
42
- this->serial_number_ = (uint64_t(raw_serial_number[0]) << 24) | (uint64_t(raw_serial_number[1]) << 16) |
43
- (uint64_t(raw_serial_number[2]));
44
- ESP_LOGD(TAG, "Serial Number: %" PRIu64, this->serial_number_);
44
+ this->serial_number_ = encode_uint24(raw_serial_number[0], raw_serial_number[1], raw_serial_number[2]);
45
+ ESP_LOGD(TAG, "Serial number: %" PRIu64, this->serial_number_);
45
46
 
46
47
  // Featureset identification for future use
47
48
  uint16_t raw_featureset;
@@ -61,11 +62,11 @@ void SGP30Component::setup() {
61
62
  this->mark_failed();
62
63
  return;
63
64
  }
64
- ESP_LOGD(TAG, "Product version: 0x%0X", uint16_t(this->featureset_ & 0x1FF));
65
+ ESP_LOGV(TAG, "Product version: 0x%0X", uint16_t(this->featureset_ & 0x1FF));
65
66
 
66
67
  // Sensor initialization
67
68
  if (!this->write_command(SGP30_CMD_IAQ_INIT)) {
68
- ESP_LOGE(TAG, "Sensor sgp30_iaq_init failed.");
69
+ ESP_LOGE(TAG, "sgp30_iaq_init failed");
69
70
  this->error_code_ = MEASUREMENT_INIT_FAILED;
70
71
  this->mark_failed();
71
72
  return;
@@ -123,7 +124,7 @@ void SGP30Component::read_iaq_baseline_() {
123
124
  uint16_t eco2baseline = (raw_data[0]);
124
125
  uint16_t tvocbaseline = (raw_data[1]);
125
126
 
126
- ESP_LOGI(TAG, "Current eCO2 baseline: 0x%04X, TVOC baseline: 0x%04X", eco2baseline, tvocbaseline);
127
+ ESP_LOGI(TAG, "Baselines: eCO2: 0x%04X, TVOC: 0x%04X", eco2baseline, tvocbaseline);
127
128
  if (eco2baseline != this->eco2_baseline_ || tvocbaseline != this->tvoc_baseline_) {
128
129
  this->eco2_baseline_ = eco2baseline;
129
130
  this->tvoc_baseline_ = tvocbaseline;
@@ -142,7 +143,7 @@ void SGP30Component::read_iaq_baseline_() {
142
143
  this->baselines_storage_.eco2 = this->eco2_baseline_;
143
144
  this->baselines_storage_.tvoc = this->tvoc_baseline_;
144
145
  if (this->pref_.save(&this->baselines_storage_)) {
145
- ESP_LOGI(TAG, "Store eCO2 baseline: 0x%04X, TVOC baseline: 0x%04X", this->baselines_storage_.eco2,
146
+ ESP_LOGI(TAG, "Store baselines: eCO2: 0x%04X, TVOC: 0x%04X", this->baselines_storage_.eco2,
146
147
  this->baselines_storage_.tvoc);
147
148
  } else {
148
149
  ESP_LOGW(TAG, "Could not store eCO2 and TVOC baselines");
@@ -164,7 +165,7 @@ void SGP30Component::send_env_data_() {
164
165
  if (this->humidity_sensor_ != nullptr)
165
166
  humidity = this->humidity_sensor_->state;
166
167
  if (std::isnan(humidity) || humidity < 0.0f || humidity > 100.0f) {
167
- ESP_LOGW(TAG, "Compensation not possible yet: bad humidity data.");
168
+ ESP_LOGW(TAG, "Compensation not possible yet: bad humidity data");
168
169
  return;
169
170
  } else {
170
171
  ESP_LOGD(TAG, "External compensation data received: Humidity %0.2f%%", humidity);
@@ -174,7 +175,7 @@ void SGP30Component::send_env_data_() {
174
175
  temperature = float(this->temperature_sensor_->state);
175
176
  }
176
177
  if (std::isnan(temperature) || temperature < -40.0f || temperature > 85.0f) {
177
- ESP_LOGW(TAG, "Compensation not possible yet: bad temperature value data.");
178
+ ESP_LOGW(TAG, "Compensation not possible yet: bad temperature value");
178
179
  return;
179
180
  } else {
180
181
  ESP_LOGD(TAG, "External compensation data received: Temperature %0.2f°C", temperature);
@@ -192,18 +193,17 @@ void SGP30Component::send_env_data_() {
192
193
  ((humidity * 0.061121f * std::exp((18.678f - temperature / 234.5f) * (temperature / (257.14f + temperature)))) /
193
194
  (273.15f + temperature));
194
195
  }
195
- uint8_t humidity_full = uint8_t(std::floor(absolute_humidity));
196
- uint8_t humidity_dec = uint8_t(std::floor((absolute_humidity - std::floor(absolute_humidity)) * 256));
197
- ESP_LOGD(TAG, "Calculated Absolute humidity: %0.3f g/m³ (0x%04X)", absolute_humidity,
198
- uint16_t(uint16_t(humidity_full) << 8 | uint16_t(humidity_dec)));
199
- uint8_t crc = sht_crc_(humidity_full, humidity_dec);
200
- uint8_t data[4];
201
- data[0] = SGP30_CMD_SET_ABSOLUTE_HUMIDITY & 0xFF;
202
- data[1] = humidity_full;
203
- data[2] = humidity_dec;
204
- data[3] = crc;
196
+ uint8_t data[4] = {
197
+ SGP30_CMD_SET_ABSOLUTE_HUMIDITY & 0xFF,
198
+ uint8_t(std::floor(absolute_humidity)), // humidity_full
199
+ uint8_t(std::floor((absolute_humidity - std::floor(absolute_humidity)) * 256)), // humidity_dec
200
+ 0,
201
+ };
202
+ data[3] = crc8(&data[1], 2, 0xFF, sensirion_common::CRC_POLYNOMIAL, true);
203
+ ESP_LOGD(TAG, "Calculated absolute humidity: %0.3f g/m³ (0x%04X)", absolute_humidity,
204
+ encode_uint16(data[1], data[2]));
205
205
  if (!this->write_bytes(SGP30_CMD_SET_ABSOLUTE_HUMIDITY >> 8, data, 4)) {
206
- ESP_LOGE(TAG, "Error sending compensation data.");
206
+ ESP_LOGE(TAG, "Error sending compensation data");
207
207
  }
208
208
  }
209
209
 
@@ -212,15 +212,14 @@ void SGP30Component::write_iaq_baseline_(uint16_t eco2_baseline, uint16_t tvoc_b
212
212
  data[0] = SGP30_CMD_SET_IAQ_BASELINE & 0xFF;
213
213
  data[1] = tvoc_baseline >> 8;
214
214
  data[2] = tvoc_baseline & 0xFF;
215
- data[3] = sht_crc_(data[1], data[2]);
215
+ data[3] = crc8(&data[1], 2, 0xFF, sensirion_common::CRC_POLYNOMIAL, true);
216
216
  data[4] = eco2_baseline >> 8;
217
217
  data[5] = eco2_baseline & 0xFF;
218
- data[6] = sht_crc_(data[4], data[5]);
218
+ data[6] = crc8(&data[4], 2, 0xFF, sensirion_common::CRC_POLYNOMIAL, true);
219
219
  if (!this->write_bytes(SGP30_CMD_SET_IAQ_BASELINE >> 8, data, 7)) {
220
- ESP_LOGE(TAG, "Error applying eCO2 baseline: 0x%04X, TVOC baseline: 0x%04X", eco2_baseline, tvoc_baseline);
220
+ ESP_LOGE(TAG, "Error applying baselines: eCO2: 0x%04X, TVOC: 0x%04X", eco2_baseline, tvoc_baseline);
221
221
  } else {
222
- ESP_LOGI(TAG, "Initial baselines applied successfully! eCO2 baseline: 0x%04X, TVOC baseline: 0x%04X", eco2_baseline,
223
- tvoc_baseline);
222
+ ESP_LOGI(TAG, "Initial baselines applied: eCO2: 0x%04X, TVOC: 0x%04X", eco2_baseline, tvoc_baseline);
224
223
  }
225
224
  }
226
225
 
@@ -236,10 +235,10 @@ void SGP30Component::dump_config() {
236
235
  ESP_LOGW(TAG, "Measurement Initialization failed");
237
236
  break;
238
237
  case INVALID_ID:
239
- ESP_LOGW(TAG, "Sensor reported an invalid ID. Is this an SGP30?");
238
+ ESP_LOGW(TAG, "Invalid ID");
240
239
  break;
241
240
  case UNSUPPORTED_ID:
242
- ESP_LOGW(TAG, "Sensor reported an unsupported ID (SGPC3)");
241
+ ESP_LOGW(TAG, "Unsupported ID");
243
242
  break;
244
243
  default:
245
244
  ESP_LOGW(TAG, "Unknown setup error");
@@ -249,12 +248,12 @@ void SGP30Component::dump_config() {
249
248
  ESP_LOGCONFIG(TAG, " Serial number: %" PRIu64, this->serial_number_);
250
249
  if (this->eco2_baseline_ != 0x0000 && this->tvoc_baseline_ != 0x0000) {
251
250
  ESP_LOGCONFIG(TAG,
252
- " Baseline:\n"
253
- " eCO2 Baseline: 0x%04X\n"
254
- " TVOC Baseline: 0x%04X",
251
+ " Baselines:\n"
252
+ " eCO2: 0x%04X\n"
253
+ " TVOC: 0x%04X",
255
254
  this->eco2_baseline_, this->tvoc_baseline_);
256
255
  } else {
257
- ESP_LOGCONFIG(TAG, " Baseline: No baseline configured");
256
+ ESP_LOGCONFIG(TAG, " Baselines not configured");
258
257
  }
259
258
  ESP_LOGCONFIG(TAG, " Warm up time: %" PRIu32 "s", this->required_warm_up_time_);
260
259
  }
@@ -266,8 +265,8 @@ void SGP30Component::dump_config() {
266
265
  ESP_LOGCONFIG(TAG, "Store baseline: %s", YESNO(this->store_baseline_));
267
266
  if (this->humidity_sensor_ != nullptr && this->temperature_sensor_ != nullptr) {
268
267
  ESP_LOGCONFIG(TAG, " Compensation:");
269
- LOG_SENSOR(" ", "Temperature Source:", this->temperature_sensor_);
270
- LOG_SENSOR(" ", "Humidity Source:", this->humidity_sensor_);
268
+ LOG_SENSOR(" ", "Temperature source:", this->temperature_sensor_);
269
+ LOG_SENSOR(" ", "Humidity source:", this->humidity_sensor_);
271
270
  } else {
272
271
  ESP_LOGCONFIG(TAG, " Compensation: No source configured");
273
272
  }
@@ -289,7 +288,7 @@ void SGP30Component::update() {
289
288
  float eco2 = (raw_data[0]);
290
289
  float tvoc = (raw_data[1]);
291
290
 
292
- ESP_LOGD(TAG, "Got eCO2=%.1fppm TVOC=%.1fppb", eco2, tvoc);
291
+ ESP_LOGV(TAG, "eCO2=%.1fppm TVOC=%.1fppb", eco2, tvoc);
293
292
  if (this->eco2_sensor_ != nullptr)
294
293
  this->eco2_sensor_->publish_state(eco2);
295
294
  if (this->tvoc_sensor_ != nullptr)
@@ -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/sensirion_common/i2c_sensirion.h"
4
+ #include "esphome/components/sensor/sensor.h"
5
+ #include "esphome/core/component.h"
6
6
  #include "esphome/core/preferences.h"
7
7
 
8
8
  #include <cinttypes>
@@ -38,14 +38,16 @@ class SGP30Component : public PollingComponent, public sensirion_common::Sensiri
38
38
  void read_iaq_baseline_();
39
39
  bool is_sensor_baseline_reliable_();
40
40
  void write_iaq_baseline_(uint16_t eco2_baseline, uint16_t tvoc_baseline);
41
+
41
42
  uint64_t serial_number_;
42
- uint16_t featureset_;
43
43
  uint32_t required_warm_up_time_;
44
44
  uint32_t seconds_since_last_store_;
45
- SGP30Baselines baselines_storage_;
46
- ESPPreferenceObject pref_;
45
+ uint16_t featureset_;
46
+ uint16_t eco2_baseline_{0x0000};
47
+ uint16_t tvoc_baseline_{0x0000};
48
+ bool store_baseline_;
47
49
 
48
- enum ErrorCode {
50
+ enum ErrorCode : uint8_t {
49
51
  COMMUNICATION_FAILED,
50
52
  MEASUREMENT_INIT_FAILED,
51
53
  INVALID_ID,
@@ -53,14 +55,13 @@ class SGP30Component : public PollingComponent, public sensirion_common::Sensiri
53
55
  UNKNOWN
54
56
  } error_code_{UNKNOWN};
55
57
 
58
+ ESPPreferenceObject pref_;
59
+ SGP30Baselines baselines_storage_;
60
+
56
61
  sensor::Sensor *eco2_sensor_{nullptr};
57
62
  sensor::Sensor *tvoc_sensor_{nullptr};
58
63
  sensor::Sensor *eco2_sensor_baseline_{nullptr};
59
64
  sensor::Sensor *tvoc_sensor_baseline_{nullptr};
60
- uint16_t eco2_baseline_{0x0000};
61
- uint16_t tvoc_baseline_{0x0000};
62
- bool store_baseline_;
63
-
64
65
  /// Input sensor for humidity and temperature compensation.
65
66
  sensor::Sensor *humidity_sensor_{nullptr};
66
67
  sensor::Sensor *temperature_sensor_{nullptr};
@@ -211,7 +211,7 @@ void SGP4xComponent::measure_raw_() {
211
211
 
212
212
  if (!this->write_command(command, data, 2)) {
213
213
  ESP_LOGD(TAG, "write error (%d)", this->last_error_);
214
- this->status_set_warning("measurement request failed");
214
+ this->status_set_warning(LOG_STR("measurement request failed"));
215
215
  return;
216
216
  }
217
217
 
@@ -220,7 +220,7 @@ void SGP4xComponent::measure_raw_() {
220
220
  raw_data[1] = 0;
221
221
  if (!this->read_data(raw_data, response_words)) {
222
222
  ESP_LOGD(TAG, "read error (%d)", this->last_error_);
223
- this->status_set_warning("measurement read failed");
223
+ this->status_set_warning(LOG_STR("measurement read failed"));
224
224
  this->voc_index_ = this->nox_index_ = UINT16_MAX;
225
225
  return;
226
226
  }
@@ -183,7 +183,7 @@ CONFIG_SCHEMA = (
183
183
  )
184
184
 
185
185
 
186
- def to_code(config):
186
+ async def to_code(config):
187
187
  fw_hex = get_firmware(config[CONF_FIRMWARE])
188
188
  fw_major, fw_minor = parse_firmware_version(config[CONF_FIRMWARE][CONF_VERSION])
189
189
 
@@ -193,17 +193,17 @@ def to_code(config):
193
193
  cg.add_define("USE_SHD_FIRMWARE_MINOR_VERSION", fw_minor)
194
194
 
195
195
  var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
196
- yield cg.register_component(var, config)
196
+ await cg.register_component(var, config)
197
197
  config.pop(
198
198
  CONF_UPDATE_INTERVAL
199
199
  ) # drop UPDATE_INTERVAL as it does not apply to the light component
200
200
 
201
- yield light.register_light(var, config)
202
- yield uart.register_uart_device(var, config)
201
+ await light.register_light(var, config)
202
+ await uart.register_uart_device(var, config)
203
203
 
204
- nrst_pin = yield cg.gpio_pin_expression(config[CONF_NRST_PIN])
204
+ nrst_pin = await cg.gpio_pin_expression(config[CONF_NRST_PIN])
205
205
  cg.add(var.set_nrst_pin(nrst_pin))
206
- boot0_pin = yield cg.gpio_pin_expression(config[CONF_BOOT0_PIN])
206
+ boot0_pin = await cg.gpio_pin_expression(config[CONF_BOOT0_PIN])
207
207
  cg.add(var.set_boot0_pin(boot0_pin))
208
208
 
209
209
  cg.add(var.set_leading_edge(config[CONF_LEADING_EDGE]))
@@ -217,5 +217,5 @@ def to_code(config):
217
217
  continue
218
218
 
219
219
  conf = config[key]
220
- sens = yield sensor.new_sensor(conf)
220
+ sens = await sensor.new_sensor(conf)
221
221
  cg.add(getattr(var, f"set_{key}_sensor")(sens))
@@ -65,7 +65,7 @@ void SHT4XComponent::update() {
65
65
  // Send command
66
66
  if (!this->write_command(MEASURECOMMANDS[this->precision_])) {
67
67
  // Warning will be printed only if warning status is not set yet
68
- this->status_set_warning("Failed to send measurement command");
68
+ this->status_set_warning(LOG_STR("Failed to send measurement command"));
69
69
  return;
70
70
  }
71
71
 
@@ -14,8 +14,13 @@ namespace sntp {
14
14
 
15
15
  static const char *const TAG = "sntp";
16
16
 
17
+ #if defined(USE_ESP32)
18
+ SNTPComponent *SNTPComponent::instance = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
19
+ #endif
20
+
17
21
  void SNTPComponent::setup() {
18
22
  #if defined(USE_ESP32)
23
+ SNTPComponent::instance = this;
19
24
  if (esp_sntp_enabled()) {
20
25
  esp_sntp_stop();
21
26
  }
@@ -25,6 +30,11 @@ void SNTPComponent::setup() {
25
30
  esp_sntp_setservername(i++, server.c_str());
26
31
  }
27
32
  esp_sntp_set_sync_interval(this->get_update_interval());
33
+ esp_sntp_set_time_sync_notification_cb([](struct timeval *tv) {
34
+ if (SNTPComponent::instance != nullptr) {
35
+ SNTPComponent::instance->defer([]() { SNTPComponent::instance->time_synced(); });
36
+ }
37
+ });
28
38
  esp_sntp_init();
29
39
  #else
30
40
  sntp_stop();
@@ -34,6 +44,14 @@ void SNTPComponent::setup() {
34
44
  for (auto &server : this->servers_) {
35
45
  sntp_setservername(i++, server.c_str());
36
46
  }
47
+
48
+ #if defined(USE_ESP8266)
49
+ settimeofday_cb([this](bool from_sntp) {
50
+ if (from_sntp)
51
+ this->time_synced();
52
+ });
53
+ #endif
54
+
37
55
  sntp_init();
38
56
  #endif
39
57
  }
@@ -46,7 +64,8 @@ void SNTPComponent::dump_config() {
46
64
  }
47
65
  void SNTPComponent::update() {
48
66
  #if !defined(USE_ESP32)
49
- // force resync
67
+ // Some platforms currently cannot set the sync interval at runtime so we need
68
+ // to do the re-sync by hand for now.
50
69
  if (sntp_enabled()) {
51
70
  sntp_stop();
52
71
  this->has_time_ = false;
@@ -55,23 +74,31 @@ void SNTPComponent::update() {
55
74
  #endif
56
75
  }
57
76
  void SNTPComponent::loop() {
77
+ // The loop is used to infer whether we have valid time on platforms where we
78
+ // cannot tell whether SNTP has succeeded.
79
+ // One limitation of this approach is that we cannot tell if it was the SNTP
80
+ // component that set the time.
81
+ // ESP-IDF and ESP8266 use callbacks from the SNTP task to trigger the
82
+ // `on_time_sync` trigger on successful sync events.
83
+ #if defined(USE_ESP32) || defined(USE_ESP8266)
84
+ this->disable_loop();
85
+ #endif
86
+
58
87
  if (this->has_time_)
59
88
  return;
60
89
 
90
+ this->time_synced();
91
+ }
92
+
93
+ void SNTPComponent::time_synced() {
61
94
  auto time = this->now();
62
- if (!time.is_valid())
95
+ this->has_time_ = time.is_valid();
96
+ if (!this->has_time_)
63
97
  return;
64
98
 
65
99
  ESP_LOGD(TAG, "Synchronized time: %04d-%02d-%02d %02d:%02d:%02d", time.year, time.month, time.day_of_month, time.hour,
66
100
  time.minute, time.second);
67
101
  this->time_sync_callback_.call();
68
- this->has_time_ = true;
69
-
70
- #ifdef USE_ESP_IDF
71
- // On ESP-IDF, time sync is permanent and update() doesn't force resync
72
- // Time is now synchronized, no need to check anymore
73
- this->disable_loop();
74
- #endif
75
102
  }
76
103
 
77
104
  } // namespace sntp
@@ -26,9 +26,16 @@ class SNTPComponent : public time::RealTimeClock {
26
26
  void update() override;
27
27
  void loop() override;
28
28
 
29
+ void time_synced();
30
+
29
31
  protected:
30
32
  std::vector<std::string> servers_;
31
33
  bool has_time_{false};
34
+
35
+ #if defined(USE_ESP32)
36
+ private:
37
+ static SNTPComponent *instance;
38
+ #endif
32
39
  };
33
40
 
34
41
  } // namespace sntp
@@ -56,7 +56,7 @@ void SoundLevelComponent::loop() {
56
56
  }
57
57
  } else {
58
58
  if (!this->status_has_warning()) {
59
- this->status_set_warning("Microphone isn't running, can't compute statistics");
59
+ this->status_set_warning(LOG_STR("Microphone isn't running, can't compute statistics"));
60
60
 
61
61
  // Deallocate buffers, if necessary
62
62
  this->stop_();
@@ -4,7 +4,7 @@ from esphome.components import audio, audio_dac
4
4
  import esphome.config_validation as cv
5
5
  from esphome.const import CONF_DATA, CONF_ID, CONF_VOLUME
6
6
  from esphome.core import CORE
7
- from esphome.coroutine import coroutine_with_priority
7
+ from esphome.coroutine import CoroPriority, coroutine_with_priority
8
8
 
9
9
  AUTO_LOAD = ["audio"]
10
10
  CODEOWNERS = ["@jesserockz", "@kahrendt"]
@@ -138,7 +138,7 @@ async def speaker_mute_action_to_code(config, action_id, template_arg, args):
138
138
  return cg.new_Pvariable(action_id, template_arg, paren)
139
139
 
140
140
 
141
- @coroutine_with_priority(100.0)
141
+ @coroutine_with_priority(CoroPriority.CORE)
142
142
  async def to_code(config):
143
143
  cg.add_global(speaker_ns.using)
144
144
  cg.add_define("USE_SPEAKER")
@@ -147,7 +147,7 @@ def _read_audio_file_and_type(file_config):
147
147
  elif file_source == TYPE_WEB:
148
148
  path = _compute_local_file_path(conf_file)
149
149
  else:
150
- raise cv.Invalid("Unsupported file source.")
150
+ raise cv.Invalid("Unsupported file source")
151
151
 
152
152
  with open(path, "rb") as f:
153
153
  data = f.read()
@@ -219,7 +219,7 @@ def _validate_supported_local_file(config):
219
219
  for file_config in config.get(CONF_FILES, []):
220
220
  _, media_file_type = _read_audio_file_and_type(file_config)
221
221
  if str(media_file_type) == str(audio.AUDIO_FILE_TYPE_ENUM["NONE"]):
222
- raise cv.Invalid("Unsupported local media file.")
222
+ raise cv.Invalid("Unsupported local media file")
223
223
  if not config[CONF_CODEC_SUPPORT_ENABLED] and str(media_file_type) != str(
224
224
  audio.AUDIO_FILE_TYPE_ENUM["WAV"]
225
225
  ):
@@ -55,7 +55,7 @@ void SpeakerMediaPlayer::setup() {
55
55
 
56
56
  this->media_control_command_queue_ = xQueueCreate(MEDIA_CONTROLS_QUEUE_LENGTH, sizeof(MediaCallCommand));
57
57
 
58
- this->pref_ = global_preferences->make_preference<VolumeRestoreState>(this->get_object_id_hash());
58
+ this->pref_ = global_preferences->make_preference<VolumeRestoreState>(this->get_preference_hash());
59
59
 
60
60
  VolumeRestoreState volume_restore_state;
61
61
  if (this->pref_.load(&volume_restore_state)) {
@@ -35,7 +35,7 @@ from esphome.const import (
35
35
  PLATFORM_RP2040,
36
36
  PlatformFramework,
37
37
  )
38
- from esphome.core import CORE, coroutine_with_priority
38
+ from esphome.core import CORE, CoroPriority, coroutine_with_priority
39
39
  import esphome.final_validate as fv
40
40
 
41
41
  CODEOWNERS = ["@esphome/core", "@clydebarrow"]
@@ -351,7 +351,7 @@ CONFIG_SCHEMA = cv.All(
351
351
  )
352
352
 
353
353
 
354
- @coroutine_with_priority(1.0)
354
+ @coroutine_with_priority(CoroPriority.BUS)
355
355
  async def to_code(configs):
356
356
  cg.add_define("USE_SPI")
357
357
  cg.add_global(spi_ns.using)
@@ -81,7 +81,7 @@ void SprinklerControllerNumber::setup() {
81
81
  if (!this->restore_value_) {
82
82
  value = this->initial_value_;
83
83
  } else {
84
- this->pref_ = global_preferences->make_preference<float>(this->get_object_id_hash());
84
+ this->pref_ = global_preferences->make_preference<float>(this->get_preference_hash());
85
85
  if (!this->pref_.load(&value)) {
86
86
  if (!std::isnan(this->initial_value_)) {
87
87
  value = this->initial_value_;
@@ -43,20 +43,20 @@ void SPS30Component::setup() {
43
43
  this->serial_number_[i * 2] = static_cast<char>(raw_serial_number[i] >> 8);
44
44
  this->serial_number_[i * 2 + 1] = uint16_t(uint16_t(raw_serial_number[i] & 0xFF));
45
45
  }
46
- ESP_LOGD(TAG, " Serial Number: '%s'", this->serial_number_);
46
+ ESP_LOGV(TAG, " Serial number: %s", this->serial_number_);
47
47
 
48
48
  bool result;
49
49
  if (this->fan_interval_.has_value()) {
50
50
  // override default value
51
- result = write_command(SPS30_CMD_SET_AUTOMATIC_CLEANING_INTERVAL_SECONDS, this->fan_interval_.value());
51
+ result = this->write_command(SPS30_CMD_SET_AUTOMATIC_CLEANING_INTERVAL_SECONDS, this->fan_interval_.value());
52
52
  } else {
53
- result = write_command(SPS30_CMD_SET_AUTOMATIC_CLEANING_INTERVAL_SECONDS);
53
+ result = this->write_command(SPS30_CMD_SET_AUTOMATIC_CLEANING_INTERVAL_SECONDS);
54
54
  }
55
55
  if (result) {
56
56
  delay(20);
57
57
  uint16_t secs[2];
58
58
  if (this->read_data(secs, 2)) {
59
- fan_interval_ = secs[0] << 16 | secs[1];
59
+ this->fan_interval_ = secs[0] << 16 | secs[1];
60
60
  }
61
61
  }
62
62
 
@@ -67,7 +67,7 @@ void SPS30Component::setup() {
67
67
  }
68
68
 
69
69
  void SPS30Component::dump_config() {
70
- ESP_LOGCONFIG(TAG, "sps30:");
70
+ ESP_LOGCONFIG(TAG, "SPS30:");
71
71
  LOG_I2C_DEVICE(this);
72
72
  if (this->is_failed()) {
73
73
  switch (this->error_code_) {
@@ -78,16 +78,16 @@ void SPS30Component::dump_config() {
78
78
  ESP_LOGW(TAG, "Measurement Initialization failed");
79
79
  break;
80
80
  case SERIAL_NUMBER_REQUEST_FAILED:
81
- ESP_LOGW(TAG, "Unable to request sensor serial number");
81
+ ESP_LOGW(TAG, "Unable to request serial number");
82
82
  break;
83
83
  case SERIAL_NUMBER_READ_FAILED:
84
- ESP_LOGW(TAG, "Unable to read sensor serial number");
84
+ ESP_LOGW(TAG, "Unable to read serial number");
85
85
  break;
86
86
  case FIRMWARE_VERSION_REQUEST_FAILED:
87
- ESP_LOGW(TAG, "Unable to request sensor firmware version");
87
+ ESP_LOGW(TAG, "Unable to request firmware version");
88
88
  break;
89
89
  case FIRMWARE_VERSION_READ_FAILED:
90
- ESP_LOGW(TAG, "Unable to read sensor firmware version");
90
+ ESP_LOGW(TAG, "Unable to read firmware version");
91
91
  break;
92
92
  default:
93
93
  ESP_LOGW(TAG, "Unknown setup error");
@@ -96,9 +96,9 @@ void SPS30Component::dump_config() {
96
96
  }
97
97
  LOG_UPDATE_INTERVAL(this);
98
98
  ESP_LOGCONFIG(TAG,
99
- " Serial Number: '%s'\n"
99
+ " Serial number: %s\n"
100
100
  " Firmware version v%0d.%0d",
101
- this->serial_number_, (raw_firmware_version_ >> 8), uint16_t(raw_firmware_version_ & 0xFF));
101
+ this->serial_number_, this->raw_firmware_version_ >> 8, this->raw_firmware_version_ & 0xFF);
102
102
  LOG_SENSOR(" ", "PM1.0 Weight Concentration", this->pm_1_0_sensor_);
103
103
  LOG_SENSOR(" ", "PM2.5 Weight Concentration", this->pm_2_5_sensor_);
104
104
  LOG_SENSOR(" ", "PM4 Weight Concentration", this->pm_4_0_sensor_);
@@ -113,15 +113,15 @@ void SPS30Component::dump_config() {
113
113
  void SPS30Component::update() {
114
114
  /// Check if warning flag active (sensor reconnected?)
115
115
  if (this->status_has_warning()) {
116
- ESP_LOGD(TAG, "Trying to reconnect");
116
+ ESP_LOGD(TAG, "Reconnecting");
117
117
  if (this->write_command(SPS30_CMD_SOFT_RESET)) {
118
- ESP_LOGD(TAG, "Soft-reset successful. Waiting for reconnection in 500 ms");
118
+ ESP_LOGD(TAG, "Soft-reset successful; waiting 500 ms");
119
119
  this->set_timeout(500, [this]() {
120
120
  this->start_continuous_measurement_();
121
121
  /// Sensor restarted and reading attempt made next cycle
122
122
  this->status_clear_warning();
123
123
  this->skipped_data_read_cycles_ = 0;
124
- ESP_LOGD(TAG, "Reconnect successful. Resuming continuous measurement");
124
+ ESP_LOGD(TAG, "Reconnected; resuming continuous measurement");
125
125
  });
126
126
  } else {
127
127
  ESP_LOGD(TAG, "Soft-reset failed");
@@ -136,12 +136,12 @@ void SPS30Component::update() {
136
136
 
137
137
  uint16_t raw_read_status;
138
138
  if (!this->read_data(&raw_read_status, 1) || raw_read_status == 0x00) {
139
- ESP_LOGD(TAG, "Not ready yet");
139
+ ESP_LOGD(TAG, "Not ready");
140
140
  this->skipped_data_read_cycles_++;
141
141
  /// The following logic is required to address the cases when a sensor is quickly replaced before it's marked
142
142
  /// as failed so that new sensor is eventually forced to be reinitialized for continuous measurement.
143
143
  if (this->skipped_data_read_cycles_ > MAX_SKIPPED_DATA_CYCLES_BEFORE_ERROR) {
144
- ESP_LOGD(TAG, "Exceeded max allowed attempts; communication will be reinitialized");
144
+ ESP_LOGD(TAG, "Exceeded max attempts; will reinitialize");
145
145
  this->status_set_warning();
146
146
  }
147
147
  return;
@@ -211,11 +211,6 @@ void SPS30Component::update() {
211
211
  }
212
212
 
213
213
  bool SPS30Component::start_continuous_measurement_() {
214
- uint8_t data[4];
215
- data[0] = SPS30_CMD_START_CONTINUOUS_MEASUREMENTS & 0xFF;
216
- data[1] = 0x03;
217
- data[2] = 0x00;
218
- data[3] = sht_crc_(0x03, 0x00);
219
214
  if (!this->write_command(SPS30_CMD_START_CONTINUOUS_MEASUREMENTS, SPS30_CMD_START_CONTINUOUS_MEASUREMENTS_ARG)) {
220
215
  ESP_LOGE(TAG, "Error initiating measurements");
221
216
  return false;
@@ -224,9 +219,9 @@ bool SPS30Component::start_continuous_measurement_() {
224
219
  }
225
220
 
226
221
  bool SPS30Component::start_fan_cleaning() {
227
- if (!write_command(SPS30_CMD_START_FAN_CLEANING)) {
222
+ if (!this->write_command(SPS30_CMD_START_FAN_CLEANING)) {
228
223
  this->status_set_warning();
229
- ESP_LOGE(TAG, "write error start fan (%d)", this->last_error_);
224
+ ESP_LOGE(TAG, "Start fan cleaning failed (%d)", this->last_error_);
230
225
  return false;
231
226
  } else {
232
227
  ESP_LOGD(TAG, "Fan auto clean started");
@@ -30,12 +30,12 @@ class SPS30Component : public PollingComponent, public sensirion_common::Sensiri
30
30
  bool start_fan_cleaning();
31
31
 
32
32
  protected:
33
- char serial_number_[17] = {0}; /// Terminating NULL character
34
33
  uint16_t raw_firmware_version_;
35
- bool start_continuous_measurement_();
34
+ char serial_number_[17] = {0}; /// Terminating NULL character
36
35
  uint8_t skipped_data_read_cycles_ = 0;
36
+ bool start_continuous_measurement_();
37
37
 
38
- enum ErrorCode {
38
+ enum ErrorCode : uint8_t {
39
39
  COMMUNICATION_FAILED,
40
40
  FIRMWARE_VERSION_REQUEST_FAILED,
41
41
  FIRMWARE_VERSION_READ_FAILED,
@@ -2,7 +2,7 @@ from esphome import pins
2
2
  import esphome.codegen as cg
3
3
  import esphome.config_validation as cv
4
4
  from esphome.const import CONF_ID, CONF_PIN
5
- from esphome.core import coroutine_with_priority
5
+ from esphome.core import CoroPriority, coroutine_with_priority
6
6
 
7
7
  status_led_ns = cg.esphome_ns.namespace("status_led")
8
8
  StatusLED = status_led_ns.class_("StatusLED", cg.Component)
@@ -15,7 +15,7 @@ CONFIG_SCHEMA = cv.Schema(
15
15
  ).extend(cv.COMPONENT_SCHEMA)
16
16
 
17
17
 
18
- @coroutine_with_priority(80.0)
18
+ @coroutine_with_priority(CoroPriority.STATUS)
19
19
  async def to_code(config):
20
20
  pin = await cg.gpio_pin_expression(config[CONF_PIN])
21
21
  rhs = StatusLED.new(pin)
@@ -10,7 +10,7 @@ from esphome.const import (
10
10
  CONF_SPEED,
11
11
  CONF_TARGET,
12
12
  )
13
- from esphome.core import CORE, coroutine_with_priority
13
+ from esphome.core import CORE, CoroPriority, coroutine_with_priority
14
14
 
15
15
  IS_PLATFORM_COMPONENT = True
16
16
 
@@ -178,6 +178,6 @@ async def stepper_set_deceleration_to_code(config, action_id, template_arg, args
178
178
  return var
179
179
 
180
180
 
181
- @coroutine_with_priority(100.0)
181
+ @coroutine_with_priority(CoroPriority.CORE)
182
182
  async def to_code(config):
183
183
  cg.add_global(stepper_ns.using)