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,5 +1,6 @@
1
1
  #include "wifi_component.h"
2
2
 
3
+ #ifdef USE_WIFI
3
4
  #ifdef USE_ESP_IDF
4
5
 
5
6
  #include <esp_event.h>
@@ -15,8 +16,12 @@
15
16
  #include <cinttypes>
16
17
  #include <utility>
17
18
  #ifdef USE_WIFI_WPA2_EAP
19
+ #if (ESP_IDF_VERSION_MAJOR >= 5) && (ESP_IDF_VERSION_MINOR >= 1)
20
+ #include <esp_eap_client.h>
21
+ #else
18
22
  #include <esp_wpa2.h>
19
23
  #endif
24
+ #endif
20
25
 
21
26
  #ifdef USE_WIFI_AP
22
27
  #include "dhcpserver/dhcpserver.h"
@@ -364,48 +369,78 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
364
369
  if (ap.get_eap().has_value()) {
365
370
  // note: all certificates and keys have to be null terminated. Lengths are appended by +1 to include \0.
366
371
  EAPAuth eap = ap.get_eap().value();
372
+ #if (ESP_IDF_VERSION_MAJOR >= 5) && (ESP_IDF_VERSION_MINOR >= 1)
373
+ err = esp_eap_client_set_identity((uint8_t *) eap.identity.c_str(), eap.identity.length());
374
+ #else
367
375
  err = esp_wifi_sta_wpa2_ent_set_identity((uint8_t *) eap.identity.c_str(), eap.identity.length());
376
+ #endif
368
377
  if (err != ESP_OK) {
369
- ESP_LOGV(TAG, "esp_wifi_sta_wpa2_ent_set_identity failed! %d", err);
378
+ ESP_LOGV(TAG, "set_identity failed %d", err);
370
379
  }
371
380
  int ca_cert_len = strlen(eap.ca_cert);
372
381
  int client_cert_len = strlen(eap.client_cert);
373
382
  int client_key_len = strlen(eap.client_key);
374
383
  if (ca_cert_len) {
384
+ #if (ESP_IDF_VERSION_MAJOR >= 5) && (ESP_IDF_VERSION_MINOR >= 1)
385
+ err = esp_eap_client_set_ca_cert((uint8_t *) eap.ca_cert, ca_cert_len + 1);
386
+ #else
375
387
  err = esp_wifi_sta_wpa2_ent_set_ca_cert((uint8_t *) eap.ca_cert, ca_cert_len + 1);
388
+ #endif
376
389
  if (err != ESP_OK) {
377
- ESP_LOGV(TAG, "esp_wifi_sta_wpa2_ent_set_ca_cert failed! %d", err);
390
+ ESP_LOGV(TAG, "set_ca_cert failed %d", err);
378
391
  }
379
392
  }
380
393
  // workout what type of EAP this is
381
394
  // validation is not required as the config tool has already validated it
382
395
  if (client_cert_len && client_key_len) {
383
396
  // if we have certs, this must be EAP-TLS
397
+ #if (ESP_IDF_VERSION_MAJOR >= 5) && (ESP_IDF_VERSION_MINOR >= 1)
398
+ err = esp_eap_client_set_certificate_and_key((uint8_t *) eap.client_cert, client_cert_len + 1,
399
+ (uint8_t *) eap.client_key, client_key_len + 1,
400
+ (uint8_t *) eap.password.c_str(), strlen(eap.password.c_str()));
401
+ #else
384
402
  err = esp_wifi_sta_wpa2_ent_set_cert_key((uint8_t *) eap.client_cert, client_cert_len + 1,
385
403
  (uint8_t *) eap.client_key, client_key_len + 1,
386
404
  (uint8_t *) eap.password.c_str(), strlen(eap.password.c_str()));
405
+ #endif
387
406
  if (err != ESP_OK) {
388
- ESP_LOGV(TAG, "esp_wifi_sta_wpa2_ent_set_cert_key failed! %d", err);
407
+ ESP_LOGV(TAG, "set_cert_key failed %d", err);
389
408
  }
390
409
  } else {
391
410
  // in the absence of certs, assume this is username/password based
411
+ #if (ESP_IDF_VERSION_MAJOR >= 5) && (ESP_IDF_VERSION_MINOR >= 1)
412
+ err = esp_eap_client_set_username((uint8_t *) eap.username.c_str(), eap.username.length());
413
+ #else
392
414
  err = esp_wifi_sta_wpa2_ent_set_username((uint8_t *) eap.username.c_str(), eap.username.length());
415
+ #endif
393
416
  if (err != ESP_OK) {
394
- ESP_LOGV(TAG, "esp_wifi_sta_wpa2_ent_set_username failed! %d", err);
417
+ ESP_LOGV(TAG, "set_username failed %d", err);
395
418
  }
419
+ #if (ESP_IDF_VERSION_MAJOR >= 5) && (ESP_IDF_VERSION_MINOR >= 1)
420
+ err = esp_eap_client_set_password((uint8_t *) eap.password.c_str(), eap.password.length());
421
+ #else
396
422
  err = esp_wifi_sta_wpa2_ent_set_password((uint8_t *) eap.password.c_str(), eap.password.length());
423
+ #endif
397
424
  if (err != ESP_OK) {
398
- ESP_LOGV(TAG, "esp_wifi_sta_wpa2_ent_set_password failed! %d", err);
425
+ ESP_LOGV(TAG, "set_password failed %d", err);
399
426
  }
400
427
  // set TTLS Phase 2, defaults to MSCHAPV2
428
+ #if (ESP_IDF_VERSION_MAJOR >= 5) && (ESP_IDF_VERSION_MINOR >= 1)
429
+ err = esp_eap_client_set_ttls_phase2_method(eap.ttls_phase_2);
430
+ #else
401
431
  err = esp_wifi_sta_wpa2_ent_set_ttls_phase2_method(eap.ttls_phase_2);
432
+ #endif
402
433
  if (err != ESP_OK) {
403
- ESP_LOGV(TAG, "esp_wifi_sta_wpa2_ent_set_ttls_phase2_method failed! %d", err);
434
+ ESP_LOGV(TAG, "set_ttls_phase2_method failed %d", err);
404
435
  }
405
436
  }
437
+ #if (ESP_IDF_VERSION_MAJOR >= 5) && (ESP_IDF_VERSION_MINOR >= 1)
438
+ err = esp_wifi_sta_enterprise_enable();
439
+ #else
406
440
  err = esp_wifi_sta_wpa2_ent_enable();
441
+ #endif
407
442
  if (err != ESP_OK) {
408
- ESP_LOGV(TAG, "esp_wifi_sta_wpa2_ent_enable failed! %d", err);
443
+ ESP_LOGV(TAG, "enterprise_enable failed %d", err);
409
444
  }
410
445
  }
411
446
  #endif // USE_WIFI_WPA2_EAP
@@ -976,3 +1011,4 @@ network::IPAddress WiFiComponent::wifi_dns_ip_(int num) {
976
1011
  } // namespace esphome
977
1012
 
978
1013
  #endif // USE_ESP_IDF
1014
+ #endif
@@ -1,5 +1,6 @@
1
1
  #include "wifi_component.h"
2
2
 
3
+ #ifdef USE_WIFI
3
4
  #ifdef USE_LIBRETINY
4
5
 
5
6
  #include <utility>
@@ -468,3 +469,4 @@ void WiFiComponent::wifi_loop_() {}
468
469
  } // namespace esphome
469
470
 
470
471
  #endif // USE_LIBRETINY
472
+ #endif
@@ -1,6 +1,7 @@
1
1
 
2
2
  #include "wifi_component.h"
3
3
 
4
+ #ifdef USE_WIFI
4
5
  #ifdef USE_RP2040
5
6
 
6
7
  #include "lwip/dns.h"
@@ -218,3 +219,4 @@ void WiFiComponent::wifi_pre_setup_() {}
218
219
  } // namespace esphome
219
220
 
220
221
  #endif
222
+ #endif
@@ -7,16 +7,15 @@ so that it doesn't crash if it's not installed.
7
7
  import logging
8
8
  from pathlib import Path
9
9
 
10
- from esphome.core import CORE
11
10
  import esphome.config_validation as cv
12
11
  from esphome.const import (
13
- CONF_USERNAME,
14
- CONF_IDENTITY,
15
- CONF_PASSWORD,
16
12
  CONF_CERTIFICATE,
13
+ CONF_IDENTITY,
17
14
  CONF_KEY,
15
+ CONF_PASSWORD,
16
+ CONF_USERNAME,
18
17
  )
19
-
18
+ from esphome.core import CORE
20
19
 
21
20
  _LOGGER = logging.getLogger(__name__)
22
21
 
@@ -49,8 +48,8 @@ def wrapped_load_pem_x509_certificate(value):
49
48
  def wrapped_load_pem_private_key(value, password):
50
49
  validate_cryptography_installed()
51
50
 
52
- from cryptography.hazmat.primitives.serialization import load_pem_private_key
53
51
  from cryptography.hazmat.backends import default_backend
52
+ from cryptography.hazmat.primitives.serialization import load_pem_private_key
54
53
 
55
54
  if password:
56
55
  password = password.encode("UTF-8")
@@ -91,7 +90,7 @@ def _validate_load_private_key(key, cert_pw):
91
90
 
92
91
 
93
92
  def _check_private_key_cert_match(key, cert):
94
- from cryptography.hazmat.primitives.asymmetric import rsa, ec
93
+ from cryptography.hazmat.primitives.asymmetric import ec, rsa
95
94
 
96
95
  def check_match_a():
97
96
  return key.public_key().public_numbers() == cert.public_key().public_numbers()
@@ -1,13 +1,13 @@
1
1
  import esphome.codegen as cg
2
- import esphome.config_validation as cv
3
2
  from esphome.components import text_sensor
3
+ import esphome.config_validation as cv
4
4
  from esphome.const import (
5
5
  CONF_BSSID,
6
+ CONF_DNS_ADDRESS,
6
7
  CONF_IP_ADDRESS,
8
+ CONF_MAC_ADDRESS,
7
9
  CONF_SCAN_RESULTS,
8
10
  CONF_SSID,
9
- CONF_MAC_ADDRESS,
10
- CONF_DNS_ADDRESS,
11
11
  ENTITY_CATEGORY_DIAGNOSTIC,
12
12
  )
13
13
 
@@ -1,4 +1,5 @@
1
1
  #include "wifi_info_text_sensor.h"
2
+ #ifdef USE_WIFI
2
3
  #include "esphome/core/log.h"
3
4
 
4
5
  namespace esphome {
@@ -15,3 +16,4 @@ void DNSAddressWifiInfo::dump_config() { LOG_TEXT_SENSOR("", "WifiInfo DNS Addre
15
16
 
16
17
  } // namespace wifi_info
17
18
  } // namespace esphome
19
+ #endif
@@ -3,6 +3,7 @@
3
3
  #include "esphome/core/component.h"
4
4
  #include "esphome/components/text_sensor/text_sensor.h"
5
5
  #include "esphome/components/wifi/wifi_component.h"
6
+ #ifdef USE_WIFI
6
7
  #include <array>
7
8
 
8
9
  namespace esphome {
@@ -131,3 +132,4 @@ class MacAddressWifiInfo : public Component, public text_sensor::TextSensor {
131
132
 
132
133
  } // namespace wifi_info
133
134
  } // namespace esphome
135
+ #endif
@@ -1,6 +1,6 @@
1
1
  import esphome.codegen as cg
2
- import esphome.config_validation as cv
3
2
  from esphome.components import sensor
3
+ import esphome.config_validation as cv
4
4
  from esphome.const import (
5
5
  DEVICE_CLASS_SIGNAL_STRENGTH,
6
6
  ENTITY_CATEGORY_DIAGNOSTIC,
@@ -1,4 +1,5 @@
1
1
  #include "wifi_signal_sensor.h"
2
+ #ifdef USE_WIFI
2
3
  #include "esphome/core/log.h"
3
4
 
4
5
  namespace esphome {
@@ -10,3 +11,4 @@ void WiFiSignalSensor::dump_config() { LOG_SENSOR("", "WiFi Signal", this); }
10
11
 
11
12
  } // namespace wifi_signal
12
13
  } // namespace esphome
14
+ #endif
@@ -4,7 +4,7 @@
4
4
  #include "esphome/core/helpers.h"
5
5
  #include "esphome/components/sensor/sensor.h"
6
6
  #include "esphome/components/wifi/wifi_component.h"
7
-
7
+ #ifdef USE_WIFI
8
8
  namespace esphome {
9
9
  namespace wifi_signal {
10
10
 
@@ -19,3 +19,4 @@ class WiFiSignalSensor : public sensor::Sensor, public PollingComponent {
19
19
 
20
20
  } // namespace wifi_signal
21
21
  } // namespace esphome
22
+ #endif
@@ -49,8 +49,8 @@ bool parse_xiaomi_value(uint16_t value_type, const uint8_t *data, uint8_t value_
49
49
  const uint16_t conductivity = encode_uint16(data[1], data[0]);
50
50
  result.conductivity = conductivity;
51
51
  }
52
- // battery, 1 byte, 8-bit unsigned integer, 1 %
53
- else if ((value_type == 0x100A) && (value_length == 1)) {
52
+ // battery / MiaoMiaoce battery, 1 byte, 8-bit unsigned integer, 1 %
53
+ else if ((value_type == 0x100A || value_type == 0x4803) && (value_length == 1)) {
54
54
  result.battery_level = data[0];
55
55
  }
56
56
  // temperature + humidity, 4 bytes, 16-bit signed integer (LE) each, 0.1 °C, 0.1 %
@@ -80,6 +80,17 @@ bool parse_xiaomi_value(uint16_t value_type, const uint8_t *data, uint8_t value_
80
80
  result.has_motion = !idle_time;
81
81
  } else if ((value_type == 0x1018) && (value_length == 1)) {
82
82
  result.is_light = data[0];
83
+ }
84
+ // MiaoMiaoce temperature, 4 bytes, float, 0.1 °C
85
+ else if ((value_type == 0x4C01) && (value_length == 4)) {
86
+ const uint32_t int_number = encode_uint32(data[3], data[2], data[1], data[0]);
87
+ float temperature;
88
+ std::memcpy(&temperature, &int_number, sizeof(temperature));
89
+ result.temperature = temperature;
90
+ }
91
+ // MiaoMiaoce humidity, 1 byte, 8-bit unsigned integer, 1 %
92
+ else if ((value_type == 0x4C02) && (value_length == 1)) {
93
+ result.humidity = data[0];
83
94
  } else {
84
95
  return false;
85
96
  }
@@ -111,7 +122,8 @@ bool parse_xiaomi_message(const std::vector<uint8_t> &message, XiaomiParseResult
111
122
  }
112
123
 
113
124
  while (payload_length > 3) {
114
- if (payload[payload_offset + 1] != 0x10 && payload[payload_offset + 1] != 0x00) {
125
+ if (payload[payload_offset + 1] != 0x10 && payload[payload_offset + 1] != 0x00 &&
126
+ payload[payload_offset + 1] != 0x4C && payload[payload_offset + 1] != 0x48) {
115
127
  ESP_LOGVV(TAG, "parse_xiaomi_message(): fixed byte not found, stop parsing residual data.");
116
128
  break;
117
129
  }
@@ -190,6 +202,11 @@ optional<XiaomiParseResult> parse_xiaomi_header(const esp32_ble_tracker::Service
190
202
  } else if (device_uuid == 0x045b) { // rectangular body, e-ink display
191
203
  result.type = XiaomiParseResult::TYPE_LYWSD02;
192
204
  result.name = "LYWSD02";
205
+ } else if (device_uuid == 0x2542) { // rectangular body, e-ink display — with bindkeys
206
+ result.type = XiaomiParseResult::TYPE_LYWSD02MMC;
207
+ result.name = "LYWSD02MMC";
208
+ if (raw.size() == 19)
209
+ result.raw_offset -= 6;
193
210
  } else if (device_uuid == 0x040a) { // Mosquito Repellent Smart Version
194
211
  result.type = XiaomiParseResult::TYPE_WX08ZM;
195
212
  result.name = "WX08ZM";
@@ -17,6 +17,7 @@ struct XiaomiParseResult {
17
17
  TYPE_HHCCPOT002,
18
18
  TYPE_LYWSDCGQ,
19
19
  TYPE_LYWSD02,
20
+ TYPE_LYWSD02MMC,
20
21
  TYPE_CGG1,
21
22
  TYPE_LYWSD03MMC,
22
23
  TYPE_CGD1,
File without changes
@@ -0,0 +1,77 @@
1
+ import esphome.codegen as cg
2
+ import esphome.config_validation as cv
3
+ from esphome.components import sensor, esp32_ble_tracker
4
+ from esphome.const import (
5
+ CONF_BATTERY_LEVEL,
6
+ CONF_HUMIDITY,
7
+ CONF_MAC_ADDRESS,
8
+ CONF_TEMPERATURE,
9
+ DEVICE_CLASS_TEMPERATURE,
10
+ ENTITY_CATEGORY_DIAGNOSTIC,
11
+ STATE_CLASS_MEASUREMENT,
12
+ UNIT_CELSIUS,
13
+ UNIT_PERCENT,
14
+ DEVICE_CLASS_HUMIDITY,
15
+ DEVICE_CLASS_BATTERY,
16
+ CONF_ID,
17
+ CONF_BINDKEY,
18
+ )
19
+
20
+ AUTO_LOAD = ["xiaomi_ble"]
21
+ CODEOWNERS = ["@juanluss31"]
22
+ DEPENDENCIES = ["esp32_ble_tracker"]
23
+
24
+ xiaomi_lywsd02mmc_ns = cg.esphome_ns.namespace("xiaomi_lywsd02mmc")
25
+ XiaomiLYWSD02MMC = xiaomi_lywsd02mmc_ns.class_(
26
+ "XiaomiLYWSD02MMC", esp32_ble_tracker.ESPBTDeviceListener, cg.Component
27
+ )
28
+
29
+ CONFIG_SCHEMA = (
30
+ cv.Schema(
31
+ {
32
+ cv.GenerateID(): cv.declare_id(XiaomiLYWSD02MMC),
33
+ cv.Required(CONF_MAC_ADDRESS): cv.mac_address,
34
+ cv.Required(CONF_BINDKEY): cv.bind_key,
35
+ cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(
36
+ unit_of_measurement=UNIT_CELSIUS,
37
+ accuracy_decimals=1,
38
+ device_class=DEVICE_CLASS_TEMPERATURE,
39
+ state_class=STATE_CLASS_MEASUREMENT,
40
+ ),
41
+ cv.Optional(CONF_HUMIDITY): sensor.sensor_schema(
42
+ unit_of_measurement=UNIT_PERCENT,
43
+ accuracy_decimals=0,
44
+ device_class=DEVICE_CLASS_HUMIDITY,
45
+ state_class=STATE_CLASS_MEASUREMENT,
46
+ ),
47
+ cv.Optional(CONF_BATTERY_LEVEL): sensor.sensor_schema(
48
+ unit_of_measurement=UNIT_PERCENT,
49
+ accuracy_decimals=0,
50
+ device_class=DEVICE_CLASS_BATTERY,
51
+ state_class=STATE_CLASS_MEASUREMENT,
52
+ entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
53
+ ),
54
+ }
55
+ )
56
+ .extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA)
57
+ .extend(cv.COMPONENT_SCHEMA)
58
+ )
59
+
60
+
61
+ async def to_code(config):
62
+ var = cg.new_Pvariable(config[CONF_ID])
63
+ await cg.register_component(var, config)
64
+ await esp32_ble_tracker.register_ble_device(var, config)
65
+
66
+ cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex))
67
+ cg.add(var.set_bindkey(config[CONF_BINDKEY]))
68
+
69
+ if temperature_config := config.get(CONF_TEMPERATURE):
70
+ sens = await sensor.new_sensor(temperature_config)
71
+ cg.add(var.set_temperature(sens))
72
+ if humidity_config := config.get(CONF_HUMIDITY):
73
+ sens = await sensor.new_sensor(humidity_config)
74
+ cg.add(var.set_humidity(sens))
75
+ if battery_level_config := config.get(CONF_BATTERY_LEVEL):
76
+ sens = await sensor.new_sensor(battery_level_config)
77
+ cg.add(var.set_battery_level(sens))
@@ -0,0 +1,73 @@
1
+ #include "xiaomi_lywsd02mmc.h"
2
+ #include "esphome/core/log.h"
3
+
4
+ #ifdef USE_ESP32
5
+
6
+ namespace esphome {
7
+ namespace xiaomi_lywsd02mmc {
8
+
9
+ static const char *const TAG = "xiaomi_lywsd02mmc";
10
+
11
+ void XiaomiLYWSD02MMC::dump_config() {
12
+ ESP_LOGCONFIG(TAG, "Xiaomi LYWSD02MMC");
13
+ ESP_LOGCONFIG(TAG, " Bindkey: %s", format_hex_pretty(this->bindkey_, 16).c_str());
14
+ LOG_SENSOR(" ", "Temperature", this->temperature_);
15
+ LOG_SENSOR(" ", "Humidity", this->humidity_);
16
+ LOG_SENSOR(" ", "Battery Level", this->battery_level_);
17
+ }
18
+
19
+ bool XiaomiLYWSD02MMC::parse_device(const esp32_ble_tracker::ESPBTDevice &device) {
20
+ if (device.address_uint64() != this->address_) {
21
+ ESP_LOGVV(TAG, "parse_device(): unknown MAC address.");
22
+ return false;
23
+ }
24
+ ESP_LOGVV(TAG, "parse_device(): MAC address %s found.", device.address_str().c_str());
25
+
26
+ bool success = false;
27
+ for (auto &service_data : device.get_service_datas()) {
28
+ auto res = xiaomi_ble::parse_xiaomi_header(service_data);
29
+ if (!res.has_value()) {
30
+ continue;
31
+ }
32
+ if (res->is_duplicate) {
33
+ continue;
34
+ }
35
+ if (res->has_encryption &&
36
+ (!(xiaomi_ble::decrypt_xiaomi_payload(const_cast<std::vector<uint8_t> &>(service_data.data), this->bindkey_,
37
+ this->address_)))) {
38
+ continue;
39
+ }
40
+ if (!(xiaomi_ble::parse_xiaomi_message(service_data.data, *res))) {
41
+ continue;
42
+ }
43
+ if (!(xiaomi_ble::report_xiaomi_results(res, device.address_str()))) {
44
+ continue;
45
+ }
46
+ if (res->temperature.has_value() && this->temperature_ != nullptr)
47
+ this->temperature_->publish_state(*res->temperature);
48
+ if (res->humidity.has_value() && this->humidity_ != nullptr)
49
+ this->humidity_->publish_state(*res->humidity);
50
+ if (res->battery_level.has_value() && this->battery_level_ != nullptr)
51
+ this->battery_level_->publish_state(*res->battery_level);
52
+ success = true;
53
+ }
54
+
55
+ return success;
56
+ }
57
+
58
+ void XiaomiLYWSD02MMC::set_bindkey(const std::string &bindkey) {
59
+ memset(this->bindkey_, 0, 16);
60
+ if (bindkey.size() != 32) {
61
+ return;
62
+ }
63
+ char temp[3] = {0};
64
+ for (int i = 0; i < 16; i++) {
65
+ strncpy(temp, &(bindkey.c_str()[i * 2]), 2);
66
+ this->bindkey_[i] = std::strtoul(temp, nullptr, 16);
67
+ }
68
+ }
69
+
70
+ } // namespace xiaomi_lywsd02mmc
71
+ } // namespace esphome
72
+
73
+ #endif
@@ -0,0 +1,37 @@
1
+ #pragma once
2
+
3
+ #include "esphome/core/component.h"
4
+ #include "esphome/components/sensor/sensor.h"
5
+ #include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h"
6
+ #include "esphome/components/xiaomi_ble/xiaomi_ble.h"
7
+
8
+ #ifdef USE_ESP32
9
+
10
+ namespace esphome {
11
+ namespace xiaomi_lywsd02mmc {
12
+
13
+ class XiaomiLYWSD02MMC : public Component, public esp32_ble_tracker::ESPBTDeviceListener {
14
+ public:
15
+ void set_address(uint64_t address) { this->address_ = address; }
16
+ void set_bindkey(const std::string &bindkey);
17
+
18
+ bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
19
+
20
+ void dump_config() override;
21
+ float get_setup_priority() const override { return setup_priority::DATA; }
22
+ void set_temperature(sensor::Sensor *temperature) { this->temperature_ = temperature; }
23
+ void set_humidity(sensor::Sensor *humidity) { this->humidity_ = humidity; }
24
+ void set_battery_level(sensor::Sensor *battery_level) { this->battery_level_ = battery_level; }
25
+
26
+ protected:
27
+ uint64_t address_;
28
+ uint8_t bindkey_[16];
29
+ sensor::Sensor *temperature_{nullptr};
30
+ sensor::Sensor *humidity_{nullptr};
31
+ sensor::Sensor *battery_level_{nullptr};
32
+ };
33
+
34
+ } // namespace xiaomi_lywsd02mmc
35
+ } // namespace esphome
36
+
37
+ #endif
esphome/config.py CHANGED
@@ -1,40 +1,38 @@
1
1
  from __future__ import annotations
2
+
2
3
  import abc
4
+ from contextlib import contextmanager
5
+ import contextvars
3
6
  import functools
4
7
  import heapq
5
8
  import logging
6
9
  import re
7
-
8
- from typing import Union, Any
9
-
10
- from contextlib import contextmanager
11
- import contextvars
10
+ from typing import Any, Union
12
11
 
13
12
  import voluptuous as vol
14
13
 
15
- from esphome import core, yaml_util, loader, pins
16
- import esphome.core.config as core_config
14
+ from esphome import core, loader, pins, yaml_util
15
+ from esphome.config_helpers import Extend, Remove
16
+ import esphome.config_validation as cv
17
17
  from esphome.const import (
18
18
  CONF_ESPHOME,
19
+ CONF_EXTERNAL_COMPONENTS,
19
20
  CONF_ID,
20
- CONF_PLATFORM,
21
21
  CONF_PACKAGES,
22
+ CONF_PLATFORM,
22
23
  CONF_SUBSTITUTIONS,
23
- CONF_EXTERNAL_COMPONENTS,
24
24
  TARGET_PLATFORMS,
25
25
  )
26
- from esphome.core import CORE, EsphomeError, DocumentRange
26
+ from esphome.core import CORE, DocumentRange, EsphomeError
27
+ import esphome.core.config as core_config
28
+ import esphome.final_validate as fv
27
29
  from esphome.helpers import indent
28
- from esphome.util import safe_print, OrderedDict
29
-
30
- from esphome.config_helpers import Extend, Remove
31
- from esphome.loader import get_component, get_platform, ComponentManifest
32
- from esphome.yaml_util import is_secret, ESPHomeDataBase, ESPForceValue
30
+ from esphome.loader import ComponentManifest, get_component, get_platform
31
+ from esphome.log import Fore, color
32
+ from esphome.types import ConfigFragmentType, ConfigType
33
+ from esphome.util import OrderedDict, safe_print
33
34
  from esphome.voluptuous_schema import ExtraKeysInvalid
34
- from esphome.log import color, Fore
35
- import esphome.final_validate as fv
36
- import esphome.config_validation as cv
37
- from esphome.types import ConfigType, ConfigFragmentType
35
+ from esphome.yaml_util import ESPForceValue, ESPHomeDataBase, is_secret
38
36
 
39
37
  _LOGGER = logging.getLogger(__name__)
40
38