esphome 2024.7.2__py3-none-any.whl → 2024.8.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 (353) hide show
  1. esphome/__main__.py +15 -81
  2. esphome/automation.py +1 -1
  3. esphome/codegen.py +53 -53
  4. esphome/components/ade7953/sensor.py +1 -1
  5. esphome/components/ade7953_spi/ade7953_spi.cpp +1 -1
  6. esphome/components/airthings_wave_plus/airthings_wave_plus.cpp +5 -2
  7. esphome/components/airthings_wave_plus/airthings_wave_plus.h +2 -0
  8. esphome/components/airthings_wave_plus/sensor.py +12 -0
  9. esphome/components/alarm_control_panel/__init__.py +75 -66
  10. esphome/components/apds9306/__init__.py +4 -0
  11. esphome/components/apds9306/apds9306.cpp +151 -0
  12. esphome/components/apds9306/apds9306.h +66 -0
  13. esphome/components/apds9306/sensor.py +95 -0
  14. esphome/components/api/__init__.py +80 -52
  15. esphome/components/api/api_connection.cpp +14 -1
  16. esphome/components/api/api_pb2.cpp +33 -4
  17. esphome/components/api/api_pb2.h +8 -1
  18. esphome/components/api/api_server.cpp +10 -0
  19. esphome/components/api/api_server.h +3 -0
  20. esphome/components/atm90e32/__init__.py +7 -0
  21. esphome/components/atm90e32/atm90e32.cpp +68 -16
  22. esphome/components/atm90e32/atm90e32.h +20 -7
  23. esphome/components/atm90e32/atm90e32_reg.h +2 -0
  24. esphome/components/atm90e32/button/__init__.py +43 -0
  25. esphome/components/atm90e32/button/atm90e32_button.cpp +20 -0
  26. esphome/components/atm90e32/button/atm90e32_button.h +27 -0
  27. esphome/components/atm90e32/sensor.py +15 -11
  28. esphome/components/bedjet/bedjet_codec.h +1 -1
  29. esphome/components/binary/light/binary_light_output.h +3 -2
  30. esphome/components/binary_sensor/__init__.py +5 -5
  31. esphome/components/ble_client/__init__.py +3 -3
  32. esphome/components/ble_client/output/__init__.py +1 -1
  33. esphome/components/ble_client/sensor/__init__.py +4 -3
  34. esphome/components/ble_client/switch/__init__.py +2 -1
  35. esphome/components/ble_client/text_sensor/__init__.py +4 -3
  36. esphome/components/ble_presence/binary_sensor.py +3 -3
  37. esphome/components/ble_rssi/sensor.py +2 -2
  38. esphome/components/ble_scanner/text_sensor.py +1 -1
  39. esphome/components/bluetooth_proxy/__init__.py +3 -3
  40. esphome/components/bme68x_bsec2/__init__.py +196 -0
  41. esphome/components/bme68x_bsec2/bme68x_bsec2.cpp +523 -0
  42. esphome/components/bme68x_bsec2/bme68x_bsec2.h +163 -0
  43. esphome/components/bme68x_bsec2/sensor.py +130 -0
  44. esphome/components/bme68x_bsec2/text_sensor.py +33 -0
  45. esphome/components/bme68x_bsec2_i2c/__init__.py +28 -0
  46. esphome/components/bme68x_bsec2_i2c/bme68x_bsec2_i2c.cpp +53 -0
  47. esphome/components/bme68x_bsec2_i2c/bme68x_bsec2_i2c.h +28 -0
  48. esphome/components/bmp3xx/sensor.py +1 -1
  49. esphome/components/button/__init__.py +4 -4
  50. esphome/components/climate/__init__.py +5 -5
  51. esphome/components/climate/climate.h +1 -1
  52. esphome/components/cover/__init__.py +8 -8
  53. esphome/components/cst226/touchscreen/cst226_touchscreen.cpp +11 -7
  54. esphome/components/cst226/touchscreen/cst226_touchscreen.h +1 -1
  55. esphome/components/datetime/__init__.py +11 -13
  56. esphome/components/demo/demo_sensor.h +3 -2
  57. esphome/components/display/display.cpp +31 -0
  58. esphome/components/display/display.h +3 -0
  59. esphome/components/display_menu_base/__init__.py +14 -13
  60. esphome/components/ens160/sensor.py +1 -1
  61. esphome/components/esp32/__init__.py +22 -10
  62. esphome/components/esp32/boards.py +1 -1
  63. esphome/components/esp32/gpio.py +12 -13
  64. esphome/components/esp32/gpio_esp32.py +1 -2
  65. esphome/components/esp32/gpio_esp32_c2.py +1 -2
  66. esphome/components/esp32/gpio_esp32_c3.py +1 -5
  67. esphome/components/esp32/gpio_esp32_c6.py +1 -2
  68. esphome/components/esp32/gpio_esp32_h2.py +1 -2
  69. esphome/components/esp32/gpio_esp32_s2.py +1 -2
  70. esphome/components/esp32/gpio_esp32_s3.py +1 -6
  71. esphome/components/esp32_ble/__init__.py +20 -3
  72. esphome/components/esp32_ble/ble.cpp +9 -1
  73. esphome/components/esp32_ble/ble.h +9 -0
  74. esphome/components/esp32_ble/ble_advertising.cpp +42 -9
  75. esphome/components/esp32_ble/ble_advertising.h +21 -1
  76. esphome/components/esp32_ble_beacon/__init__.py +17 -7
  77. esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +45 -113
  78. esphome/components/esp32_ble_beacon/esp32_ble_beacon.h +17 -19
  79. esphome/components/esp32_ble_client/__init__.py +0 -1
  80. esphome/components/esp32_ble_server/__init__.py +2 -3
  81. esphome/components/esp32_ble_tracker/__init__.py +2 -2
  82. esphome/components/esp32_improv/__init__.py +2 -4
  83. esphome/components/ethernet/__init__.py +17 -17
  84. esphome/components/ethernet_info/text_sensor.py +2 -2
  85. esphome/components/event/__init__.py +5 -5
  86. esphome/components/fan/__init__.py +14 -14
  87. esphome/components/fan/fan.cpp +2 -2
  88. esphome/components/fingerprint_grow/fingerprint_grow.cpp +1 -1
  89. esphome/components/fingerprint_grow/fingerprint_grow.h +1 -1
  90. esphome/components/graphical_display_menu/__init__.py +11 -8
  91. esphome/components/haier/haier_base.h +2 -2
  92. esphome/components/homeassistant/__init__.py +8 -1
  93. esphome/components/homeassistant/number/__init__.py +33 -0
  94. esphome/components/homeassistant/number/homeassistant_number.cpp +100 -0
  95. esphome/components/homeassistant/number/homeassistant_number.h +31 -0
  96. esphome/components/homeassistant/switch/__init__.py +30 -0
  97. esphome/components/homeassistant/switch/homeassistant_switch.cpp +59 -0
  98. esphome/components/homeassistant/switch/homeassistant_switch.h +22 -0
  99. esphome/components/host/__init__.py +3 -7
  100. esphome/components/http_request/__init__.py +12 -1
  101. esphome/components/http_request/http_request_arduino.cpp +2 -2
  102. esphome/components/http_request/http_request_idf.cpp +11 -2
  103. esphome/components/http_request/http_request_idf.h +10 -0
  104. esphome/components/http_request/ota/ota_http_request.cpp +1 -1
  105. esphome/components/http_request/update/http_request_update.cpp +2 -2
  106. esphome/components/http_request/update/http_request_update.h +2 -1
  107. esphome/components/hx711/hx711.cpp +10 -1
  108. esphome/components/hydreon_rgxx/hydreon_rgxx.cpp +1 -1
  109. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +11 -2
  110. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +2 -0
  111. esphome/components/ili9xxx/ili9xxx_defines.h +3 -1
  112. esphome/components/ili9xxx/ili9xxx_display.cpp +9 -22
  113. esphome/components/ili9xxx/ili9xxx_display.h +5 -7
  114. esphome/components/ili9xxx/ili9xxx_init.h +4 -4
  115. esphome/components/improv_base/__init__.py +2 -3
  116. esphome/components/improv_serial/__init__.py +4 -10
  117. esphome/components/improv_serial/improv_serial_component.cpp +4 -0
  118. esphome/components/jsn_sr04t/jsn_sr04t.cpp +18 -1
  119. esphome/components/jsn_sr04t/jsn_sr04t.h +7 -1
  120. esphome/components/jsn_sr04t/sensor.py +13 -0
  121. esphome/components/kalman_combinator/sensor.py +1 -1
  122. esphome/components/light/__init__.py +16 -15
  123. esphome/components/light/addressable_light_effect.h +12 -8
  124. esphome/components/light/automation.h +16 -1
  125. esphome/components/light/automation.py +21 -0
  126. esphome/components/light/base_light_effects.h +5 -5
  127. esphome/components/light/esp_color_correction.h +8 -8
  128. esphome/components/light/types.py +7 -0
  129. esphome/components/lock/__init__.py +3 -3
  130. esphome/components/logger/__init__.py +15 -18
  131. esphome/components/lvgl/__init__.py +346 -0
  132. esphome/components/lvgl/automation.py +226 -0
  133. esphome/components/lvgl/binary_sensor/__init__.py +43 -0
  134. esphome/components/lvgl/defines.py +508 -0
  135. esphome/components/lvgl/encoders.py +77 -0
  136. esphome/components/lvgl/font.cpp +76 -0
  137. esphome/components/lvgl/helpers.py +49 -0
  138. esphome/components/lvgl/light/__init__.py +32 -0
  139. esphome/components/lvgl/light/lvgl_light.h +48 -0
  140. esphome/components/lvgl/lv_validation.py +303 -0
  141. esphome/components/lvgl/lvcode.py +349 -0
  142. esphome/components/lvgl/lvgl_esphome.cpp +407 -0
  143. esphome/components/lvgl/lvgl_esphome.h +274 -0
  144. esphome/components/lvgl/lvgl_hal.h +21 -0
  145. esphome/components/lvgl/number/__init__.py +66 -0
  146. esphome/components/lvgl/number/lvgl_number.h +34 -0
  147. esphome/components/lvgl/schemas.py +436 -0
  148. esphome/components/lvgl/select/__init__.py +55 -0
  149. esphome/components/lvgl/select/lvgl_select.h +62 -0
  150. esphome/components/lvgl/sensor/__init__.py +47 -0
  151. esphome/components/lvgl/styles.py +58 -0
  152. esphome/components/lvgl/switch/__init__.py +56 -0
  153. esphome/components/lvgl/switch/lvgl_switch.h +34 -0
  154. esphome/components/lvgl/text/__init__.py +50 -0
  155. esphome/components/lvgl/text/lvgl_text.h +34 -0
  156. esphome/components/lvgl/text_sensor/__init__.py +42 -0
  157. esphome/components/lvgl/touchscreens.py +45 -0
  158. esphome/components/lvgl/trigger.py +74 -0
  159. esphome/components/lvgl/types.py +191 -0
  160. esphome/components/lvgl/widgets/__init__.py +419 -0
  161. esphome/components/lvgl/widgets/animimg.py +117 -0
  162. esphome/components/lvgl/widgets/arc.py +78 -0
  163. esphome/components/lvgl/widgets/button.py +20 -0
  164. esphome/components/lvgl/widgets/buttonmatrix.py +275 -0
  165. esphome/components/lvgl/widgets/checkbox.py +27 -0
  166. esphome/components/lvgl/widgets/dropdown.py +76 -0
  167. esphome/components/lvgl/widgets/img.py +85 -0
  168. esphome/components/lvgl/widgets/keyboard.py +49 -0
  169. esphome/components/lvgl/widgets/label.py +42 -0
  170. esphome/components/lvgl/widgets/led.py +29 -0
  171. esphome/components/lvgl/widgets/line.py +50 -0
  172. esphome/components/lvgl/widgets/lv_bar.py +55 -0
  173. esphome/components/lvgl/widgets/meter.py +302 -0
  174. esphome/components/lvgl/widgets/msgbox.py +134 -0
  175. esphome/components/lvgl/widgets/obj.py +28 -0
  176. esphome/components/lvgl/widgets/page.py +113 -0
  177. esphome/components/lvgl/widgets/roller.py +77 -0
  178. esphome/components/lvgl/widgets/slider.py +63 -0
  179. esphome/components/lvgl/widgets/spinbox.py +178 -0
  180. esphome/components/lvgl/widgets/spinner.py +43 -0
  181. esphome/components/lvgl/widgets/switch.py +20 -0
  182. esphome/components/lvgl/widgets/tabview.py +114 -0
  183. esphome/components/lvgl/widgets/textarea.py +66 -0
  184. esphome/components/lvgl/widgets/tileview.py +128 -0
  185. esphome/components/m5stack_8angle/__init__.py +33 -0
  186. esphome/components/m5stack_8angle/binary_sensor/__init__.py +30 -0
  187. esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.cpp +17 -0
  188. esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.h +19 -0
  189. esphome/components/m5stack_8angle/light/__init__.py +31 -0
  190. esphome/components/m5stack_8angle/light/m5stack_8angle_light.cpp +45 -0
  191. esphome/components/m5stack_8angle/light/m5stack_8angle_light.h +37 -0
  192. esphome/components/m5stack_8angle/m5stack_8angle.cpp +74 -0
  193. esphome/components/m5stack_8angle/m5stack_8angle.h +34 -0
  194. esphome/components/m5stack_8angle/sensor/__init__.py +66 -0
  195. esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.cpp +24 -0
  196. esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.h +27 -0
  197. esphome/components/matrix_keypad/matrix_keypad.cpp +2 -0
  198. esphome/components/max31856/sensor.py +5 -5
  199. esphome/components/media_player/__init__.py +3 -5
  200. esphome/components/media_player/automation.h +31 -27
  201. esphome/components/micro_wake_word/__init__.py +20 -25
  202. esphome/components/micro_wake_word/streaming_model.cpp +6 -4
  203. esphome/components/microphone/microphone.h +4 -1
  204. esphome/components/mitsubishi/mitsubishi.cpp +7 -1
  205. esphome/components/modbus_controller/__init__.py +26 -2
  206. esphome/components/modbus_controller/automation.h +19 -0
  207. esphome/components/modbus_controller/const.py +1 -0
  208. esphome/components/modbus_controller/modbus_controller.cpp +8 -0
  209. esphome/components/modbus_controller/modbus_controller.h +3 -0
  210. esphome/components/mqtt/__init__.py +20 -9
  211. esphome/components/mqtt/mqtt_alarm_control_panel.cpp +128 -0
  212. esphome/components/mqtt/mqtt_alarm_control_panel.h +39 -0
  213. esphome/components/mqtt/mqtt_backend.h +3 -1
  214. esphome/components/mqtt/mqtt_backend_esp32.cpp +4 -1
  215. esphome/components/mqtt/mqtt_backend_esp32.h +3 -1
  216. esphome/components/mqtt/mqtt_backend_esp8266.h +3 -1
  217. esphome/components/mqtt/mqtt_backend_libretiny.h +3 -1
  218. esphome/components/mqtt/mqtt_client.cpp +16 -3
  219. esphome/components/mqtt/mqtt_client.h +5 -1
  220. esphome/components/mqtt/mqtt_component.cpp +32 -4
  221. esphome/components/mqtt/mqtt_const.h +2 -0
  222. esphome/components/network/__init__.py +15 -12
  223. esphome/components/network/ip_address.h +3 -0
  224. esphome/components/network/util.cpp +2 -1
  225. esphome/components/network/util.h +3 -1
  226. esphome/components/nextion/base_component.py +5 -8
  227. esphome/components/number/__init__.py +7 -8
  228. esphome/components/online_image/__init__.py +167 -0
  229. esphome/components/online_image/image_decoder.cpp +44 -0
  230. esphome/components/online_image/image_decoder.h +112 -0
  231. esphome/components/online_image/online_image.cpp +283 -0
  232. esphome/components/online_image/online_image.h +195 -0
  233. esphome/components/online_image/png_image.cpp +68 -0
  234. esphome/components/online_image/png_image.h +33 -0
  235. esphome/components/ota/__init__.py +8 -4
  236. esphome/components/pid/pid_climate.h +2 -0
  237. esphome/components/pmwcs3/pmwcs3.cpp +31 -30
  238. esphome/components/remote_base/pronto_protocol.cpp +0 -3
  239. esphome/components/remote_transmitter/remote_transmitter.h +1 -1
  240. esphome/components/rgbct/rgbct_light_output.h +3 -2
  241. esphome/components/rgbw/rgbw_light_output.h +3 -2
  242. esphome/components/rgbww/rgbww_light_output.h +3 -2
  243. esphome/components/rp2040_pio_led_strip/led_strip.cpp +31 -5
  244. esphome/components/rp2040_pio_led_strip/led_strip.h +5 -0
  245. esphome/components/rtttl/rtttl.cpp +108 -21
  246. esphome/components/rtttl/rtttl.h +15 -6
  247. esphome/components/select/__init__.py +7 -7
  248. esphome/components/sensor/__init__.py +29 -10
  249. esphome/components/sensor/filter.cpp +8 -0
  250. esphome/components/sensor/filter.h +9 -0
  251. esphome/components/sml/sml_parser.cpp +48 -22
  252. esphome/components/socket/socket.cpp +11 -14
  253. esphome/components/speaker/__init__.py +14 -5
  254. esphome/components/speaker/automation.h +10 -0
  255. esphome/components/speaker/speaker.h +9 -0
  256. esphome/components/spi/spi.cpp +0 -6
  257. esphome/components/spi/spi.h +2 -19
  258. esphome/components/spi_led_strip/spi_led_strip.h +5 -4
  259. esphome/components/sprinkler/sprinkler.cpp +2 -2
  260. esphome/components/sprinkler/sprinkler.h +1 -1
  261. esphome/components/switch/__init__.py +3 -3
  262. esphome/components/text/__init__.py +5 -5
  263. esphome/components/text_sensor/__init__.py +7 -7
  264. esphome/components/time/__init__.py +8 -8
  265. esphome/components/touchscreen/binary_sensor/__init__.py +24 -10
  266. esphome/components/touchscreen/binary_sensor/touchscreen_binary_sensor.cpp +3 -2
  267. esphome/components/touchscreen/binary_sensor/touchscreen_binary_sensor.h +4 -2
  268. esphome/components/uart/uart_component_host.cpp +6 -2
  269. esphome/components/update/__init__.py +33 -15
  270. esphome/components/update/automation.h +23 -0
  271. esphome/components/update/update_entity.h +3 -1
  272. esphome/components/valve/__init__.py +3 -3
  273. esphome/components/voice_assistant/__init__.py +7 -8
  274. esphome/components/wake_on_lan/wake_on_lan.cpp +2 -0
  275. esphome/components/wake_on_lan/wake_on_lan.h +3 -1
  276. esphome/components/watchdog/__init__.py +1 -0
  277. esphome/components/{http_request → watchdog}/watchdog.cpp +0 -2
  278. esphome/components/{http_request → watchdog}/watchdog.h +0 -2
  279. esphome/components/waveshare_epaper/waveshare_epaper.cpp +5 -5
  280. esphome/components/web_server/server_index_v3.h +3615 -3603
  281. esphome/components/web_server/web_server.cpp +0 -209
  282. esphome/components/web_server/web_server.h +1 -1
  283. esphome/components/web_server/web_server_v1.cpp +217 -0
  284. esphome/components/web_server_base/web_server_base.h +1 -0
  285. esphome/components/wifi/__init__.py +15 -14
  286. esphome/components/wifi/wifi_component.cpp +2 -0
  287. esphome/components/wifi/wifi_component.h +7 -1
  288. esphome/components/wifi/wifi_component_esp32_arduino.cpp +5 -2
  289. esphome/components/wifi/wifi_component_esp8266.cpp +2 -0
  290. esphome/components/wifi/wifi_component_esp_idf.cpp +43 -7
  291. esphome/components/wifi/wifi_component_libretiny.cpp +2 -0
  292. esphome/components/wifi/wifi_component_pico_w.cpp +2 -0
  293. esphome/components/wifi/wpa2_eap.py +6 -7
  294. esphome/components/wifi_info/text_sensor.py +3 -3
  295. esphome/components/wifi_info/wifi_info_text_sensor.cpp +2 -0
  296. esphome/components/wifi_info/wifi_info_text_sensor.h +2 -0
  297. esphome/components/wifi_signal/sensor.py +1 -1
  298. esphome/components/wifi_signal/wifi_signal_sensor.cpp +2 -0
  299. esphome/components/wifi_signal/wifi_signal_sensor.h +2 -1
  300. esphome/components/xiaomi_ble/xiaomi_ble.cpp +20 -3
  301. esphome/components/xiaomi_ble/xiaomi_ble.h +1 -0
  302. esphome/components/xiaomi_lywsd02mmc/__init__.py +0 -0
  303. esphome/components/xiaomi_lywsd02mmc/sensor.py +77 -0
  304. esphome/components/xiaomi_lywsd02mmc/xiaomi_lywsd02mmc.cpp +73 -0
  305. esphome/components/xiaomi_lywsd02mmc/xiaomi_lywsd02mmc.h +37 -0
  306. esphome/config.py +17 -19
  307. esphome/config_validation.py +55 -23
  308. esphome/const.py +25 -9
  309. esphome/core/__init__.py +17 -14
  310. esphome/core/application.h +42 -21
  311. esphome/core/automation.h +5 -3
  312. esphome/core/base_automation.h +3 -2
  313. esphome/core/bytebuffer.cpp +134 -0
  314. esphome/core/bytebuffer.h +96 -0
  315. esphome/core/color.h +24 -16
  316. esphome/core/config.py +3 -3
  317. esphome/core/defines.h +14 -1
  318. esphome/core/entity_base.h +2 -2
  319. esphome/core/entity_helpers.py +1 -2
  320. esphome/core/gpio.h +0 -18
  321. esphome/core/helpers.h +1 -1
  322. esphome/core/optional.h +15 -16
  323. esphome/coroutine.py +1 -1
  324. esphome/cpp_generator.py +1 -1
  325. esphome/cpp_helpers.py +3 -5
  326. esphome/dashboard/core.py +3 -3
  327. esphome/dashboard/dashboard.py +3 -3
  328. esphome/dashboard/entries.py +1 -1
  329. esphome/dashboard/util/file.py +1 -1
  330. esphome/dashboard/web_server.py +3 -3
  331. esphome/external_files.py +5 -3
  332. esphome/final_validate.py +2 -2
  333. esphome/git.py +4 -4
  334. esphome/helpers.py +5 -5
  335. esphome/loader.py +15 -10
  336. esphome/mqtt.py +4 -8
  337. esphome/pins.py +6 -6
  338. esphome/platformio_api.py +5 -5
  339. esphome/storage_json.py +2 -1
  340. esphome/types.py +1 -1
  341. esphome/util.py +2 -3
  342. esphome/voluptuous_schema.py +1 -0
  343. esphome/vscode.py +5 -4
  344. esphome/wizard.py +1 -1
  345. esphome/writer.py +7 -7
  346. esphome/yaml_util.py +3 -3
  347. esphome/zeroconf.py +1 -1
  348. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/METADATA +3 -3
  349. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/RECORD +353 -247
  350. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/LICENSE +0 -0
  351. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/WHEEL +0 -0
  352. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/entry_points.txt +0 -0
  353. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,134 @@
1
+ #include "bytebuffer.h"
2
+ #include <cassert>
3
+
4
+ namespace esphome {
5
+
6
+ ByteBuffer ByteBuffer::create(size_t capacity) {
7
+ std::vector<uint8_t> data(capacity);
8
+ return {data};
9
+ }
10
+
11
+ ByteBuffer ByteBuffer::wrap(uint8_t *ptr, size_t len) {
12
+ std::vector<uint8_t> data(ptr, ptr + len);
13
+ return {data};
14
+ }
15
+
16
+ ByteBuffer ByteBuffer::wrap(std::vector<uint8_t> data) { return {std::move(data)}; }
17
+
18
+ void ByteBuffer::set_limit(size_t limit) {
19
+ assert(limit <= this->get_capacity());
20
+ this->limit_ = limit;
21
+ }
22
+ void ByteBuffer::set_position(size_t position) {
23
+ assert(position <= this->get_limit());
24
+ this->position_ = position;
25
+ }
26
+ void ByteBuffer::clear() {
27
+ this->limit_ = this->get_capacity();
28
+ this->position_ = 0;
29
+ }
30
+ uint16_t ByteBuffer::get_uint16() {
31
+ assert(this->get_remaining() >= 2);
32
+ uint16_t value;
33
+ if (endianness_ == LITTLE) {
34
+ value = this->data_[this->position_++];
35
+ value |= this->data_[this->position_++] << 8;
36
+ } else {
37
+ value = this->data_[this->position_++] << 8;
38
+ value |= this->data_[this->position_++];
39
+ }
40
+ return value;
41
+ }
42
+
43
+ uint32_t ByteBuffer::get_uint32() {
44
+ assert(this->get_remaining() >= 4);
45
+ uint32_t value;
46
+ if (endianness_ == LITTLE) {
47
+ value = this->data_[this->position_++];
48
+ value |= this->data_[this->position_++] << 8;
49
+ value |= this->data_[this->position_++] << 16;
50
+ value |= this->data_[this->position_++] << 24;
51
+ } else {
52
+ value = this->data_[this->position_++] << 24;
53
+ value |= this->data_[this->position_++] << 16;
54
+ value |= this->data_[this->position_++] << 8;
55
+ value |= this->data_[this->position_++];
56
+ }
57
+ return value;
58
+ }
59
+ uint32_t ByteBuffer::get_uint24() {
60
+ assert(this->get_remaining() >= 3);
61
+ uint32_t value;
62
+ if (endianness_ == LITTLE) {
63
+ value = this->data_[this->position_++];
64
+ value |= this->data_[this->position_++] << 8;
65
+ value |= this->data_[this->position_++] << 16;
66
+ } else {
67
+ value = this->data_[this->position_++] << 16;
68
+ value |= this->data_[this->position_++] << 8;
69
+ value |= this->data_[this->position_++];
70
+ }
71
+ return value;
72
+ }
73
+ uint32_t ByteBuffer::get_int24() {
74
+ auto value = this->get_uint24();
75
+ uint32_t mask = (~(uint32_t) 0) << 23;
76
+ if ((value & mask) != 0)
77
+ value |= mask;
78
+ return value;
79
+ }
80
+ uint8_t ByteBuffer::get_uint8() {
81
+ assert(this->get_remaining() >= 1);
82
+ return this->data_[this->position_++];
83
+ }
84
+ float ByteBuffer::get_float() {
85
+ auto value = this->get_uint32();
86
+ return *(float *) &value;
87
+ }
88
+ void ByteBuffer::put_uint8(uint8_t value) {
89
+ assert(this->get_remaining() >= 1);
90
+ this->data_[this->position_++] = value;
91
+ }
92
+
93
+ void ByteBuffer::put_uint16(uint16_t value) {
94
+ assert(this->get_remaining() >= 2);
95
+ if (this->endianness_ == LITTLE) {
96
+ this->data_[this->position_++] = (uint8_t) value;
97
+ this->data_[this->position_++] = (uint8_t) (value >> 8);
98
+ } else {
99
+ this->data_[this->position_++] = (uint8_t) (value >> 8);
100
+ this->data_[this->position_++] = (uint8_t) value;
101
+ }
102
+ }
103
+ void ByteBuffer::put_uint24(uint32_t value) {
104
+ assert(this->get_remaining() >= 3);
105
+ if (this->endianness_ == LITTLE) {
106
+ this->data_[this->position_++] = (uint8_t) value;
107
+ this->data_[this->position_++] = (uint8_t) (value >> 8);
108
+ this->data_[this->position_++] = (uint8_t) (value >> 16);
109
+ } else {
110
+ this->data_[this->position_++] = (uint8_t) (value >> 16);
111
+ this->data_[this->position_++] = (uint8_t) (value >> 8);
112
+ this->data_[this->position_++] = (uint8_t) value;
113
+ }
114
+ }
115
+ void ByteBuffer::put_uint32(uint32_t value) {
116
+ assert(this->get_remaining() >= 4);
117
+ if (this->endianness_ == LITTLE) {
118
+ this->data_[this->position_++] = (uint8_t) value;
119
+ this->data_[this->position_++] = (uint8_t) (value >> 8);
120
+ this->data_[this->position_++] = (uint8_t) (value >> 16);
121
+ this->data_[this->position_++] = (uint8_t) (value >> 24);
122
+ } else {
123
+ this->data_[this->position_++] = (uint8_t) (value >> 24);
124
+ this->data_[this->position_++] = (uint8_t) (value >> 16);
125
+ this->data_[this->position_++] = (uint8_t) (value >> 8);
126
+ this->data_[this->position_++] = (uint8_t) value;
127
+ }
128
+ }
129
+ void ByteBuffer::put_float(float value) { this->put_uint32(*(uint32_t *) &value); }
130
+ void ByteBuffer::flip() {
131
+ this->limit_ = this->position_;
132
+ this->position_ = 0;
133
+ }
134
+ } // namespace esphome
@@ -0,0 +1,96 @@
1
+ #pragma once
2
+
3
+ #include <utility>
4
+ #include <vector>
5
+ #include <cinttypes>
6
+ #include <cstddef>
7
+
8
+ namespace esphome {
9
+
10
+ enum Endian { LITTLE, BIG };
11
+
12
+ /**
13
+ * A class modelled on the Java ByteBuffer class. It wraps a vector of bytes and permits putting and getting
14
+ * items of various sizes, with an automatically incremented position.
15
+ *
16
+ * There are three variables maintained pointing into the buffer:
17
+ *
18
+ * 0 <= position <= limit <= capacity
19
+ *
20
+ * capacity: the maximum amount of data that can be stored
21
+ * limit: the limit of the data currently available to get or put
22
+ * position: the current insert or extract position
23
+ *
24
+ * In addition a mark can be set to the current position with mark(). A subsequent call to reset() will restore
25
+ * the position to the mark.
26
+ *
27
+ * The buffer can be marked to be little-endian (default) or big-endian. All subsequent operations will use that order.
28
+ *
29
+ */
30
+ class ByteBuffer {
31
+ public:
32
+ /**
33
+ * Create a new Bytebuffer with the given capacity
34
+ */
35
+ static ByteBuffer create(size_t capacity);
36
+ /**
37
+ * Wrap an existing vector in a Bytebufffer
38
+ */
39
+ static ByteBuffer wrap(std::vector<uint8_t> data);
40
+ /**
41
+ * Wrap an existing array in a Bytebufffer
42
+ */
43
+ static ByteBuffer wrap(uint8_t *ptr, size_t len);
44
+
45
+ // Get one byte from the buffer, increment position by 1
46
+ uint8_t get_uint8();
47
+ // Get a 16 bit unsigned value, increment by 2
48
+ uint16_t get_uint16();
49
+ // Get a 24 bit unsigned value, increment by 3
50
+ uint32_t get_uint24();
51
+ // Get a 32 bit unsigned value, increment by 4
52
+ uint32_t get_uint32();
53
+ // signed versions of the get functions
54
+ uint8_t get_int8() { return (int8_t) this->get_uint8(); };
55
+ int16_t get_int16() { return (int16_t) this->get_uint16(); }
56
+ uint32_t get_int24();
57
+ int32_t get_int32() { return (int32_t) this->get_uint32(); }
58
+ // Get a float value, increment by 4
59
+ float get_float();
60
+
61
+ // put values into the buffer, increment the position accordingly
62
+ void put_uint8(uint8_t value);
63
+ void put_uint16(uint16_t value);
64
+ void put_uint24(uint32_t value);
65
+ void put_uint32(uint32_t value);
66
+ void put_float(float value);
67
+
68
+ inline size_t get_capacity() const { return this->data_.size(); }
69
+ inline size_t get_position() const { return this->position_; }
70
+ inline size_t get_limit() const { return this->limit_; }
71
+ inline size_t get_remaining() const { return this->get_limit() - this->get_position(); }
72
+ inline Endian get_endianness() const { return this->endianness_; }
73
+ inline void mark() { this->mark_ = this->position_; }
74
+ inline void big_endian() { this->endianness_ = BIG; }
75
+ inline void little_endian() { this->endianness_ = LITTLE; }
76
+ void set_limit(size_t limit);
77
+ void set_position(size_t position);
78
+ // set position to 0, limit to capacity.
79
+ void clear();
80
+ // set limit to current position, postition to zero. Used when swapping from write to read operations.
81
+ void flip();
82
+ // retrieve a pointer to the underlying data.
83
+ uint8_t *array() { return this->data_.data(); };
84
+ void rewind() { this->position_ = 0; }
85
+ void reset() { this->position_ = this->mark_; }
86
+
87
+ protected:
88
+ ByteBuffer(std::vector<uint8_t> data) : data_(std::move(data)) { this->limit_ = this->get_capacity(); }
89
+ std::vector<uint8_t> data_;
90
+ Endian endianness_{LITTLE};
91
+ size_t position_{0};
92
+ size_t mark_{0};
93
+ size_t limit_{0};
94
+ };
95
+
96
+ } // namespace esphome
esphome/core/color.h CHANGED
@@ -85,22 +85,26 @@ struct Color {
85
85
  }
86
86
  inline Color operator+(const Color &add) const ESPHOME_ALWAYS_INLINE {
87
87
  Color ret;
88
- if (uint8_t(add.r + this->r) < this->r)
88
+ if (uint8_t(add.r + this->r) < this->r) {
89
89
  ret.r = 255;
90
- else
90
+ } else {
91
91
  ret.r = this->r + add.r;
92
- if (uint8_t(add.g + this->g) < this->g)
92
+ }
93
+ if (uint8_t(add.g + this->g) < this->g) {
93
94
  ret.g = 255;
94
- else
95
+ } else {
95
96
  ret.g = this->g + add.g;
96
- if (uint8_t(add.b + this->b) < this->b)
97
+ }
98
+ if (uint8_t(add.b + this->b) < this->b) {
97
99
  ret.b = 255;
98
- else
100
+ } else {
99
101
  ret.b = this->b + add.b;
100
- if (uint8_t(add.w + this->w) < this->w)
102
+ }
103
+ if (uint8_t(add.w + this->w) < this->w) {
101
104
  ret.w = 255;
102
- else
105
+ } else {
103
106
  ret.w = this->w + add.w;
107
+ }
104
108
  return ret;
105
109
  }
106
110
  inline Color &operator+=(const Color &add) ESPHOME_ALWAYS_INLINE { return *this = (*this) + add; }
@@ -108,22 +112,26 @@ struct Color {
108
112
  inline Color &operator+=(uint8_t add) ESPHOME_ALWAYS_INLINE { return *this = (*this) + add; }
109
113
  inline Color operator-(const Color &subtract) const ESPHOME_ALWAYS_INLINE {
110
114
  Color ret;
111
- if (subtract.r > this->r)
115
+ if (subtract.r > this->r) {
112
116
  ret.r = 0;
113
- else
117
+ } else {
114
118
  ret.r = this->r - subtract.r;
115
- if (subtract.g > this->g)
119
+ }
120
+ if (subtract.g > this->g) {
116
121
  ret.g = 0;
117
- else
122
+ } else {
118
123
  ret.g = this->g - subtract.g;
119
- if (subtract.b > this->b)
124
+ }
125
+ if (subtract.b > this->b) {
120
126
  ret.b = 0;
121
- else
127
+ } else {
122
128
  ret.b = this->b - subtract.b;
123
- if (subtract.w > this->w)
129
+ }
130
+ if (subtract.w > this->w) {
124
131
  ret.w = 0;
125
- else
132
+ } else {
126
133
  ret.w = this->w - subtract.w;
134
+ }
127
135
  return ret;
128
136
  }
129
137
  inline Color &operator-=(const Color &subtract) ESPHOME_ALWAYS_INLINE { return *this = (*this) - subtract; }
esphome/core/config.py CHANGED
@@ -3,9 +3,9 @@ import multiprocessing
3
3
  import os
4
4
  import re
5
5
 
6
+ from esphome import automation
6
7
  import esphome.codegen as cg
7
8
  import esphome.config_validation as cv
8
- from esphome import automation
9
9
  from esphome.const import (
10
10
  CONF_ARDUINO_VERSION,
11
11
  CONF_AREA,
@@ -16,11 +16,11 @@ from esphome.const import (
16
16
  CONF_COMPILE_PROCESS_LIMIT,
17
17
  CONF_ESPHOME,
18
18
  CONF_FRAMEWORK,
19
+ CONF_FRIENDLY_NAME,
19
20
  CONF_INCLUDES,
20
21
  CONF_LIBRARIES,
21
22
  CONF_MIN_VERSION,
22
23
  CONF_NAME,
23
- CONF_FRIENDLY_NAME,
24
24
  CONF_ON_BOOT,
25
25
  CONF_ON_LOOP,
26
26
  CONF_ON_SHUTDOWN,
@@ -34,8 +34,8 @@ from esphome.const import (
34
34
  CONF_TYPE,
35
35
  CONF_VERSION,
36
36
  KEY_CORE,
37
- TARGET_PLATFORMS,
38
37
  PLATFORM_ESP8266,
38
+ TARGET_PLATFORMS,
39
39
  __version__ as ESPHOME_VERSION,
40
40
  )
41
41
  from esphome.core import CORE, coroutine_with_priority
esphome/core/defines.h CHANGED
@@ -38,11 +38,23 @@
38
38
  #define USE_LIGHT
39
39
  #define USE_LOCK
40
40
  #define USE_LOGGER
41
+ #define USE_LVGL
42
+ #define USE_LVGL_ANIMIMG
43
+ #define USE_LVGL_BINARY_SENSOR
44
+ #define USE_LVGL_BUTTONMATRIX
45
+ #define USE_LVGL_FONT
46
+ #define USE_LVGL_IMAGE
47
+ #define USE_LVGL_KEYBOARD
48
+ #define USE_LVGL_KEY_LISTENER
49
+ #define USE_LVGL_TOUCHSCREEN
50
+ #define USE_LVGL_ROTARY_ENCODER
41
51
  #define USE_MDNS
42
52
  #define USE_MEDIA_PLAYER
43
53
  #define USE_MQTT
54
+ #define USE_NETWORK
44
55
  #define USE_NEXTION_TFT_UPLOAD
45
56
  #define USE_NUMBER
57
+ #define USE_ONLINE_IMAGE_PNG_SUPPORT
46
58
  #define USE_OTA
47
59
  #define USE_OTA_PASSWORD
48
60
  #define USE_OTA_STATE_CALLBACK
@@ -147,6 +159,7 @@
147
159
  #endif
148
160
 
149
161
  // Disabled feature flags
150
- // #define USE_BSEC // Requires a library with proprietary license.
162
+ // #define USE_BSEC // Requires a library with proprietary license
163
+ // #define USE_BSEC2 // Requires a library with proprietary license
151
164
 
152
165
  #define USE_DASHBOARD_IMPORT
@@ -63,7 +63,7 @@ class EntityBase {
63
63
  EntityCategory entity_category_{ENTITY_CATEGORY_NONE};
64
64
  };
65
65
 
66
- class EntityBase_DeviceClass {
66
+ class EntityBase_DeviceClass { // NOLINT(readability-identifier-naming)
67
67
  public:
68
68
  /// Get the device class, using the manual override if set.
69
69
  std::string get_device_class();
@@ -74,7 +74,7 @@ class EntityBase_DeviceClass {
74
74
  const char *device_class_{nullptr}; ///< Device class override
75
75
  };
76
76
 
77
- class EntityBase_UnitOfMeasurement {
77
+ class EntityBase_UnitOfMeasurement { // NOLINT(readability-identifier-naming)
78
78
  public:
79
79
  /// Get the unit of measurement, using the manual override if set.
80
80
  std::string get_unit_of_measurement();
@@ -1,6 +1,5 @@
1
- import esphome.final_validate as fv
2
-
3
1
  from esphome.const import CONF_ID
2
+ import esphome.final_validate as fv
4
3
 
5
4
 
6
5
  def inherit_property_from(property_to_inherit, parent_id_property, transform=None):
esphome/core/gpio.h CHANGED
@@ -62,24 +62,6 @@ class GPIOPin {
62
62
  virtual bool is_internal() { return false; }
63
63
  };
64
64
 
65
- /**
66
- * A pin to replace those that don't exist.
67
- */
68
- class NullPin : public GPIOPin {
69
- public:
70
- void setup() override {}
71
-
72
- void pin_mode(gpio::Flags _) override {}
73
-
74
- bool digital_read() override { return false; }
75
-
76
- void digital_write(bool _) override {}
77
-
78
- std::string dump_summary() const override { return {"Not used"}; }
79
- };
80
-
81
- static GPIOPin *const NULL_PIN = new NullPin();
82
-
83
65
  /// Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
84
66
  class ISRInternalGPIOPin {
85
67
  public:
esphome/core/helpers.h CHANGED
@@ -680,7 +680,7 @@ template<class T> class ExternalRAMAllocator {
680
680
  }
681
681
 
682
682
  private:
683
- Flags flags_{Flags::NONE};
683
+ Flags flags_{Flags::ALLOW_FAILURE};
684
684
  };
685
685
 
686
686
  /// @}
esphome/core/optional.h CHANGED
@@ -24,7 +24,7 @@ namespace esphome {
24
24
 
25
25
  struct nullopt_t { // NOLINT
26
26
  struct init {}; // NOLINT
27
- nullopt_t(init) {}
27
+ nullopt_t(init /*unused*/) {}
28
28
  };
29
29
 
30
30
  // extra parenthesis to prevent the most vexing parse:
@@ -42,13 +42,13 @@ template<typename T> class optional { // NOLINT
42
42
 
43
43
  optional() {}
44
44
 
45
- optional(nullopt_t) {}
45
+ optional(nullopt_t /*unused*/) {}
46
46
 
47
47
  optional(T const &arg) : has_value_(true), value_(arg) {} // NOLINT
48
48
 
49
49
  template<class U> optional(optional<U> const &other) : has_value_(other.has_value()), value_(other.value()) {}
50
50
 
51
- optional &operator=(nullopt_t) {
51
+ optional &operator=(nullopt_t /*unused*/) {
52
52
  reset();
53
53
  return *this;
54
54
  }
@@ -104,7 +104,6 @@ template<typename T> class optional { // NOLINT
104
104
  has_value_ = true;
105
105
  }
106
106
 
107
- private:
108
107
  bool has_value_{false}; // NOLINT
109
108
  value_type value_; // NOLINT
110
109
  };
@@ -131,29 +130,29 @@ template<typename T, typename U> inline bool operator>=(optional<T> const &x, op
131
130
 
132
131
  // Comparison with nullopt
133
132
 
134
- template<typename T> inline bool operator==(optional<T> const &x, nullopt_t) { return (!x); }
133
+ template<typename T> inline bool operator==(optional<T> const &x, nullopt_t /*unused*/) { return (!x); }
135
134
 
136
- template<typename T> inline bool operator==(nullopt_t, optional<T> const &x) { return (!x); }
135
+ template<typename T> inline bool operator==(nullopt_t /*unused*/, optional<T> const &x) { return (!x); }
137
136
 
138
- template<typename T> inline bool operator!=(optional<T> const &x, nullopt_t) { return bool(x); }
137
+ template<typename T> inline bool operator!=(optional<T> const &x, nullopt_t /*unused*/) { return bool(x); }
139
138
 
140
- template<typename T> inline bool operator!=(nullopt_t, optional<T> const &x) { return bool(x); }
139
+ template<typename T> inline bool operator!=(nullopt_t /*unused*/, optional<T> const &x) { return bool(x); }
141
140
 
142
- template<typename T> inline bool operator<(optional<T> const &, nullopt_t) { return false; }
141
+ template<typename T> inline bool operator<(optional<T> const & /*unused*/, nullopt_t /*unused*/) { return false; }
143
142
 
144
- template<typename T> inline bool operator<(nullopt_t, optional<T> const &x) { return bool(x); }
143
+ template<typename T> inline bool operator<(nullopt_t /*unused*/, optional<T> const &x) { return bool(x); }
145
144
 
146
- template<typename T> inline bool operator<=(optional<T> const &x, nullopt_t) { return (!x); }
145
+ template<typename T> inline bool operator<=(optional<T> const &x, nullopt_t /*unused*/) { return (!x); }
147
146
 
148
- template<typename T> inline bool operator<=(nullopt_t, optional<T> const &) { return true; }
147
+ template<typename T> inline bool operator<=(nullopt_t /*unused*/, optional<T> const & /*unused*/) { return true; }
149
148
 
150
- template<typename T> inline bool operator>(optional<T> const &x, nullopt_t) { return bool(x); }
149
+ template<typename T> inline bool operator>(optional<T> const &x, nullopt_t /*unused*/) { return bool(x); }
151
150
 
152
- template<typename T> inline bool operator>(nullopt_t, optional<T> const &) { return false; }
151
+ template<typename T> inline bool operator>(nullopt_t /*unused*/, optional<T> const & /*unused*/) { return false; }
153
152
 
154
- template<typename T> inline bool operator>=(optional<T> const &, nullopt_t) { return true; }
153
+ template<typename T> inline bool operator>=(optional<T> const & /*unused*/, nullopt_t /*unused*/) { return true; }
155
154
 
156
- template<typename T> inline bool operator>=(nullopt_t, optional<T> const &x) { return (!x); }
155
+ template<typename T> inline bool operator>=(nullopt_t /*unused*/, optional<T> const &x) { return (!x); }
157
156
 
158
157
  // Comparison with T
159
158
 
esphome/coroutine.py CHANGED
@@ -43,13 +43,13 @@ the last `yield` expression defines what is returned.
43
43
  """
44
44
 
45
45
  import collections
46
+ from collections.abc import Awaitable, Generator, Iterator
46
47
  import functools
47
48
  import heapq
48
49
  import inspect
49
50
  import logging
50
51
  import types
51
52
  from typing import Any, Callable
52
- from collections.abc import Awaitable, Generator, Iterator
53
53
 
54
54
  _LOGGER = logging.getLogger(__name__)
55
55
 
esphome/cpp_generator.py CHANGED
@@ -1,8 +1,8 @@
1
1
  import abc
2
+ from collections.abc import Sequence
2
3
  import inspect
3
4
  import math
4
5
  import re
5
- from collections.abc import Sequence
6
6
  from typing import Any, Callable, Optional, Union
7
7
 
8
8
  from esphome.core import (
esphome/cpp_helpers.py CHANGED
@@ -12,15 +12,13 @@ from esphome.const import (
12
12
  CONF_UPDATE_INTERVAL,
13
13
  KEY_PAST_SAFE_MODE,
14
14
  )
15
-
16
- from esphome.core import coroutine, ID, CORE
15
+ from esphome.core import CORE, ID, coroutine
17
16
  from esphome.coroutine import FakeAwaitable
18
- from esphome.types import ConfigType, ConfigFragmentType
19
17
  from esphome.cpp_generator import add, get_variable
20
18
  from esphome.cpp_types import App
19
+ from esphome.helpers import sanitize, snake_case
20
+ from esphome.types import ConfigFragmentType, ConfigType
21
21
  from esphome.util import Registry, RegistryEntry
22
- from esphome.helpers import snake_case, sanitize
23
-
24
22
 
25
23
  _LOGGER = logging.getLogger(__name__)
26
24
 
esphome/dashboard/core.py CHANGED
@@ -1,13 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import asyncio
4
+ from collections.abc import Coroutine
4
5
  import contextlib
5
- import logging
6
- import threading
7
6
  from dataclasses import dataclass
8
7
  from functools import partial
8
+ import logging
9
+ import threading
9
10
  from typing import TYPE_CHECKING, Any, Callable
10
- from collections.abc import Coroutine
11
11
 
12
12
  from ..zeroconf import DiscoveredImport
13
13
  from .dns import DNSCache
@@ -1,14 +1,14 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import asyncio
4
+ from asyncio import events
5
+ from concurrent.futures import ThreadPoolExecutor
4
6
  import logging
5
7
  import os
6
8
  import socket
7
9
  import threading
8
- import traceback
9
- from asyncio import events
10
- from concurrent.futures import ThreadPoolExecutor
11
10
  from time import monotonic
11
+ import traceback
12
12
  from typing import Any
13
13
 
14
14
  from esphome.storage_json import EsphomeStorageJSON, esphome_storage_path
@@ -1,9 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import asyncio
4
+ from collections import defaultdict
4
5
  import logging
5
6
  import os
6
- from collections import defaultdict
7
7
  from typing import TYPE_CHECKING, Any
8
8
 
9
9
  from esphome import const, util
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
  import os
3
- import tempfile
4
3
  from pathlib import Path
4
+ import tempfile
5
5
 
6
6
  _LOGGER = logging.getLogger(__name__)
7
7
 
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import asyncio
4
4
  import base64
5
+ from collections.abc import Iterable
5
6
  import datetime
6
7
  import functools
7
8
  import gzip
@@ -9,13 +10,12 @@ import hashlib
9
10
  import json
10
11
  import logging
11
12
  import os
13
+ from pathlib import Path
12
14
  import secrets
13
15
  import shutil
14
16
  import subprocess
15
17
  import threading
16
18
  import time
17
- from collections.abc import Iterable
18
- from pathlib import Path
19
19
  from typing import TYPE_CHECKING, Any, Callable, TypeVar
20
20
  from urllib.parse import urlparse
21
21
 
@@ -26,13 +26,13 @@ import tornado.httpserver
26
26
  import tornado.httputil
27
27
  import tornado.ioloop
28
28
  import tornado.iostream
29
+ from tornado.log import access_log
29
30
  import tornado.netutil
30
31
  import tornado.process
31
32
  import tornado.queues
32
33
  import tornado.web
33
34
  import tornado.websocket
34
35
  import yaml
35
- from tornado.log import access_log
36
36
  from yaml.nodes import Node
37
37
 
38
38
  from esphome import const, platformio_api, yaml_util
esphome/external_files.py CHANGED
@@ -1,13 +1,15 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from datetime import datetime
3
4
  import logging
4
- from pathlib import Path
5
5
  import os
6
- from datetime import datetime
6
+ from pathlib import Path
7
+
7
8
  import requests
9
+
8
10
  import esphome.config_validation as cv
9
- from esphome.core import CORE, TimePeriodSeconds
10
11
  from esphome.const import __version__
12
+ from esphome.core import CORE, TimePeriodSeconds
11
13
 
12
14
  _LOGGER = logging.getLogger(__name__)
13
15
  CODEOWNERS = ["@landonr"]
esphome/final_validate.py CHANGED
@@ -1,9 +1,9 @@
1
1
  from abc import ABC, abstractmethod
2
- from typing import Any
3
2
  import contextvars
3
+ from typing import Any
4
4
 
5
- from esphome.types import ConfigFragmentType, ID, ConfigPathType
6
5
  import esphome.config_validation as cv
6
+ from esphome.types import ID, ConfigFragmentType, ConfigPathType
7
7
 
8
8
 
9
9
  class FinalValidateConfig(ABC):