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
esphome/__main__.py CHANGED
@@ -1,12 +1,12 @@
1
1
  # PYTHON_ARGCOMPLETE_OK
2
2
  import argparse
3
+ from datetime import datetime
3
4
  import functools
4
5
  import logging
5
6
  import os
6
7
  import re
7
8
  import sys
8
9
  import time
9
- from datetime import datetime
10
10
 
11
11
  import argcomplete
12
12
 
@@ -39,14 +39,14 @@ from esphome.const import (
39
39
  )
40
40
  from esphome.core import CORE, EsphomeError, coroutine
41
41
  from esphome.helpers import indent, is_ip_address
42
+ from esphome.log import Fore, color, setup_log
42
43
  from esphome.util import (
44
+ get_serial_ports,
45
+ list_yaml_files,
43
46
  run_external_command,
44
47
  run_external_process,
45
48
  safe_print,
46
- list_yaml_files,
47
- get_serial_ports,
48
49
  )
49
- from esphome.log import color, setup_log, Fore
50
50
 
51
51
  _LOGGER = logging.getLogger(__name__)
52
52
 
@@ -116,6 +116,7 @@ def get_port_type(port):
116
116
 
117
117
  def run_miniterm(config, port):
118
118
  import serial
119
+
119
120
  from esphome import platformio_api
120
121
 
121
122
  if CONF_LOGGER not in config:
@@ -596,9 +597,10 @@ def command_update_all(args):
596
597
 
597
598
 
598
599
  def command_idedata(args, config):
599
- from esphome import platformio_api
600
600
  import json
601
601
 
602
+ from esphome import platformio_api
603
+
602
604
  logging.disable(logging.INFO)
603
605
  logging.disable(logging.WARNING)
604
606
 
@@ -747,7 +749,14 @@ def parse_args(argv):
747
749
  )
748
750
 
749
751
  parser = argparse.ArgumentParser(
750
- description=f"ESPHome v{const.__version__}", parents=[options_parser]
752
+ description=f"ESPHome {const.__version__}", parents=[options_parser]
753
+ )
754
+
755
+ parser.add_argument(
756
+ "--version",
757
+ action="version",
758
+ version=f"Version: {const.__version__}",
759
+ help="Print the ESPHome version and exit.",
751
760
  )
752
761
 
753
762
  mqtt_options = argparse.ArgumentParser(add_help=False)
@@ -948,67 +957,6 @@ def parse_args(argv):
948
957
  # a deprecation warning).
949
958
  arguments = argv[1:]
950
959
 
951
- # On Python 3.9+ we can simply set exit_on_error=False in the constructor
952
- def _raise(x):
953
- raise argparse.ArgumentError(None, x)
954
-
955
- # First, try new-style parsing, but don't exit in case of failure
956
- try:
957
- # duplicate parser so that we can use the original one to raise errors later on
958
- current_parser = argparse.ArgumentParser(add_help=False, parents=[parser])
959
- current_parser.set_defaults(deprecated_argv_suggestion=None)
960
- current_parser.error = _raise
961
- return current_parser.parse_args(arguments)
962
- except argparse.ArgumentError:
963
- pass
964
-
965
- # Second, try compat parsing and rearrange the command-line if it succeeds
966
- # Disable argparse's built-in help option and add it manually to prevent this
967
- # parser from printing the help messagefor the old format when invoked with -h.
968
- compat_parser = argparse.ArgumentParser(parents=[options_parser], add_help=False)
969
- compat_parser.add_argument("-h", "--help", action="store_true")
970
- compat_parser.add_argument("configuration", nargs="*")
971
- compat_parser.add_argument(
972
- "command",
973
- choices=[
974
- "config",
975
- "compile",
976
- "upload",
977
- "logs",
978
- "run",
979
- "clean-mqtt",
980
- "wizard",
981
- "mqtt-fingerprint",
982
- "version",
983
- "clean",
984
- "dashboard",
985
- "vscode",
986
- "update-all",
987
- ],
988
- )
989
-
990
- try:
991
- compat_parser.error = _raise
992
- result, unparsed = compat_parser.parse_known_args(argv[1:])
993
- last_option = len(arguments) - len(unparsed) - 1 - len(result.configuration)
994
- unparsed = [
995
- "--device" if arg in ("--upload-port", "--serial-port") else arg
996
- for arg in unparsed
997
- ]
998
- arguments = (
999
- arguments[0:last_option]
1000
- + [result.command]
1001
- + result.configuration
1002
- + unparsed
1003
- )
1004
- deprecated_argv_suggestion = arguments
1005
- except argparse.ArgumentError:
1006
- # old-style parsing failed, don't suggest any argument
1007
- deprecated_argv_suggestion = None
1008
-
1009
- # Finally, run the new-style parser again with the possibly swapped arguments,
1010
- # and let it error out if the command is unparsable.
1011
- parser.set_defaults(deprecated_argv_suggestion=deprecated_argv_suggestion)
1012
960
  argcomplete.autocomplete(parser)
1013
961
  return parser.parse_args(arguments)
1014
962
 
@@ -1023,20 +971,6 @@ def run_esphome(argv):
1023
971
  # Show timestamp for dashboard access logs
1024
972
  args.command == "dashboard",
1025
973
  )
1026
- if args.deprecated_argv_suggestion is not None and args.command != "vscode":
1027
- _LOGGER.warning(
1028
- "Calling ESPHome with the configuration before the command is deprecated "
1029
- "and will be removed in the future. "
1030
- )
1031
- _LOGGER.warning("Please instead use:")
1032
- _LOGGER.warning(" esphome %s", " ".join(args.deprecated_argv_suggestion))
1033
-
1034
- if sys.version_info < (3, 8, 0):
1035
- _LOGGER.error(
1036
- "You're running ESPHome with Python <3.8. ESPHome is no longer compatible "
1037
- "with this Python version. Please reinstall ESPHome with Python 3.8+"
1038
- )
1039
- return 1
1040
974
 
1041
975
  if args.command in PRE_CONFIG_ACTIONS:
1042
976
  try:
esphome/automation.py CHANGED
@@ -7,10 +7,10 @@ from esphome.const import (
7
7
  CONF_ELSE,
8
8
  CONF_ID,
9
9
  CONF_THEN,
10
+ CONF_TIME,
10
11
  CONF_TIMEOUT,
11
12
  CONF_TRIGGER_ID,
12
13
  CONF_TYPE_ID,
13
- CONF_TIME,
14
14
  CONF_UPDATE_INTERVAL,
15
15
  )
16
16
  from esphome.schema_extractors import SCHEMA_EXTRACT, schema_extractor
esphome/codegen.py CHANGED
@@ -8,55 +8,78 @@
8
8
  # want to break suddenly due to a rename (this file will get backports for features).
9
9
 
10
10
  # pylint: disable=unused-import
11
- from esphome.cpp_generator import ( # noqa
11
+ from esphome.cpp_generator import ( # noqa: F401
12
+ ArrayInitializer,
12
13
  Expression,
14
+ LineComment,
15
+ MockObj,
16
+ MockObjClass,
17
+ Pvariable,
13
18
  RawExpression,
14
19
  RawStatement,
15
- TemplateArguments,
16
- StructInitializer,
17
- ArrayInitializer,
18
- safe_exp,
19
20
  Statement,
20
- LineComment,
21
- progmem_array,
22
- static_const_array,
23
- statement,
24
- variable,
25
- with_local_variable,
26
- new_variable,
27
- Pvariable,
28
- new_Pvariable,
21
+ StructInitializer,
22
+ TemplateArguments,
29
23
  add,
30
- add_global,
31
- add_library,
32
24
  add_build_flag,
33
25
  add_define,
26
+ add_global,
27
+ add_library,
34
28
  add_platformio_option,
35
29
  get_variable,
36
30
  get_variable_with_full_id,
37
- process_lambda,
38
31
  is_template,
32
+ new_Pvariable,
33
+ new_variable,
34
+ process_lambda,
35
+ progmem_array,
36
+ safe_exp,
37
+ statement,
38
+ static_const_array,
39
39
  templatable,
40
- MockObj,
41
- MockObjClass,
40
+ variable,
41
+ with_local_variable,
42
42
  )
43
- from esphome.cpp_helpers import ( # noqa
44
- gpio_pin_expression,
45
- register_component,
43
+ from esphome.cpp_helpers import ( # noqa: F401
46
44
  build_registry_entry,
47
45
  build_registry_list,
48
46
  extract_registry_entry_config,
49
- register_parented,
47
+ gpio_pin_expression,
50
48
  past_safe_mode,
49
+ register_component,
50
+ register_parented,
51
51
  )
52
- from esphome.cpp_types import ( # noqa
53
- global_ns,
54
- void,
55
- nullptr,
56
- float_,
57
- double,
52
+ from esphome.cpp_types import ( # noqa: F401
53
+ NAN,
54
+ App,
55
+ Application,
56
+ Component,
57
+ ComponentPtr,
58
+ Controller,
59
+ EntityBase,
60
+ EntityCategory,
61
+ ESPTime,
62
+ GPIOPin,
63
+ InternalGPIOPin,
64
+ JsonObject,
65
+ JsonObjectConst,
66
+ Parented,
67
+ PollingComponent,
68
+ arduino_json_ns,
58
69
  bool_,
70
+ const_char_ptr,
71
+ double,
72
+ esphome_ns,
73
+ float_,
74
+ global_ns,
75
+ gpio_Flags,
76
+ int16,
77
+ int32,
78
+ int64,
59
79
  int_,
80
+ nullptr,
81
+ optional,
82
+ size_t,
60
83
  std_ns,
61
84
  std_shared_ptr,
62
85
  std_string,
@@ -66,28 +89,5 @@ from esphome.cpp_types import ( # noqa
66
89
  uint16,
67
90
  uint32,
68
91
  uint64,
69
- int16,
70
- int32,
71
- int64,
72
- size_t,
73
- const_char_ptr,
74
- NAN,
75
- esphome_ns,
76
- App,
77
- EntityBase,
78
- Component,
79
- ComponentPtr,
80
- PollingComponent,
81
- Application,
82
- optional,
83
- arduino_json_ns,
84
- JsonObject,
85
- JsonObjectConst,
86
- Controller,
87
- GPIOPin,
88
- InternalGPIOPin,
89
- gpio_Flags,
90
- EntityCategory,
91
- Parented,
92
- ESPTime,
92
+ void,
93
93
  )
@@ -1,5 +1,5 @@
1
1
  import esphome.config_validation as cv
2
2
 
3
- CONFIG_SCHEMA = CONFIG_SCHEMA = cv.invalid(
3
+ CONFIG_SCHEMA = cv.invalid(
4
4
  "The ade7953 sensor component has been renamed to ade7953_i2c."
5
5
  )
@@ -60,7 +60,7 @@ bool AdE7953Spi::ade_read_16(uint16_t reg, uint16_t *value) {
60
60
  this->write_byte16(reg);
61
61
  this->transfer_byte(0x80);
62
62
  uint8_t recv[2];
63
- this->read_array(recv, 4);
63
+ this->read_array(recv, 2);
64
64
  *value = encode_uint16(recv[0], recv[1]);
65
65
  this->disable();
66
66
  return false;
@@ -14,8 +14,6 @@ void AirthingsWavePlus::read_sensors(uint8_t *raw_value, uint16_t value_len) {
14
14
  ESP_LOGD(TAG, "version = %d", value->version);
15
15
 
16
16
  if (value->version == 1) {
17
- ESP_LOGD(TAG, "ambient light = %d", value->ambientLight);
18
-
19
17
  if (this->humidity_sensor_ != nullptr) {
20
18
  this->humidity_sensor_->publish_state(value->humidity / 2.0f);
21
19
  }
@@ -43,6 +41,10 @@ void AirthingsWavePlus::read_sensors(uint8_t *raw_value, uint16_t value_len) {
43
41
  if ((this->tvoc_sensor_ != nullptr) && this->is_valid_voc_value_(value->voc)) {
44
42
  this->tvoc_sensor_->publish_state(value->voc);
45
43
  }
44
+
45
+ if (this->illuminance_sensor_ != nullptr) {
46
+ this->illuminance_sensor_->publish_state(value->ambientLight);
47
+ }
46
48
  } else {
47
49
  ESP_LOGE(TAG, "Invalid payload version (%d != 1, newer version or not a Wave Plus?)", value->version);
48
50
  }
@@ -68,6 +70,7 @@ void AirthingsWavePlus::dump_config() {
68
70
  LOG_SENSOR(" ", "Radon", this->radon_sensor_);
69
71
  LOG_SENSOR(" ", "Radon Long Term", this->radon_long_term_sensor_);
70
72
  LOG_SENSOR(" ", "CO2", this->co2_sensor_);
73
+ LOG_SENSOR(" ", "Illuminance", this->illuminance_sensor_);
71
74
  }
72
75
 
73
76
  AirthingsWavePlus::AirthingsWavePlus() {
@@ -22,6 +22,7 @@ class AirthingsWavePlus : public airthings_wave_base::AirthingsWaveBase {
22
22
  void set_radon(sensor::Sensor *radon) { radon_sensor_ = radon; }
23
23
  void set_radon_long_term(sensor::Sensor *radon_long_term) { radon_long_term_sensor_ = radon_long_term; }
24
24
  void set_co2(sensor::Sensor *co2) { co2_sensor_ = co2; }
25
+ void set_illuminance(sensor::Sensor *illuminance) { illuminance_sensor_ = illuminance; }
25
26
 
26
27
  protected:
27
28
  bool is_valid_radon_value_(uint16_t radon);
@@ -32,6 +33,7 @@ class AirthingsWavePlus : public airthings_wave_base::AirthingsWaveBase {
32
33
  sensor::Sensor *radon_sensor_{nullptr};
33
34
  sensor::Sensor *radon_long_term_sensor_{nullptr};
34
35
  sensor::Sensor *co2_sensor_{nullptr};
36
+ sensor::Sensor *illuminance_sensor_{nullptr};
35
37
 
36
38
  struct WavePlusReadings {
37
39
  uint8_t version;
@@ -12,6 +12,9 @@ from esphome.const import (
12
12
  CONF_CO2,
13
13
  UNIT_BECQUEREL_PER_CUBIC_METER,
14
14
  UNIT_PARTS_PER_MILLION,
15
+ CONF_ILLUMINANCE,
16
+ UNIT_LUX,
17
+ DEVICE_CLASS_ILLUMINANCE,
15
18
  )
16
19
 
17
20
  DEPENDENCIES = airthings_wave_base.DEPENDENCIES
@@ -45,6 +48,12 @@ CONFIG_SCHEMA = airthings_wave_base.BASE_SCHEMA.extend(
45
48
  device_class=DEVICE_CLASS_CARBON_DIOXIDE,
46
49
  state_class=STATE_CLASS_MEASUREMENT,
47
50
  ),
51
+ cv.Optional(CONF_ILLUMINANCE): sensor.sensor_schema(
52
+ unit_of_measurement=UNIT_LUX,
53
+ accuracy_decimals=0,
54
+ device_class=DEVICE_CLASS_ILLUMINANCE,
55
+ state_class=STATE_CLASS_MEASUREMENT,
56
+ ),
48
57
  }
49
58
  )
50
59
 
@@ -62,3 +71,6 @@ async def to_code(config):
62
71
  if config_co2 := config.get(CONF_CO2):
63
72
  sens = await sensor.new_sensor(config_co2)
64
73
  cg.add(var.set_co2(sens))
74
+ if config_illuminance := config.get(CONF_ILLUMINANCE):
75
+ sens = await sensor.new_sensor(config_illuminance)
76
+ cg.add(var.set_illuminance(sens))
@@ -1,16 +1,17 @@
1
- import esphome.codegen as cg
2
- import esphome.config_validation as cv
3
- from esphome.components import web_server
4
1
  from esphome import automation
5
2
  from esphome.automation import maybe_simple_id
6
- from esphome.core import CORE, coroutine_with_priority
3
+ import esphome.codegen as cg
4
+ from esphome.components import mqtt, web_server
5
+ import esphome.config_validation as cv
7
6
  from esphome.const import (
7
+ CONF_CODE,
8
8
  CONF_ID,
9
+ CONF_MQTT_ID,
9
10
  CONF_ON_STATE,
10
11
  CONF_TRIGGER_ID,
11
- CONF_CODE,
12
12
  CONF_WEB_SERVER_ID,
13
13
  )
14
+ from esphome.core import CORE, coroutine_with_priority
14
15
  from esphome.cpp_helpers import setup_entity
15
16
 
16
17
  CODEOWNERS = ["@grahambrown11", "@hwstar"]
@@ -77,67 +78,72 @@ AlarmControlPanelCondition = alarm_control_panel_ns.class_(
77
78
  "AlarmControlPanelCondition", automation.Condition
78
79
  )
79
80
 
80
- ALARM_CONTROL_PANEL_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(
81
- web_server.WEBSERVER_SORTING_SCHEMA
82
- ).extend(
83
- {
84
- cv.GenerateID(): cv.declare_id(AlarmControlPanel),
85
- cv.Optional(CONF_ON_STATE): automation.validate_automation(
86
- {
87
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(StateTrigger),
88
- }
89
- ),
90
- cv.Optional(CONF_ON_TRIGGERED): automation.validate_automation(
91
- {
92
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(TriggeredTrigger),
93
- }
94
- ),
95
- cv.Optional(CONF_ON_ARMING): automation.validate_automation(
96
- {
97
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmingTrigger),
98
- }
99
- ),
100
- cv.Optional(CONF_ON_PENDING): automation.validate_automation(
101
- {
102
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(PendingTrigger),
103
- }
104
- ),
105
- cv.Optional(CONF_ON_ARMED_HOME): automation.validate_automation(
106
- {
107
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmedHomeTrigger),
108
- }
109
- ),
110
- cv.Optional(CONF_ON_ARMED_NIGHT): automation.validate_automation(
111
- {
112
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmedNightTrigger),
113
- }
114
- ),
115
- cv.Optional(CONF_ON_ARMED_AWAY): automation.validate_automation(
116
- {
117
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmedAwayTrigger),
118
- }
119
- ),
120
- cv.Optional(CONF_ON_DISARMED): automation.validate_automation(
121
- {
122
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(DisarmedTrigger),
123
- }
124
- ),
125
- cv.Optional(CONF_ON_CLEARED): automation.validate_automation(
126
- {
127
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ClearedTrigger),
128
- }
129
- ),
130
- cv.Optional(CONF_ON_CHIME): automation.validate_automation(
131
- {
132
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ChimeTrigger),
133
- }
134
- ),
135
- cv.Optional(CONF_ON_READY): automation.validate_automation(
136
- {
137
- cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ReadyTrigger),
138
- }
139
- ),
140
- }
81
+ ALARM_CONTROL_PANEL_SCHEMA = (
82
+ cv.ENTITY_BASE_SCHEMA.extend(web_server.WEBSERVER_SORTING_SCHEMA)
83
+ .extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA)
84
+ .extend(
85
+ {
86
+ cv.GenerateID(): cv.declare_id(AlarmControlPanel),
87
+ cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(
88
+ mqtt.MQTTAlarmControlPanelComponent
89
+ ),
90
+ cv.Optional(CONF_ON_STATE): automation.validate_automation(
91
+ {
92
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(StateTrigger),
93
+ }
94
+ ),
95
+ cv.Optional(CONF_ON_TRIGGERED): automation.validate_automation(
96
+ {
97
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(TriggeredTrigger),
98
+ }
99
+ ),
100
+ cv.Optional(CONF_ON_ARMING): automation.validate_automation(
101
+ {
102
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmingTrigger),
103
+ }
104
+ ),
105
+ cv.Optional(CONF_ON_PENDING): automation.validate_automation(
106
+ {
107
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(PendingTrigger),
108
+ }
109
+ ),
110
+ cv.Optional(CONF_ON_ARMED_HOME): automation.validate_automation(
111
+ {
112
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmedHomeTrigger),
113
+ }
114
+ ),
115
+ cv.Optional(CONF_ON_ARMED_NIGHT): automation.validate_automation(
116
+ {
117
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmedNightTrigger),
118
+ }
119
+ ),
120
+ cv.Optional(CONF_ON_ARMED_AWAY): automation.validate_automation(
121
+ {
122
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmedAwayTrigger),
123
+ }
124
+ ),
125
+ cv.Optional(CONF_ON_DISARMED): automation.validate_automation(
126
+ {
127
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(DisarmedTrigger),
128
+ }
129
+ ),
130
+ cv.Optional(CONF_ON_CLEARED): automation.validate_automation(
131
+ {
132
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ClearedTrigger),
133
+ }
134
+ ),
135
+ cv.Optional(CONF_ON_CHIME): automation.validate_automation(
136
+ {
137
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ChimeTrigger),
138
+ }
139
+ ),
140
+ cv.Optional(CONF_ON_READY): automation.validate_automation(
141
+ {
142
+ cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ReadyTrigger),
143
+ }
144
+ ),
145
+ }
146
+ )
141
147
  )
142
148
 
143
149
  ALARM_CONTROL_PANEL_ACTION_SCHEMA = maybe_simple_id(
@@ -192,6 +198,9 @@ async def setup_alarm_control_panel_core_(var, config):
192
198
  if (webserver_id := config.get(CONF_WEB_SERVER_ID)) is not None:
193
199
  web_server_ = await cg.get_variable(webserver_id)
194
200
  web_server.add_entity_to_sorting_list(web_server_, var, config)
201
+ if mqtt_id := config.get(CONF_MQTT_ID):
202
+ mqtt_ = cg.new_Pvariable(mqtt_id, var)
203
+ await mqtt.register_mqtt_component(mqtt_, config)
195
204
 
196
205
 
197
206
  async def register_alarm_control_panel(var, config):
@@ -0,0 +1,4 @@
1
+ # Based on this datasheet:
2
+ # https://www.mouser.ca/datasheet/2/678/AVGO_S_A0002854364_1-2574547.pdf
3
+
4
+ CODEOWNERS = ["@aodrenah"]