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
@@ -1,13 +1,13 @@
1
1
  """Helpers for config validation using voluptuous."""
2
2
 
3
+ from contextlib import contextmanager
3
4
  from dataclasses import dataclass
5
+ from datetime import datetime
4
6
  import logging
5
7
  import os
6
8
  import re
7
- from contextlib import contextmanager
8
- import uuid as uuid_
9
- from datetime import datetime
10
9
  from string import ascii_letters, digits
10
+ import uuid as uuid_
11
11
 
12
12
  import voluptuous as vol
13
13
 
@@ -17,37 +17,37 @@ from esphome.config_helpers import Extend, Remove
17
17
  from esphome.const import (
18
18
  ALLOWED_NAME_CHARS,
19
19
  CONF_AVAILABILITY,
20
- CONF_COMMAND_TOPIC,
21
20
  CONF_COMMAND_RETAIN,
21
+ CONF_COMMAND_TOPIC,
22
+ CONF_DAY,
22
23
  CONF_DISABLED_BY_DEFAULT,
23
24
  CONF_DISCOVERY,
24
25
  CONF_ENTITY_CATEGORY,
26
+ CONF_HOUR,
25
27
  CONF_ICON,
26
28
  CONF_ID,
27
29
  CONF_INTERNAL,
30
+ CONF_MINUTE,
31
+ CONF_MONTH,
28
32
  CONF_NAME,
33
+ CONF_PASSWORD,
34
+ CONF_PATH,
29
35
  CONF_PAYLOAD_AVAILABLE,
30
36
  CONF_PAYLOAD_NOT_AVAILABLE,
31
- CONF_RETAIN,
32
37
  CONF_QOS,
38
+ CONF_REF,
39
+ CONF_RETAIN,
40
+ CONF_SECOND,
33
41
  CONF_SETUP_PRIORITY,
34
42
  CONF_STATE_TOPIC,
35
43
  CONF_TOPIC,
36
- CONF_YEAR,
37
- CONF_MONTH,
38
- CONF_DAY,
39
- CONF_HOUR,
40
- CONF_MINUTE,
41
- CONF_SECOND,
42
- CONF_VALUE,
43
- CONF_UPDATE_INTERVAL,
44
- CONF_TYPE_ID,
45
44
  CONF_TYPE,
46
- CONF_REF,
45
+ CONF_TYPE_ID,
46
+ CONF_UPDATE_INTERVAL,
47
47
  CONF_URL,
48
- CONF_PATH,
49
48
  CONF_USERNAME,
50
- CONF_PASSWORD,
49
+ CONF_VALUE,
50
+ CONF_YEAR,
51
51
  ENTITY_CATEGORY_CONFIG,
52
52
  ENTITY_CATEGORY_DIAGNOSTIC,
53
53
  ENTITY_CATEGORY_NONE,
@@ -71,15 +71,15 @@ from esphome.core import (
71
71
  TimePeriod,
72
72
  TimePeriodMicroseconds,
73
73
  TimePeriodMilliseconds,
74
+ TimePeriodMinutes,
74
75
  TimePeriodNanoseconds,
75
76
  TimePeriodSeconds,
76
- TimePeriodMinutes,
77
77
  )
78
- from esphome.helpers import list_starts_with, add_class_to_obj
78
+ from esphome.helpers import add_class_to_obj, list_starts_with
79
79
  from esphome.schema_extractors import (
80
80
  SCHEMA_EXTRACT,
81
- schema_extractor_list,
82
81
  schema_extractor,
82
+ schema_extractor_list,
83
83
  schema_extractor_registry,
84
84
  schema_extractor_typed,
85
85
  )
@@ -91,7 +91,7 @@ _LOGGER = logging.getLogger(__name__)
91
91
 
92
92
  # pylint: disable=consider-using-f-string
93
93
  VARIABLE_PROG = re.compile(
94
- "\\$([{0}]+|\\{{[{0}]*\\}})".format(VALID_SUBSTITUTIONS_CHARACTERS)
94
+ f"\\$([{VALID_SUBSTITUTIONS_CHARACTERS}]+|\\{{[{VALID_SUBSTITUTIONS_CHARACTERS}]*\\}})"
95
95
  )
96
96
 
97
97
  # pylint: disable=invalid-name
@@ -370,6 +370,20 @@ def boolean(value):
370
370
  )
371
371
 
372
372
 
373
+ def boolean_false(value):
374
+ """Validate the given config option to be a boolean, set to False.
375
+
376
+ This option allows a bunch of different ways of expressing boolean values:
377
+ - instance of boolean
378
+ - 'true'/'false'
379
+ - 'yes'/'no'
380
+ - 'enable'/disable
381
+ """
382
+ if boolean(value):
383
+ raise Invalid("Expected boolean value to be false")
384
+ return False
385
+
386
+
373
387
  @schema_extractor_list
374
388
  def ensure_list(*validators):
375
389
  """Validate this configuration option to be a list.
@@ -464,6 +478,7 @@ zero_to_one_float = float_range(min=0, max=1)
464
478
  negative_one_to_one_float = float_range(min=-1, max=1)
465
479
  positive_int = int_range(min=0)
466
480
  positive_not_null_int = int_range(min=0, min_included=False)
481
+ positive_not_null_float = float_range(min=0, min_included=False)
467
482
 
468
483
 
469
484
  def validate_id_name(value):
@@ -829,7 +844,6 @@ def time_of_day(value):
829
844
 
830
845
 
831
846
  def date_time(date: bool, time: bool):
832
-
833
847
  pattern_str = r"^" # Start of string
834
848
  if date:
835
849
  pattern_str += r"\d{4}-\d{1,2}-\d{1,2}"
@@ -1687,9 +1701,9 @@ class SplitDefault(Optional):
1687
1701
  if CORE.is_esp32:
1688
1702
  from esphome.components.esp32 import get_esp32_variant
1689
1703
  from esphome.components.esp32.const import (
1704
+ VARIANT_ESP32C3,
1690
1705
  VARIANT_ESP32S2,
1691
1706
  VARIANT_ESP32S3,
1692
- VARIANT_ESP32C3,
1693
1707
  )
1694
1708
 
1695
1709
  variant = get_esp32_variant()
@@ -2031,6 +2045,7 @@ def require_framework_version(
2031
2045
  esp32_arduino=None,
2032
2046
  esp8266_arduino=None,
2033
2047
  rp2040_arduino=None,
2048
+ host=None,
2034
2049
  max_version=False,
2035
2050
  extra_message=None,
2036
2051
  ):
@@ -2065,6 +2080,13 @@ def require_framework_version(
2065
2080
  msg += f". {extra_message}"
2066
2081
  raise Invalid(msg)
2067
2082
  required = rp2040_arduino
2083
+ elif CORE.is_host and framework == "host":
2084
+ if host is None:
2085
+ msg = "This feature is incompatible with host platform"
2086
+ if extra_message:
2087
+ msg += f". {extra_message}"
2088
+ raise Invalid(msg)
2089
+ required = host
2068
2090
  else:
2069
2091
  raise Invalid(
2070
2092
  f"""
@@ -2174,3 +2196,13 @@ SOURCE_SCHEMA = Any(
2174
2196
  }
2175
2197
  ),
2176
2198
  )
2199
+
2200
+
2201
+ def rename_key(old_key, new_key):
2202
+ def validator(config: dict) -> dict:
2203
+ config = config.copy()
2204
+ if old_key in config:
2205
+ config[new_key] = config.pop(old_key)
2206
+ return config
2207
+
2208
+ return validator
esphome/const.py CHANGED
@@ -1,28 +1,28 @@
1
1
  """Constants used by esphome."""
2
2
 
3
- __version__ = "2024.7.2"
3
+ __version__ = "2024.8.0"
4
4
 
5
5
  ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
6
6
  VALID_SUBSTITUTIONS_CHARACTERS = (
7
7
  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
8
8
  )
9
9
 
10
+ PLATFORM_BK72XX = "bk72xx"
10
11
  PLATFORM_ESP32 = "esp32"
11
12
  PLATFORM_ESP8266 = "esp8266"
12
- PLATFORM_RP2040 = "rp2040"
13
13
  PLATFORM_HOST = "host"
14
- PLATFORM_BK72XX = "bk72xx"
15
- PLATFORM_RTL87XX = "rtl87xx"
16
14
  PLATFORM_LIBRETINY_OLDSTYLE = "libretiny"
15
+ PLATFORM_RP2040 = "rp2040"
16
+ PLATFORM_RTL87XX = "rtl87xx"
17
17
 
18
18
  TARGET_PLATFORMS = [
19
+ PLATFORM_BK72XX,
19
20
  PLATFORM_ESP32,
20
21
  PLATFORM_ESP8266,
21
- PLATFORM_RP2040,
22
22
  PLATFORM_HOST,
23
- PLATFORM_BK72XX,
24
- PLATFORM_RTL87XX,
25
23
  PLATFORM_LIBRETINY_OLDSTYLE,
24
+ PLATFORM_RP2040,
25
+ PLATFORM_RTL87XX,
26
26
  ]
27
27
 
28
28
  SOURCE_FILE_EXTENSIONS = {".cpp", ".hpp", ".h", ".c", ".tcc", ".ino"}
@@ -37,8 +37,10 @@ CONF_ACCELERATION_Y = "acceleration_y"
37
37
  CONF_ACCELERATION_Z = "acceleration_z"
38
38
  CONF_ACCURACY = "accuracy"
39
39
  CONF_ACCURACY_DECIMALS = "accuracy_decimals"
40
+ CONF_ACTION = "action"
40
41
  CONF_ACTION_ID = "action_id"
41
42
  CONF_ACTION_STATE_TOPIC = "action_state_topic"
43
+ CONF_ACTIONS = "actions"
42
44
  CONF_ACTIVE = "active"
43
45
  CONF_ACTIVE_POWER = "active_power"
44
46
  CONF_ACTUAL_GAIN = "actual_gain"
@@ -72,6 +74,7 @@ CONF_AWAY = "away"
72
74
  CONF_AWAY_COMMAND_TOPIC = "away_command_topic"
73
75
  CONF_AWAY_CONFIG = "away_config"
74
76
  CONF_AWAY_STATE_TOPIC = "away_state_topic"
77
+ CONF_BACKGROUND_COLOR = "background_color"
75
78
  CONF_BACKLIGHT_PIN = "backlight_pin"
76
79
  CONF_BASELINE = "baseline"
77
80
  CONF_BATTERY_LEVEL = "battery_level"
@@ -92,6 +95,7 @@ CONF_BOARD_FLASH_MODE = "board_flash_mode"
92
95
  CONF_BORDER = "border"
93
96
  CONF_BRANCH = "branch"
94
97
  CONF_BRIGHTNESS = "brightness"
98
+ CONF_BRIGHTNESS_LIMITS = "brightness_limits"
95
99
  CONF_BROKER = "broker"
96
100
  CONF_BSSID = "bssid"
97
101
  CONF_BUFFER_SIZE = "buffer_size"
@@ -305,8 +309,10 @@ CONF_FLASH_LENGTH = "flash_length"
305
309
  CONF_FLASH_TRANSITION_LENGTH = "flash_transition_length"
306
310
  CONF_FLOW = "flow"
307
311
  CONF_FLOW_CONTROL_PIN = "flow_control_pin"
312
+ CONF_FONT = "font"
308
313
  CONF_FOR = "for"
309
314
  CONF_FORCE_UPDATE = "force_update"
315
+ CONF_FOREGROUND_COLOR = "foreground_color"
310
316
  CONF_FORMALDEHYDE = "formaldehyde"
311
317
  CONF_FORMAT = "format"
312
318
  CONF_FORWARD_ACTIVE_ENERGY = "forward_active_energy"
@@ -403,6 +409,7 @@ CONF_INVERTED = "inverted"
403
409
  CONF_IP_ADDRESS = "ip_address"
404
410
  CONF_IRQ_PIN = "irq_pin"
405
411
  CONF_IS_RGBW = "is_rgbw"
412
+ CONF_ITEMS = "items"
406
413
  CONF_JS_INCLUDE = "js_include"
407
414
  CONF_JS_URL = "js_url"
408
415
  CONF_JVC = "jvc"
@@ -423,6 +430,7 @@ CONF_LIGHT = "light"
423
430
  CONF_LIGHT_ID = "light_id"
424
431
  CONF_LIGHTNING_ENERGY = "lightning_energy"
425
432
  CONF_LIGHTNING_THRESHOLD = "lightning_threshold"
433
+ CONF_LIMIT_MODE = "limit_mode"
426
434
  CONF_LINE_THICKNESS = "line_thickness"
427
435
  CONF_LINE_TYPE = "line_type"
428
436
  CONF_LOADED_INTEGRATIONS = "loaded_integrations"
@@ -501,6 +509,7 @@ CONF_MOTION = "motion"
501
509
  CONF_MOVEMENT_COUNTER = "movement_counter"
502
510
  CONF_MQTT = "mqtt"
503
511
  CONF_MQTT_ID = "mqtt_id"
512
+ CONF_MULTIPLE = "multiple"
504
513
  CONF_MULTIPLEXER = "multiplexer"
505
514
  CONF_MULTIPLY = "multiply"
506
515
  CONF_NAME = "name"
@@ -539,6 +548,7 @@ CONF_ON_DOUBLE_CLICK = "on_double_click"
539
548
  CONF_ON_ENROLLMENT_DONE = "on_enrollment_done"
540
549
  CONF_ON_ENROLLMENT_FAILED = "on_enrollment_failed"
541
550
  CONF_ON_ENROLLMENT_SCAN = "on_enrollment_scan"
551
+ CONF_ON_ERROR = "on_error"
542
552
  CONF_ON_EVENT = "on_event"
543
553
  CONF_ON_FINGER_SCAN_INVALID = "on_finger_scan_invalid"
544
554
  CONF_ON_FINGER_SCAN_MATCHED = "on_finger_scan_matched"
@@ -835,6 +845,7 @@ CONF_TEMPERATURE = "temperature"
835
845
  CONF_TEMPERATURE_OFFSET = "temperature_offset"
836
846
  CONF_TEMPERATURE_SOURCE = "temperature_source"
837
847
  CONF_TEMPERATURE_STEP = "temperature_step"
848
+ CONF_TEXT = "text"
838
849
  CONF_TEXT_SENSORS = "text_sensors"
839
850
  CONF_THEN = "then"
840
851
  CONF_THRESHOLD = "threshold"
@@ -1025,18 +1036,22 @@ UNIT_KELVIN = "K"
1025
1036
  UNIT_KILOGRAM = "kg"
1026
1037
  UNIT_KILOMETER = "km"
1027
1038
  UNIT_KILOMETER_PER_HOUR = "km/h"
1028
- UNIT_KILOVOLT_AMPS_REACTIVE = "kVAr"
1029
- UNIT_KILOVOLT_AMPS_REACTIVE_HOURS = "kVArh"
1039
+ UNIT_KILOVOLT_AMPS = "kVA"
1040
+ UNIT_KILOVOLT_AMPS_HOURS = "kVAh"
1041
+ UNIT_KILOVOLT_AMPS_REACTIVE = "kVAR"
1042
+ UNIT_KILOVOLT_AMPS_REACTIVE_HOURS = "kVARh"
1030
1043
  UNIT_KILOWATT = "kW"
1031
1044
  UNIT_KILOWATT_HOURS = "kWh"
1032
1045
  UNIT_LUX = "lx"
1033
1046
  UNIT_METER = "m"
1034
1047
  UNIT_METER_PER_SECOND_SQUARED = "m/s²"
1048
+ UNIT_MICROAMP = "µA"
1035
1049
  UNIT_MICROGRAMS_PER_CUBIC_METER = "µg/m³"
1036
1050
  UNIT_MICROMETER = "µm"
1037
1051
  UNIT_MICROSIEMENS_PER_CENTIMETER = "µS/cm"
1038
1052
  UNIT_MICROSILVERTS_PER_HOUR = "µSv/h"
1039
1053
  UNIT_MICROTESLA = "µT"
1054
+ UNIT_MILLIAMP = "mA"
1040
1055
  UNIT_MILLIGRAMS_PER_CUBIC_METER = "mg/m³"
1041
1056
  UNIT_MILLIMETER = "mm"
1042
1057
  UNIT_MILLISECOND = "ms"
@@ -1055,6 +1070,7 @@ UNIT_SECOND = "s"
1055
1070
  UNIT_STEPS = "steps"
1056
1071
  UNIT_VOLT = "V"
1057
1072
  UNIT_VOLT_AMPS = "VA"
1073
+ UNIT_VOLT_AMPS_HOURS = "VAh"
1058
1074
  UNIT_VOLT_AMPS_REACTIVE = "VAR"
1059
1075
  UNIT_VOLT_AMPS_REACTIVE_HOURS = "VARh"
1060
1076
  UNIT_WATT = "W"
esphome/core/__init__.py CHANGED
@@ -7,26 +7,29 @@ from typing import TYPE_CHECKING, Optional, Union
7
7
  from esphome.const import (
8
8
  CONF_COMMENT,
9
9
  CONF_ESPHOME,
10
- CONF_USE_ADDRESS,
11
10
  CONF_ETHERNET,
11
+ CONF_PORT,
12
+ CONF_USE_ADDRESS,
12
13
  CONF_WEB_SERVER,
13
14
  CONF_WIFI,
14
- CONF_PORT,
15
15
  KEY_CORE,
16
16
  KEY_TARGET_FRAMEWORK,
17
17
  KEY_TARGET_PLATFORM,
18
+ PLATFORM_BK72XX,
18
19
  PLATFORM_ESP32,
19
20
  PLATFORM_ESP8266,
20
- PLATFORM_BK72XX,
21
- PLATFORM_RTL87XX,
22
- PLATFORM_RP2040,
23
21
  PLATFORM_HOST,
22
+ PLATFORM_RP2040,
23
+ PLATFORM_RTL87XX,
24
24
  )
25
- from esphome.coroutine import FakeAwaitable as _FakeAwaitable
26
- from esphome.coroutine import FakeEventLoop as _FakeEventLoop
27
25
 
28
26
  # pylint: disable=unused-import
29
- from esphome.coroutine import coroutine, coroutine_with_priority # noqa
27
+ from esphome.coroutine import ( # noqa: F401
28
+ FakeAwaitable as _FakeAwaitable,
29
+ FakeEventLoop as _FakeEventLoop,
30
+ coroutine,
31
+ coroutine_with_priority,
32
+ )
30
33
  from esphome.helpers import ensure_unique_string, get_str_env, is_ha_addon
31
34
  from esphome.util import OrderedDict
32
35
 
@@ -333,7 +336,7 @@ class ID:
333
336
  else:
334
337
  self.is_manual = is_manual
335
338
  self.is_declaration = is_declaration
336
- self.type: Optional["MockObjClass"] = type
339
+ self.type: Optional[MockObjClass] = type
337
340
 
338
341
  def resolve(self, registered_ids):
339
342
  from esphome.config_validation import RESERVED_IDS
@@ -497,7 +500,7 @@ class EsphomeCore:
497
500
  # The relative path to where all build files are stored
498
501
  self.build_path: Optional[str] = None
499
502
  # The validated configuration, this is None until the config has been validated
500
- self.config: Optional["ConfigType"] = None
503
+ self.config: Optional[ConfigType] = None
501
504
  # The pending tasks in the task queue (mostly for C++ generation)
502
505
  # This is a priority queue (with heapq)
503
506
  # Each item is a tuple of form: (-priority, unique number, task)
@@ -505,17 +508,17 @@ class EsphomeCore:
505
508
  # Task counter for pending tasks
506
509
  self.task_counter = 0
507
510
  # The variable cache, for each ID this holds a MockObj of the variable obj
508
- self.variables: dict[str, "MockObj"] = {}
511
+ self.variables: dict[str, MockObj] = {}
509
512
  # A list of statements that go in the main setup() block
510
- self.main_statements: list["Statement"] = []
513
+ self.main_statements: list[Statement] = []
511
514
  # A list of statements to insert in the global block (includes and global variables)
512
- self.global_statements: list["Statement"] = []
515
+ self.global_statements: list[Statement] = []
513
516
  # A set of platformio libraries to add to the project
514
517
  self.libraries: list[Library] = []
515
518
  # A set of build flags to set in the platformio project
516
519
  self.build_flags: set[str] = set()
517
520
  # A set of defines to set for the compile process in esphome/core/defines.h
518
- self.defines: set["Define"] = set()
521
+ self.defines: set[Define] = set()
519
522
  # A map of all platformio options to apply
520
523
  self.platformio_options: dict[str, Union[str, list[str]]] = {}
521
524
  # A set of strings of names of loaded integrations, used to find namespace ID conflicts
@@ -246,162 +246,180 @@ class Application {
246
246
  #ifdef USE_BINARY_SENSOR
247
247
  const std::vector<binary_sensor::BinarySensor *> &get_binary_sensors() { return this->binary_sensors_; }
248
248
  binary_sensor::BinarySensor *get_binary_sensor_by_key(uint32_t key, bool include_internal = false) {
249
- for (auto *obj : this->binary_sensors_)
249
+ for (auto *obj : this->binary_sensors_) {
250
250
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
251
251
  return obj;
252
+ }
252
253
  return nullptr;
253
254
  }
254
255
  #endif
255
256
  #ifdef USE_SWITCH
256
257
  const std::vector<switch_::Switch *> &get_switches() { return this->switches_; }
257
258
  switch_::Switch *get_switch_by_key(uint32_t key, bool include_internal = false) {
258
- for (auto *obj : this->switches_)
259
+ for (auto *obj : this->switches_) {
259
260
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
260
261
  return obj;
262
+ }
261
263
  return nullptr;
262
264
  }
263
265
  #endif
264
266
  #ifdef USE_BUTTON
265
267
  const std::vector<button::Button *> &get_buttons() { return this->buttons_; }
266
268
  button::Button *get_button_by_key(uint32_t key, bool include_internal = false) {
267
- for (auto *obj : this->buttons_)
269
+ for (auto *obj : this->buttons_) {
268
270
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
269
271
  return obj;
272
+ }
270
273
  return nullptr;
271
274
  }
272
275
  #endif
273
276
  #ifdef USE_SENSOR
274
277
  const std::vector<sensor::Sensor *> &get_sensors() { return this->sensors_; }
275
278
  sensor::Sensor *get_sensor_by_key(uint32_t key, bool include_internal = false) {
276
- for (auto *obj : this->sensors_)
279
+ for (auto *obj : this->sensors_) {
277
280
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
278
281
  return obj;
282
+ }
279
283
  return nullptr;
280
284
  }
281
285
  #endif
282
286
  #ifdef USE_TEXT_SENSOR
283
287
  const std::vector<text_sensor::TextSensor *> &get_text_sensors() { return this->text_sensors_; }
284
288
  text_sensor::TextSensor *get_text_sensor_by_key(uint32_t key, bool include_internal = false) {
285
- for (auto *obj : this->text_sensors_)
289
+ for (auto *obj : this->text_sensors_) {
286
290
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
287
291
  return obj;
292
+ }
288
293
  return nullptr;
289
294
  }
290
295
  #endif
291
296
  #ifdef USE_FAN
292
297
  const std::vector<fan::Fan *> &get_fans() { return this->fans_; }
293
298
  fan::Fan *get_fan_by_key(uint32_t key, bool include_internal = false) {
294
- for (auto *obj : this->fans_)
299
+ for (auto *obj : this->fans_) {
295
300
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
296
301
  return obj;
302
+ }
297
303
  return nullptr;
298
304
  }
299
305
  #endif
300
306
  #ifdef USE_COVER
301
307
  const std::vector<cover::Cover *> &get_covers() { return this->covers_; }
302
308
  cover::Cover *get_cover_by_key(uint32_t key, bool include_internal = false) {
303
- for (auto *obj : this->covers_)
309
+ for (auto *obj : this->covers_) {
304
310
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
305
311
  return obj;
312
+ }
306
313
  return nullptr;
307
314
  }
308
315
  #endif
309
316
  #ifdef USE_LIGHT
310
317
  const std::vector<light::LightState *> &get_lights() { return this->lights_; }
311
318
  light::LightState *get_light_by_key(uint32_t key, bool include_internal = false) {
312
- for (auto *obj : this->lights_)
319
+ for (auto *obj : this->lights_) {
313
320
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
314
321
  return obj;
322
+ }
315
323
  return nullptr;
316
324
  }
317
325
  #endif
318
326
  #ifdef USE_CLIMATE
319
327
  const std::vector<climate::Climate *> &get_climates() { return this->climates_; }
320
328
  climate::Climate *get_climate_by_key(uint32_t key, bool include_internal = false) {
321
- for (auto *obj : this->climates_)
329
+ for (auto *obj : this->climates_) {
322
330
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
323
331
  return obj;
332
+ }
324
333
  return nullptr;
325
334
  }
326
335
  #endif
327
336
  #ifdef USE_NUMBER
328
337
  const std::vector<number::Number *> &get_numbers() { return this->numbers_; }
329
338
  number::Number *get_number_by_key(uint32_t key, bool include_internal = false) {
330
- for (auto *obj : this->numbers_)
339
+ for (auto *obj : this->numbers_) {
331
340
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
332
341
  return obj;
342
+ }
333
343
  return nullptr;
334
344
  }
335
345
  #endif
336
346
  #ifdef USE_DATETIME_DATE
337
347
  const std::vector<datetime::DateEntity *> &get_dates() { return this->dates_; }
338
348
  datetime::DateEntity *get_date_by_key(uint32_t key, bool include_internal = false) {
339
- for (auto *obj : this->dates_)
349
+ for (auto *obj : this->dates_) {
340
350
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
341
351
  return obj;
352
+ }
342
353
  return nullptr;
343
354
  }
344
355
  #endif
345
356
  #ifdef USE_DATETIME_TIME
346
357
  const std::vector<datetime::TimeEntity *> &get_times() { return this->times_; }
347
358
  datetime::TimeEntity *get_time_by_key(uint32_t key, bool include_internal = false) {
348
- for (auto *obj : this->times_)
359
+ for (auto *obj : this->times_) {
349
360
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
350
361
  return obj;
362
+ }
351
363
  return nullptr;
352
364
  }
353
365
  #endif
354
366
  #ifdef USE_DATETIME_DATETIME
355
367
  const std::vector<datetime::DateTimeEntity *> &get_datetimes() { return this->datetimes_; }
356
368
  datetime::DateTimeEntity *get_datetime_by_key(uint32_t key, bool include_internal = false) {
357
- for (auto *obj : this->datetimes_)
369
+ for (auto *obj : this->datetimes_) {
358
370
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
359
371
  return obj;
372
+ }
360
373
  return nullptr;
361
374
  }
362
375
  #endif
363
376
  #ifdef USE_TEXT
364
377
  const std::vector<text::Text *> &get_texts() { return this->texts_; }
365
378
  text::Text *get_text_by_key(uint32_t key, bool include_internal = false) {
366
- for (auto *obj : this->texts_)
379
+ for (auto *obj : this->texts_) {
367
380
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
368
381
  return obj;
382
+ }
369
383
  return nullptr;
370
384
  }
371
385
  #endif
372
386
  #ifdef USE_SELECT
373
387
  const std::vector<select::Select *> &get_selects() { return this->selects_; }
374
388
  select::Select *get_select_by_key(uint32_t key, bool include_internal = false) {
375
- for (auto *obj : this->selects_)
389
+ for (auto *obj : this->selects_) {
376
390
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
377
391
  return obj;
392
+ }
378
393
  return nullptr;
379
394
  }
380
395
  #endif
381
396
  #ifdef USE_LOCK
382
397
  const std::vector<lock::Lock *> &get_locks() { return this->locks_; }
383
398
  lock::Lock *get_lock_by_key(uint32_t key, bool include_internal = false) {
384
- for (auto *obj : this->locks_)
399
+ for (auto *obj : this->locks_) {
385
400
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
386
401
  return obj;
402
+ }
387
403
  return nullptr;
388
404
  }
389
405
  #endif
390
406
  #ifdef USE_VALVE
391
407
  const std::vector<valve::Valve *> &get_valves() { return this->valves_; }
392
408
  valve::Valve *get_valve_by_key(uint32_t key, bool include_internal = false) {
393
- for (auto *obj : this->valves_)
409
+ for (auto *obj : this->valves_) {
394
410
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
395
411
  return obj;
412
+ }
396
413
  return nullptr;
397
414
  }
398
415
  #endif
399
416
  #ifdef USE_MEDIA_PLAYER
400
417
  const std::vector<media_player::MediaPlayer *> &get_media_players() { return this->media_players_; }
401
418
  media_player::MediaPlayer *get_media_player_by_key(uint32_t key, bool include_internal = false) {
402
- for (auto *obj : this->media_players_)
419
+ for (auto *obj : this->media_players_) {
403
420
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
404
421
  return obj;
422
+ }
405
423
  return nullptr;
406
424
  }
407
425
  #endif
@@ -411,9 +429,10 @@ class Application {
411
429
  return this->alarm_control_panels_;
412
430
  }
413
431
  alarm_control_panel::AlarmControlPanel *get_alarm_control_panel_by_key(uint32_t key, bool include_internal = false) {
414
- for (auto *obj : this->alarm_control_panels_)
432
+ for (auto *obj : this->alarm_control_panels_) {
415
433
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
416
434
  return obj;
435
+ }
417
436
  return nullptr;
418
437
  }
419
438
  #endif
@@ -421,9 +440,10 @@ class Application {
421
440
  #ifdef USE_EVENT
422
441
  const std::vector<event::Event *> &get_events() { return this->events_; }
423
442
  event::Event *get_event_by_key(uint32_t key, bool include_internal = false) {
424
- for (auto *obj : this->events_)
443
+ for (auto *obj : this->events_) {
425
444
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
426
445
  return obj;
446
+ }
427
447
  return nullptr;
428
448
  }
429
449
  #endif
@@ -431,9 +451,10 @@ class Application {
431
451
  #ifdef USE_UPDATE
432
452
  const std::vector<update::UpdateEntity *> &get_updates() { return this->updates_; }
433
453
  update::UpdateEntity *get_update_by_key(uint32_t key, bool include_internal = false) {
434
- for (auto *obj : this->updates_)
454
+ for (auto *obj : this->updates_) {
435
455
  if (obj->get_object_id_hash() == key && (include_internal || !obj->is_internal()))
436
456
  return obj;
457
+ }
437
458
  return nullptr;
438
459
  }
439
460
  #endif
esphome/core/automation.h CHANGED
@@ -82,7 +82,7 @@ template<typename... Ts> class Condition {
82
82
  }
83
83
 
84
84
  protected:
85
- template<int... S> bool check_tuple_(const std::tuple<Ts...> &tuple, seq<S...>) {
85
+ template<int... S> bool check_tuple_(const std::tuple<Ts...> &tuple, seq<S...> /*unused*/) {
86
86
  return this->check(std::get<S>(tuple)...);
87
87
  }
88
88
  };
@@ -156,7 +156,7 @@ template<typename... Ts> class Action {
156
156
  }
157
157
  }
158
158
  }
159
- template<int... S> void play_next_tuple_(const std::tuple<Ts...> &tuple, seq<S...>) {
159
+ template<int... S> void play_next_tuple_(const std::tuple<Ts...> &tuple, seq<S...> /*unused*/) {
160
160
  this->play_next_(std::get<S>(tuple)...);
161
161
  }
162
162
  void play_next_tuple_(const std::tuple<Ts...> &tuple) {
@@ -223,7 +223,9 @@ template<typename... Ts> class ActionList {
223
223
  }
224
224
 
225
225
  protected:
226
- template<int... S> void play_tuple_(const std::tuple<Ts...> &tuple, seq<S...>) { this->play(std::get<S>(tuple)...); }
226
+ template<int... S> void play_tuple_(const std::tuple<Ts...> &tuple, seq<S...> /*unused*/) {
227
+ this->play(std::get<S>(tuple)...);
228
+ }
227
229
 
228
230
  Action<Ts...> *actions_begin_{nullptr};
229
231
  Action<Ts...> *actions_end_{nullptr};
@@ -278,10 +278,11 @@ template<typename... Ts> class RepeatAction : public Action<Ts...> {
278
278
  this->then_.add_actions(actions);
279
279
  this->then_.add_action(new LambdaAction<uint32_t, Ts...>([this](uint32_t iteration, Ts... x) {
280
280
  iteration++;
281
- if (iteration >= this->count_.value(x...))
281
+ if (iteration >= this->count_.value(x...)) {
282
282
  this->play_next_tuple_(this->var_);
283
- else
283
+ } else {
284
284
  this->then_.play(iteration, x...);
285
+ }
285
286
  }));
286
287
  }
287
288