esphome 2024.7.2__py3-none-any.whl → 2024.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. esphome/__main__.py +15 -81
  2. esphome/automation.py +1 -1
  3. esphome/codegen.py +53 -53
  4. esphome/components/ade7953/sensor.py +1 -1
  5. esphome/components/ade7953_spi/ade7953_spi.cpp +1 -1
  6. esphome/components/airthings_wave_plus/airthings_wave_plus.cpp +5 -2
  7. esphome/components/airthings_wave_plus/airthings_wave_plus.h +2 -0
  8. esphome/components/airthings_wave_plus/sensor.py +12 -0
  9. esphome/components/alarm_control_panel/__init__.py +75 -66
  10. esphome/components/apds9306/__init__.py +4 -0
  11. esphome/components/apds9306/apds9306.cpp +151 -0
  12. esphome/components/apds9306/apds9306.h +66 -0
  13. esphome/components/apds9306/sensor.py +95 -0
  14. esphome/components/api/__init__.py +80 -52
  15. esphome/components/api/api_connection.cpp +14 -1
  16. esphome/components/api/api_pb2.cpp +33 -4
  17. esphome/components/api/api_pb2.h +8 -1
  18. esphome/components/api/api_server.cpp +10 -0
  19. esphome/components/api/api_server.h +3 -0
  20. esphome/components/atm90e32/__init__.py +7 -0
  21. esphome/components/atm90e32/atm90e32.cpp +68 -16
  22. esphome/components/atm90e32/atm90e32.h +20 -7
  23. esphome/components/atm90e32/atm90e32_reg.h +2 -0
  24. esphome/components/atm90e32/button/__init__.py +43 -0
  25. esphome/components/atm90e32/button/atm90e32_button.cpp +20 -0
  26. esphome/components/atm90e32/button/atm90e32_button.h +27 -0
  27. esphome/components/atm90e32/sensor.py +15 -11
  28. esphome/components/bedjet/bedjet_codec.h +1 -1
  29. esphome/components/binary/light/binary_light_output.h +3 -2
  30. esphome/components/binary_sensor/__init__.py +5 -5
  31. esphome/components/ble_client/__init__.py +3 -3
  32. esphome/components/ble_client/output/__init__.py +1 -1
  33. esphome/components/ble_client/sensor/__init__.py +4 -3
  34. esphome/components/ble_client/switch/__init__.py +2 -1
  35. esphome/components/ble_client/text_sensor/__init__.py +4 -3
  36. esphome/components/ble_presence/binary_sensor.py +3 -3
  37. esphome/components/ble_rssi/sensor.py +2 -2
  38. esphome/components/ble_scanner/text_sensor.py +1 -1
  39. esphome/components/bluetooth_proxy/__init__.py +3 -3
  40. esphome/components/bme68x_bsec2/__init__.py +196 -0
  41. esphome/components/bme68x_bsec2/bme68x_bsec2.cpp +523 -0
  42. esphome/components/bme68x_bsec2/bme68x_bsec2.h +163 -0
  43. esphome/components/bme68x_bsec2/sensor.py +130 -0
  44. esphome/components/bme68x_bsec2/text_sensor.py +33 -0
  45. esphome/components/bme68x_bsec2_i2c/__init__.py +28 -0
  46. esphome/components/bme68x_bsec2_i2c/bme68x_bsec2_i2c.cpp +53 -0
  47. esphome/components/bme68x_bsec2_i2c/bme68x_bsec2_i2c.h +28 -0
  48. esphome/components/bmp3xx/sensor.py +1 -1
  49. esphome/components/button/__init__.py +4 -4
  50. esphome/components/climate/__init__.py +5 -5
  51. esphome/components/climate/climate.h +1 -1
  52. esphome/components/cover/__init__.py +8 -8
  53. esphome/components/cst226/touchscreen/cst226_touchscreen.cpp +11 -7
  54. esphome/components/cst226/touchscreen/cst226_touchscreen.h +1 -1
  55. esphome/components/datetime/__init__.py +11 -13
  56. esphome/components/demo/demo_sensor.h +3 -2
  57. esphome/components/display/display.cpp +31 -0
  58. esphome/components/display/display.h +3 -0
  59. esphome/components/display_menu_base/__init__.py +14 -13
  60. esphome/components/ens160/sensor.py +1 -1
  61. esphome/components/esp32/__init__.py +22 -10
  62. esphome/components/esp32/boards.py +1 -1
  63. esphome/components/esp32/gpio.py +12 -13
  64. esphome/components/esp32/gpio_esp32.py +1 -2
  65. esphome/components/esp32/gpio_esp32_c2.py +1 -2
  66. esphome/components/esp32/gpio_esp32_c3.py +1 -5
  67. esphome/components/esp32/gpio_esp32_c6.py +1 -2
  68. esphome/components/esp32/gpio_esp32_h2.py +1 -2
  69. esphome/components/esp32/gpio_esp32_s2.py +1 -2
  70. esphome/components/esp32/gpio_esp32_s3.py +1 -6
  71. esphome/components/esp32_ble/__init__.py +20 -3
  72. esphome/components/esp32_ble/ble.cpp +9 -1
  73. esphome/components/esp32_ble/ble.h +9 -0
  74. esphome/components/esp32_ble/ble_advertising.cpp +42 -9
  75. esphome/components/esp32_ble/ble_advertising.h +21 -1
  76. esphome/components/esp32_ble_beacon/__init__.py +17 -7
  77. esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +45 -113
  78. esphome/components/esp32_ble_beacon/esp32_ble_beacon.h +17 -19
  79. esphome/components/esp32_ble_client/__init__.py +0 -1
  80. esphome/components/esp32_ble_server/__init__.py +2 -3
  81. esphome/components/esp32_ble_tracker/__init__.py +2 -2
  82. esphome/components/esp32_improv/__init__.py +2 -4
  83. esphome/components/ethernet/__init__.py +17 -17
  84. esphome/components/ethernet_info/text_sensor.py +2 -2
  85. esphome/components/event/__init__.py +5 -5
  86. esphome/components/fan/__init__.py +14 -14
  87. esphome/components/fan/fan.cpp +2 -2
  88. esphome/components/fingerprint_grow/fingerprint_grow.cpp +1 -1
  89. esphome/components/fingerprint_grow/fingerprint_grow.h +1 -1
  90. esphome/components/graphical_display_menu/__init__.py +11 -8
  91. esphome/components/haier/haier_base.h +2 -2
  92. esphome/components/homeassistant/__init__.py +8 -1
  93. esphome/components/homeassistant/number/__init__.py +33 -0
  94. esphome/components/homeassistant/number/homeassistant_number.cpp +100 -0
  95. esphome/components/homeassistant/number/homeassistant_number.h +31 -0
  96. esphome/components/homeassistant/switch/__init__.py +30 -0
  97. esphome/components/homeassistant/switch/homeassistant_switch.cpp +59 -0
  98. esphome/components/homeassistant/switch/homeassistant_switch.h +22 -0
  99. esphome/components/host/__init__.py +3 -7
  100. esphome/components/http_request/__init__.py +12 -1
  101. esphome/components/http_request/http_request_arduino.cpp +2 -2
  102. esphome/components/http_request/http_request_idf.cpp +11 -2
  103. esphome/components/http_request/http_request_idf.h +10 -0
  104. esphome/components/http_request/ota/ota_http_request.cpp +1 -1
  105. esphome/components/http_request/update/http_request_update.cpp +2 -2
  106. esphome/components/http_request/update/http_request_update.h +2 -1
  107. esphome/components/hx711/hx711.cpp +10 -1
  108. esphome/components/hydreon_rgxx/hydreon_rgxx.cpp +1 -1
  109. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +11 -2
  110. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +2 -0
  111. esphome/components/ili9xxx/ili9xxx_defines.h +3 -1
  112. esphome/components/ili9xxx/ili9xxx_display.cpp +9 -22
  113. esphome/components/ili9xxx/ili9xxx_display.h +5 -7
  114. esphome/components/ili9xxx/ili9xxx_init.h +4 -4
  115. esphome/components/improv_base/__init__.py +2 -3
  116. esphome/components/improv_serial/__init__.py +4 -10
  117. esphome/components/improv_serial/improv_serial_component.cpp +4 -0
  118. esphome/components/jsn_sr04t/jsn_sr04t.cpp +18 -1
  119. esphome/components/jsn_sr04t/jsn_sr04t.h +7 -1
  120. esphome/components/jsn_sr04t/sensor.py +13 -0
  121. esphome/components/kalman_combinator/sensor.py +1 -1
  122. esphome/components/light/__init__.py +16 -15
  123. esphome/components/light/addressable_light_effect.h +12 -8
  124. esphome/components/light/automation.h +16 -1
  125. esphome/components/light/automation.py +21 -0
  126. esphome/components/light/base_light_effects.h +5 -5
  127. esphome/components/light/esp_color_correction.h +8 -8
  128. esphome/components/light/types.py +7 -0
  129. esphome/components/lock/__init__.py +3 -3
  130. esphome/components/logger/__init__.py +15 -18
  131. esphome/components/lvgl/__init__.py +346 -0
  132. esphome/components/lvgl/automation.py +226 -0
  133. esphome/components/lvgl/binary_sensor/__init__.py +43 -0
  134. esphome/components/lvgl/defines.py +508 -0
  135. esphome/components/lvgl/encoders.py +77 -0
  136. esphome/components/lvgl/font.cpp +76 -0
  137. esphome/components/lvgl/helpers.py +49 -0
  138. esphome/components/lvgl/light/__init__.py +32 -0
  139. esphome/components/lvgl/light/lvgl_light.h +48 -0
  140. esphome/components/lvgl/lv_validation.py +303 -0
  141. esphome/components/lvgl/lvcode.py +349 -0
  142. esphome/components/lvgl/lvgl_esphome.cpp +407 -0
  143. esphome/components/lvgl/lvgl_esphome.h +274 -0
  144. esphome/components/lvgl/lvgl_hal.h +21 -0
  145. esphome/components/lvgl/number/__init__.py +66 -0
  146. esphome/components/lvgl/number/lvgl_number.h +34 -0
  147. esphome/components/lvgl/schemas.py +436 -0
  148. esphome/components/lvgl/select/__init__.py +55 -0
  149. esphome/components/lvgl/select/lvgl_select.h +62 -0
  150. esphome/components/lvgl/sensor/__init__.py +47 -0
  151. esphome/components/lvgl/styles.py +58 -0
  152. esphome/components/lvgl/switch/__init__.py +56 -0
  153. esphome/components/lvgl/switch/lvgl_switch.h +34 -0
  154. esphome/components/lvgl/text/__init__.py +50 -0
  155. esphome/components/lvgl/text/lvgl_text.h +34 -0
  156. esphome/components/lvgl/text_sensor/__init__.py +42 -0
  157. esphome/components/lvgl/touchscreens.py +45 -0
  158. esphome/components/lvgl/trigger.py +74 -0
  159. esphome/components/lvgl/types.py +191 -0
  160. esphome/components/lvgl/widgets/__init__.py +419 -0
  161. esphome/components/lvgl/widgets/animimg.py +117 -0
  162. esphome/components/lvgl/widgets/arc.py +78 -0
  163. esphome/components/lvgl/widgets/button.py +20 -0
  164. esphome/components/lvgl/widgets/buttonmatrix.py +275 -0
  165. esphome/components/lvgl/widgets/checkbox.py +27 -0
  166. esphome/components/lvgl/widgets/dropdown.py +76 -0
  167. esphome/components/lvgl/widgets/img.py +85 -0
  168. esphome/components/lvgl/widgets/keyboard.py +49 -0
  169. esphome/components/lvgl/widgets/label.py +42 -0
  170. esphome/components/lvgl/widgets/led.py +29 -0
  171. esphome/components/lvgl/widgets/line.py +50 -0
  172. esphome/components/lvgl/widgets/lv_bar.py +55 -0
  173. esphome/components/lvgl/widgets/meter.py +302 -0
  174. esphome/components/lvgl/widgets/msgbox.py +134 -0
  175. esphome/components/lvgl/widgets/obj.py +28 -0
  176. esphome/components/lvgl/widgets/page.py +113 -0
  177. esphome/components/lvgl/widgets/roller.py +77 -0
  178. esphome/components/lvgl/widgets/slider.py +63 -0
  179. esphome/components/lvgl/widgets/spinbox.py +178 -0
  180. esphome/components/lvgl/widgets/spinner.py +43 -0
  181. esphome/components/lvgl/widgets/switch.py +20 -0
  182. esphome/components/lvgl/widgets/tabview.py +114 -0
  183. esphome/components/lvgl/widgets/textarea.py +66 -0
  184. esphome/components/lvgl/widgets/tileview.py +128 -0
  185. esphome/components/m5stack_8angle/__init__.py +33 -0
  186. esphome/components/m5stack_8angle/binary_sensor/__init__.py +30 -0
  187. esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.cpp +17 -0
  188. esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.h +19 -0
  189. esphome/components/m5stack_8angle/light/__init__.py +31 -0
  190. esphome/components/m5stack_8angle/light/m5stack_8angle_light.cpp +45 -0
  191. esphome/components/m5stack_8angle/light/m5stack_8angle_light.h +37 -0
  192. esphome/components/m5stack_8angle/m5stack_8angle.cpp +74 -0
  193. esphome/components/m5stack_8angle/m5stack_8angle.h +34 -0
  194. esphome/components/m5stack_8angle/sensor/__init__.py +66 -0
  195. esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.cpp +24 -0
  196. esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.h +27 -0
  197. esphome/components/matrix_keypad/matrix_keypad.cpp +2 -0
  198. esphome/components/max31856/sensor.py +5 -5
  199. esphome/components/media_player/__init__.py +3 -5
  200. esphome/components/media_player/automation.h +31 -27
  201. esphome/components/micro_wake_word/__init__.py +20 -25
  202. esphome/components/micro_wake_word/streaming_model.cpp +6 -4
  203. esphome/components/microphone/microphone.h +4 -1
  204. esphome/components/mitsubishi/mitsubishi.cpp +7 -1
  205. esphome/components/modbus_controller/__init__.py +26 -2
  206. esphome/components/modbus_controller/automation.h +19 -0
  207. esphome/components/modbus_controller/const.py +1 -0
  208. esphome/components/modbus_controller/modbus_controller.cpp +8 -0
  209. esphome/components/modbus_controller/modbus_controller.h +3 -0
  210. esphome/components/mqtt/__init__.py +20 -9
  211. esphome/components/mqtt/mqtt_alarm_control_panel.cpp +128 -0
  212. esphome/components/mqtt/mqtt_alarm_control_panel.h +39 -0
  213. esphome/components/mqtt/mqtt_backend.h +3 -1
  214. esphome/components/mqtt/mqtt_backend_esp32.cpp +4 -1
  215. esphome/components/mqtt/mqtt_backend_esp32.h +3 -1
  216. esphome/components/mqtt/mqtt_backend_esp8266.h +3 -1
  217. esphome/components/mqtt/mqtt_backend_libretiny.h +3 -1
  218. esphome/components/mqtt/mqtt_client.cpp +16 -3
  219. esphome/components/mqtt/mqtt_client.h +5 -1
  220. esphome/components/mqtt/mqtt_component.cpp +32 -4
  221. esphome/components/mqtt/mqtt_const.h +2 -0
  222. esphome/components/network/__init__.py +15 -12
  223. esphome/components/network/ip_address.h +3 -0
  224. esphome/components/network/util.cpp +2 -1
  225. esphome/components/network/util.h +3 -1
  226. esphome/components/nextion/base_component.py +5 -8
  227. esphome/components/number/__init__.py +7 -8
  228. esphome/components/online_image/__init__.py +167 -0
  229. esphome/components/online_image/image_decoder.cpp +44 -0
  230. esphome/components/online_image/image_decoder.h +112 -0
  231. esphome/components/online_image/online_image.cpp +283 -0
  232. esphome/components/online_image/online_image.h +195 -0
  233. esphome/components/online_image/png_image.cpp +68 -0
  234. esphome/components/online_image/png_image.h +33 -0
  235. esphome/components/ota/__init__.py +8 -4
  236. esphome/components/pid/pid_climate.h +2 -0
  237. esphome/components/pmwcs3/pmwcs3.cpp +31 -30
  238. esphome/components/remote_base/pronto_protocol.cpp +0 -3
  239. esphome/components/remote_transmitter/remote_transmitter.h +1 -1
  240. esphome/components/rgbct/rgbct_light_output.h +3 -2
  241. esphome/components/rgbw/rgbw_light_output.h +3 -2
  242. esphome/components/rgbww/rgbww_light_output.h +3 -2
  243. esphome/components/rp2040_pio_led_strip/led_strip.cpp +31 -5
  244. esphome/components/rp2040_pio_led_strip/led_strip.h +5 -0
  245. esphome/components/rtttl/rtttl.cpp +108 -21
  246. esphome/components/rtttl/rtttl.h +15 -6
  247. esphome/components/select/__init__.py +7 -7
  248. esphome/components/sensor/__init__.py +29 -10
  249. esphome/components/sensor/filter.cpp +8 -0
  250. esphome/components/sensor/filter.h +9 -0
  251. esphome/components/sml/sml_parser.cpp +48 -22
  252. esphome/components/socket/socket.cpp +11 -14
  253. esphome/components/speaker/__init__.py +14 -5
  254. esphome/components/speaker/automation.h +10 -0
  255. esphome/components/speaker/speaker.h +9 -0
  256. esphome/components/spi/spi.cpp +0 -6
  257. esphome/components/spi/spi.h +2 -19
  258. esphome/components/spi_led_strip/spi_led_strip.h +5 -4
  259. esphome/components/sprinkler/sprinkler.cpp +2 -2
  260. esphome/components/sprinkler/sprinkler.h +1 -1
  261. esphome/components/switch/__init__.py +3 -3
  262. esphome/components/text/__init__.py +5 -5
  263. esphome/components/text_sensor/__init__.py +7 -7
  264. esphome/components/time/__init__.py +8 -8
  265. esphome/components/touchscreen/binary_sensor/__init__.py +24 -10
  266. esphome/components/touchscreen/binary_sensor/touchscreen_binary_sensor.cpp +3 -2
  267. esphome/components/touchscreen/binary_sensor/touchscreen_binary_sensor.h +4 -2
  268. esphome/components/uart/uart_component_host.cpp +6 -2
  269. esphome/components/update/__init__.py +33 -15
  270. esphome/components/update/automation.h +23 -0
  271. esphome/components/update/update_entity.h +3 -1
  272. esphome/components/valve/__init__.py +3 -3
  273. esphome/components/voice_assistant/__init__.py +7 -8
  274. esphome/components/wake_on_lan/wake_on_lan.cpp +2 -0
  275. esphome/components/wake_on_lan/wake_on_lan.h +3 -1
  276. esphome/components/watchdog/__init__.py +1 -0
  277. esphome/components/{http_request → watchdog}/watchdog.cpp +0 -2
  278. esphome/components/{http_request → watchdog}/watchdog.h +0 -2
  279. esphome/components/waveshare_epaper/waveshare_epaper.cpp +5 -5
  280. esphome/components/web_server/server_index_v3.h +3615 -3603
  281. esphome/components/web_server/web_server.cpp +0 -209
  282. esphome/components/web_server/web_server.h +1 -1
  283. esphome/components/web_server/web_server_v1.cpp +217 -0
  284. esphome/components/web_server_base/web_server_base.h +1 -0
  285. esphome/components/wifi/__init__.py +15 -14
  286. esphome/components/wifi/wifi_component.cpp +2 -0
  287. esphome/components/wifi/wifi_component.h +7 -1
  288. esphome/components/wifi/wifi_component_esp32_arduino.cpp +5 -2
  289. esphome/components/wifi/wifi_component_esp8266.cpp +2 -0
  290. esphome/components/wifi/wifi_component_esp_idf.cpp +43 -7
  291. esphome/components/wifi/wifi_component_libretiny.cpp +2 -0
  292. esphome/components/wifi/wifi_component_pico_w.cpp +2 -0
  293. esphome/components/wifi/wpa2_eap.py +6 -7
  294. esphome/components/wifi_info/text_sensor.py +3 -3
  295. esphome/components/wifi_info/wifi_info_text_sensor.cpp +2 -0
  296. esphome/components/wifi_info/wifi_info_text_sensor.h +2 -0
  297. esphome/components/wifi_signal/sensor.py +1 -1
  298. esphome/components/wifi_signal/wifi_signal_sensor.cpp +2 -0
  299. esphome/components/wifi_signal/wifi_signal_sensor.h +2 -1
  300. esphome/components/xiaomi_ble/xiaomi_ble.cpp +20 -3
  301. esphome/components/xiaomi_ble/xiaomi_ble.h +1 -0
  302. esphome/components/xiaomi_lywsd02mmc/__init__.py +0 -0
  303. esphome/components/xiaomi_lywsd02mmc/sensor.py +77 -0
  304. esphome/components/xiaomi_lywsd02mmc/xiaomi_lywsd02mmc.cpp +73 -0
  305. esphome/components/xiaomi_lywsd02mmc/xiaomi_lywsd02mmc.h +37 -0
  306. esphome/config.py +17 -19
  307. esphome/config_validation.py +55 -23
  308. esphome/const.py +25 -9
  309. esphome/core/__init__.py +17 -14
  310. esphome/core/application.h +42 -21
  311. esphome/core/automation.h +5 -3
  312. esphome/core/base_automation.h +3 -2
  313. esphome/core/bytebuffer.cpp +134 -0
  314. esphome/core/bytebuffer.h +96 -0
  315. esphome/core/color.h +24 -16
  316. esphome/core/config.py +3 -3
  317. esphome/core/defines.h +14 -1
  318. esphome/core/entity_base.h +2 -2
  319. esphome/core/entity_helpers.py +1 -2
  320. esphome/core/gpio.h +0 -18
  321. esphome/core/helpers.h +1 -1
  322. esphome/core/optional.h +15 -16
  323. esphome/coroutine.py +1 -1
  324. esphome/cpp_generator.py +1 -1
  325. esphome/cpp_helpers.py +3 -5
  326. esphome/dashboard/core.py +3 -3
  327. esphome/dashboard/dashboard.py +3 -3
  328. esphome/dashboard/entries.py +1 -1
  329. esphome/dashboard/util/file.py +1 -1
  330. esphome/dashboard/web_server.py +3 -3
  331. esphome/external_files.py +5 -3
  332. esphome/final_validate.py +2 -2
  333. esphome/git.py +4 -4
  334. esphome/helpers.py +5 -5
  335. esphome/loader.py +15 -10
  336. esphome/mqtt.py +4 -8
  337. esphome/pins.py +6 -6
  338. esphome/platformio_api.py +5 -5
  339. esphome/storage_json.py +2 -1
  340. esphome/types.py +1 -1
  341. esphome/util.py +2 -3
  342. esphome/voluptuous_schema.py +1 -0
  343. esphome/vscode.py +5 -4
  344. esphome/wizard.py +1 -1
  345. esphome/writer.py +7 -7
  346. esphome/yaml_util.py +3 -3
  347. esphome/zeroconf.py +1 -1
  348. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/METADATA +3 -3
  349. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/RECORD +353 -247
  350. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/LICENSE +0 -0
  351. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/WHEEL +0 -0
  352. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/entry_points.txt +0 -0
  353. {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,7 @@
1
+ import esphome.codegen as cg
2
+
3
+ CODEOWNERS = ["@circuitsetup", "@descipher"]
4
+
5
+ atm90e32_ns = cg.esphome_ns.namespace("atm90e32")
6
+
7
+ CONF_ATM90E32_ID = "atm90e32_id"
@@ -132,10 +132,77 @@ void ATM90E32Component::update() {
132
132
  this->status_clear_warning();
133
133
  }
134
134
 
135
+ void ATM90E32Component::restore_calibrations_() {
136
+ if (enable_offset_calibration_) {
137
+ this->pref_.load(&this->offset_phase_);
138
+ }
139
+ };
140
+
141
+ void ATM90E32Component::run_offset_calibrations() {
142
+ // Run the calibrations and
143
+ // Setup voltage and current calibration offsets for PHASE A
144
+ this->offset_phase_[PHASEA].voltage_offset_ = calibrate_voltage_offset_phase(PHASEA);
145
+ this->phase_[PHASEA].voltage_offset_ = this->offset_phase_[PHASEA].voltage_offset_;
146
+ this->write16_(ATM90E32_REGISTER_UOFFSETA, this->phase_[PHASEA].voltage_offset_); // C Voltage offset
147
+ this->offset_phase_[PHASEA].current_offset_ = calibrate_current_offset_phase(PHASEA);
148
+ this->phase_[PHASEA].current_offset_ = this->offset_phase_[PHASEA].current_offset_;
149
+ this->write16_(ATM90E32_REGISTER_IOFFSETA, this->phase_[PHASEA].current_offset_); // C Current offset
150
+ // Setup voltage and current calibration offsets for PHASE B
151
+ this->offset_phase_[PHASEB].voltage_offset_ = calibrate_voltage_offset_phase(PHASEB);
152
+ this->phase_[PHASEB].voltage_offset_ = this->offset_phase_[PHASEB].voltage_offset_;
153
+ this->write16_(ATM90E32_REGISTER_UOFFSETB, this->phase_[PHASEB].voltage_offset_); // C Voltage offset
154
+ this->offset_phase_[PHASEB].current_offset_ = calibrate_current_offset_phase(PHASEB);
155
+ this->phase_[PHASEB].current_offset_ = this->offset_phase_[PHASEB].current_offset_;
156
+ this->write16_(ATM90E32_REGISTER_IOFFSETB, this->phase_[PHASEB].current_offset_); // C Current offset
157
+ // Setup voltage and current calibration offsets for PHASE C
158
+ this->offset_phase_[PHASEC].voltage_offset_ = calibrate_voltage_offset_phase(PHASEC);
159
+ this->phase_[PHASEC].voltage_offset_ = this->offset_phase_[PHASEC].voltage_offset_;
160
+ this->write16_(ATM90E32_REGISTER_UOFFSETC, this->phase_[PHASEC].voltage_offset_); // C Voltage offset
161
+ this->offset_phase_[PHASEC].current_offset_ = calibrate_current_offset_phase(PHASEC);
162
+ this->phase_[PHASEC].current_offset_ = this->offset_phase_[PHASEC].current_offset_;
163
+ this->write16_(ATM90E32_REGISTER_IOFFSETC, this->phase_[PHASEC].current_offset_); // C Current offset
164
+ this->pref_.save(&this->offset_phase_);
165
+ ESP_LOGI(TAG, "PhaseA Vo=%5d PhaseB Vo=%5d PhaseC Vo=%5d", this->offset_phase_[PHASEA].voltage_offset_,
166
+ this->offset_phase_[PHASEB].voltage_offset_, this->offset_phase_[PHASEC].voltage_offset_);
167
+ ESP_LOGI(TAG, "PhaseA Io=%5d PhaseB Io=%5d PhaseC Io=%5d", this->offset_phase_[PHASEA].current_offset_,
168
+ this->offset_phase_[PHASEB].current_offset_, this->offset_phase_[PHASEC].current_offset_);
169
+ }
170
+
171
+ void ATM90E32Component::clear_offset_calibrations() {
172
+ // Clear the calibrations and
173
+ this->offset_phase_[PHASEA].voltage_offset_ = 0;
174
+ this->phase_[PHASEA].voltage_offset_ = this->offset_phase_[PHASEA].voltage_offset_;
175
+ this->write16_(ATM90E32_REGISTER_UOFFSETA, this->phase_[PHASEA].voltage_offset_); // C Voltage offset
176
+ this->offset_phase_[PHASEA].current_offset_ = 0;
177
+ this->phase_[PHASEA].current_offset_ = this->offset_phase_[PHASEA].current_offset_;
178
+ this->write16_(ATM90E32_REGISTER_IOFFSETA, this->phase_[PHASEA].current_offset_); // C Current offset
179
+ this->offset_phase_[PHASEB].voltage_offset_ = 0;
180
+ this->phase_[PHASEB].voltage_offset_ = this->offset_phase_[PHASEB].voltage_offset_;
181
+ this->write16_(ATM90E32_REGISTER_UOFFSETB, this->phase_[PHASEB].voltage_offset_); // C Voltage offset
182
+ this->offset_phase_[PHASEB].current_offset_ = 0;
183
+ this->phase_[PHASEB].current_offset_ = this->offset_phase_[PHASEB].current_offset_;
184
+ this->write16_(ATM90E32_REGISTER_IOFFSETB, this->phase_[PHASEB].current_offset_); // C Current offset
185
+ this->offset_phase_[PHASEC].voltage_offset_ = 0;
186
+ this->phase_[PHASEC].voltage_offset_ = this->offset_phase_[PHASEC].voltage_offset_;
187
+ this->write16_(ATM90E32_REGISTER_UOFFSETC, this->phase_[PHASEC].voltage_offset_); // C Voltage offset
188
+ this->offset_phase_[PHASEC].current_offset_ = 0;
189
+ this->phase_[PHASEC].current_offset_ = this->offset_phase_[PHASEC].current_offset_;
190
+ this->write16_(ATM90E32_REGISTER_IOFFSETC, this->phase_[PHASEC].current_offset_); // C Current offset
191
+ this->pref_.save(&this->offset_phase_);
192
+ ESP_LOGI(TAG, "PhaseA Vo=%5d PhaseB Vo=%5d PhaseC Vo=%5d", this->offset_phase_[PHASEA].voltage_offset_,
193
+ this->offset_phase_[PHASEB].voltage_offset_, this->offset_phase_[PHASEC].voltage_offset_);
194
+ ESP_LOGI(TAG, "PhaseA Io=%5d PhaseB Io=%5d PhaseC Io=%5d", this->offset_phase_[PHASEA].current_offset_,
195
+ this->offset_phase_[PHASEB].current_offset_, this->offset_phase_[PHASEC].current_offset_);
196
+ }
197
+
135
198
  void ATM90E32Component::setup() {
136
199
  ESP_LOGCONFIG(TAG, "Setting up ATM90E32 Component...");
137
200
  this->spi_setup();
138
-
201
+ if (this->enable_offset_calibration_) {
202
+ uint32_t hash = fnv1_hash(App.get_friendly_name());
203
+ this->pref_ = global_preferences->make_preference<Calibration[3]>(hash, true);
204
+ this->restore_calibrations_();
205
+ }
139
206
  uint16_t mmode0 = 0x87; // 3P4W 50Hz
140
207
  if (line_freq_ == 60) {
141
208
  mmode0 |= 1 << 12; // sets 12th bit to 1, 60Hz
@@ -167,27 +234,12 @@ void ATM90E32Component::setup() {
167
234
  this->write16_(ATM90E32_REGISTER_SSTARTTH, 0x1D4C); // All Reactive Startup Power Threshold - 50%
168
235
  this->write16_(ATM90E32_REGISTER_PPHASETH, 0x02EE); // Each Phase Active Phase Threshold - 0.002A/0.00032 = 750
169
236
  this->write16_(ATM90E32_REGISTER_QPHASETH, 0x02EE); // Each phase Reactive Phase Threshold - 10%
170
- // Setup voltage and current calibration offsets for PHASE A
171
- this->phase_[PHASEA].voltage_offset_ = calibrate_voltage_offset_phase(PHASEA);
172
- this->write16_(ATM90E32_REGISTER_UOFFSETA, this->phase_[PHASEA].voltage_offset_); // A Voltage offset
173
- this->phase_[PHASEA].current_offset_ = calibrate_current_offset_phase(PHASEA);
174
- this->write16_(ATM90E32_REGISTER_IOFFSETA, this->phase_[PHASEA].current_offset_); // A Current offset
175
237
  // Setup voltage and current gain for PHASE A
176
238
  this->write16_(ATM90E32_REGISTER_UGAINA, this->phase_[PHASEA].voltage_gain_); // A Voltage rms gain
177
239
  this->write16_(ATM90E32_REGISTER_IGAINA, this->phase_[PHASEA].ct_gain_); // A line current gain
178
- // Setup voltage and current calibration offsets for PHASE B
179
- this->phase_[PHASEB].voltage_offset_ = calibrate_voltage_offset_phase(PHASEB);
180
- this->write16_(ATM90E32_REGISTER_UOFFSETB, this->phase_[PHASEB].voltage_offset_); // B Voltage offset
181
- this->phase_[PHASEB].current_offset_ = calibrate_current_offset_phase(PHASEB);
182
- this->write16_(ATM90E32_REGISTER_IOFFSETB, this->phase_[PHASEB].current_offset_); // B Current offset
183
240
  // Setup voltage and current gain for PHASE B
184
241
  this->write16_(ATM90E32_REGISTER_UGAINB, this->phase_[PHASEB].voltage_gain_); // B Voltage rms gain
185
242
  this->write16_(ATM90E32_REGISTER_IGAINB, this->phase_[PHASEB].ct_gain_); // B line current gain
186
- // Setup voltage and current calibration offsets for PHASE C
187
- this->phase_[PHASEC].voltage_offset_ = calibrate_voltage_offset_phase(PHASEC);
188
- this->write16_(ATM90E32_REGISTER_UOFFSETC, this->phase_[PHASEC].voltage_offset_); // C Voltage offset
189
- this->phase_[PHASEC].current_offset_ = calibrate_current_offset_phase(PHASEC);
190
- this->write16_(ATM90E32_REGISTER_IOFFSETC, this->phase_[PHASEC].current_offset_); // C Current offset
191
243
  // Setup voltage and current gain for PHASE C
192
244
  this->write16_(ATM90E32_REGISTER_UGAINC, this->phase_[PHASEC].voltage_gain_); // C Voltage rms gain
193
245
  this->write16_(ATM90E32_REGISTER_IGAINC, this->phase_[PHASEC].ct_gain_); // C line current gain
@@ -1,9 +1,12 @@
1
1
  #pragma once
2
2
 
3
- #include "esphome/core/component.h"
3
+ #include "atm90e32_reg.h"
4
4
  #include "esphome/components/sensor/sensor.h"
5
5
  #include "esphome/components/spi/spi.h"
6
- #include "atm90e32_reg.h"
6
+ #include "esphome/core/application.h"
7
+ #include "esphome/core/component.h"
8
+ #include "esphome/core/helpers.h"
9
+ #include "esphome/core/preferences.h"
7
10
 
8
11
  namespace esphome {
9
12
  namespace atm90e32 {
@@ -20,7 +23,6 @@ class ATM90E32Component : public PollingComponent,
20
23
  void dump_config() override;
21
24
  float get_setup_priority() const override;
22
25
  void update() override;
23
-
24
26
  void set_voltage_sensor(int phase, sensor::Sensor *obj) { this->phase_[phase].voltage_sensor_ = obj; }
25
27
  void set_current_sensor(int phase, sensor::Sensor *obj) { this->phase_[phase].current_sensor_ = obj; }
26
28
  void set_power_sensor(int phase, sensor::Sensor *obj) { this->phase_[phase].power_sensor_ = obj; }
@@ -48,9 +50,11 @@ class ATM90E32Component : public PollingComponent,
48
50
  void set_line_freq(int freq) { line_freq_ = freq; }
49
51
  void set_current_phases(int phases) { current_phases_ = phases; }
50
52
  void set_pga_gain(uint16_t gain) { pga_gain_ = gain; }
53
+ void run_offset_calibrations();
54
+ void clear_offset_calibrations();
55
+ void set_enable_offset_calibration(bool flag) { enable_offset_calibration_ = flag; }
51
56
  uint16_t calibrate_voltage_offset_phase(uint8_t /*phase*/);
52
57
  uint16_t calibrate_current_offset_phase(uint8_t /*phase*/);
53
-
54
58
  int32_t last_periodic_millis = millis();
55
59
 
56
60
  protected:
@@ -83,10 +87,11 @@ class ATM90E32Component : public PollingComponent,
83
87
  float get_chip_temperature_();
84
88
  bool get_publish_interval_flag_() { return publish_interval_flag_; };
85
89
  void set_publish_interval_flag_(bool flag) { publish_interval_flag_ = flag; };
90
+ void restore_calibrations_();
86
91
 
87
92
  struct ATM90E32Phase {
88
- uint16_t voltage_gain_{7305};
89
- uint16_t ct_gain_{27961};
93
+ uint16_t voltage_gain_{0};
94
+ uint16_t ct_gain_{0};
90
95
  uint16_t voltage_offset_{0};
91
96
  uint16_t current_offset_{0};
92
97
  float voltage_{0};
@@ -114,13 +119,21 @@ class ATM90E32Component : public PollingComponent,
114
119
  uint32_t cumulative_reverse_active_energy_{0};
115
120
  } phase_[3];
116
121
 
122
+ struct Calibration {
123
+ uint16_t voltage_offset_{0};
124
+ uint16_t current_offset_{0};
125
+ } offset_phase_[3];
126
+
127
+ ESPPreferenceObject pref_;
128
+
117
129
  sensor::Sensor *freq_sensor_{nullptr};
118
130
  sensor::Sensor *chip_temperature_sensor_{nullptr};
119
131
  uint16_t pga_gain_{0x15};
120
132
  int line_freq_{60};
121
133
  int current_phases_{3};
122
- bool publish_interval_flag_{true};
134
+ bool publish_interval_flag_{false};
123
135
  bool peak_current_signed_{false};
136
+ bool enable_offset_calibration_{false};
124
137
  };
125
138
 
126
139
  } // namespace atm90e32
@@ -1,5 +1,7 @@
1
1
  #pragma once
2
2
 
3
+ #include <cinttypes>
4
+
3
5
  namespace esphome {
4
6
  namespace atm90e32 {
5
7
 
@@ -0,0 +1,43 @@
1
+ import esphome.codegen as cg
2
+ from esphome.components import button
3
+ import esphome.config_validation as cv
4
+ from esphome.const import CONF_ID, ENTITY_CATEGORY_CONFIG, ICON_CHIP, ICON_SCALE
5
+
6
+ from .. import atm90e32_ns
7
+ from ..sensor import ATM90E32Component
8
+
9
+ CONF_RUN_OFFSET_CALIBRATION = "run_offset_calibration"
10
+ CONF_CLEAR_OFFSET_CALIBRATION = "clear_offset_calibration"
11
+
12
+ ATM90E32CalibrationButton = atm90e32_ns.class_(
13
+ "ATM90E32CalibrationButton",
14
+ button.Button,
15
+ )
16
+ ATM90E32ClearCalibrationButton = atm90e32_ns.class_(
17
+ "ATM90E32ClearCalibrationButton",
18
+ button.Button,
19
+ )
20
+
21
+ CONFIG_SCHEMA = {
22
+ cv.GenerateID(CONF_ID): cv.use_id(ATM90E32Component),
23
+ cv.Optional(CONF_RUN_OFFSET_CALIBRATION): button.button_schema(
24
+ ATM90E32CalibrationButton,
25
+ entity_category=ENTITY_CATEGORY_CONFIG,
26
+ icon=ICON_SCALE,
27
+ ),
28
+ cv.Optional(CONF_CLEAR_OFFSET_CALIBRATION): button.button_schema(
29
+ ATM90E32ClearCalibrationButton,
30
+ entity_category=ENTITY_CATEGORY_CONFIG,
31
+ icon=ICON_CHIP,
32
+ ),
33
+ }
34
+
35
+
36
+ async def to_code(config):
37
+ parent = await cg.get_variable(config[CONF_ID])
38
+ if run_offset := config.get(CONF_RUN_OFFSET_CALIBRATION):
39
+ b = await button.new_button(run_offset)
40
+ await cg.register_parented(b, parent)
41
+ if clear_offset := config.get(CONF_CLEAR_OFFSET_CALIBRATION):
42
+ b = await button.new_button(clear_offset)
43
+ await cg.register_parented(b, parent)
@@ -0,0 +1,20 @@
1
+ #include "atm90e32_button.h"
2
+ #include "esphome/core/log.h"
3
+
4
+ namespace esphome {
5
+ namespace atm90e32 {
6
+
7
+ static const char *const TAG = "atm90e32.button";
8
+
9
+ void ATM90E32CalibrationButton::press_action() {
10
+ ESP_LOGI(TAG, "Running offset calibrations, Note: CTs and ACVs must be 0 during this process...");
11
+ this->parent_->run_offset_calibrations();
12
+ }
13
+
14
+ void ATM90E32ClearCalibrationButton::press_action() {
15
+ ESP_LOGI(TAG, "Offset calibrations cleared.");
16
+ this->parent_->clear_offset_calibrations();
17
+ }
18
+
19
+ } // namespace atm90e32
20
+ } // namespace esphome
@@ -0,0 +1,27 @@
1
+ #pragma once
2
+
3
+ #include "esphome/core/component.h"
4
+ #include "esphome/components/atm90e32/atm90e32.h"
5
+ #include "esphome/components/button/button.h"
6
+
7
+ namespace esphome {
8
+ namespace atm90e32 {
9
+
10
+ class ATM90E32CalibrationButton : public button::Button, public Parented<ATM90E32Component> {
11
+ public:
12
+ ATM90E32CalibrationButton() = default;
13
+
14
+ protected:
15
+ void press_action() override;
16
+ };
17
+
18
+ class ATM90E32ClearCalibrationButton : public button::Button, public Parented<ATM90E32Component> {
19
+ public:
20
+ ATM90E32ClearCalibrationButton() = default;
21
+
22
+ protected:
23
+ void press_action() override;
24
+ };
25
+
26
+ } // namespace atm90e32
27
+ } // namespace esphome
@@ -1,21 +1,21 @@
1
1
  import esphome.codegen as cg
2
- import esphome.config_validation as cv
3
2
  from esphome.components import sensor, spi
3
+ import esphome.config_validation as cv
4
4
  from esphome.const import (
5
- CONF_ID,
6
- CONF_REACTIVE_POWER,
7
- CONF_VOLTAGE,
5
+ CONF_APPARENT_POWER,
8
6
  CONF_CURRENT,
7
+ CONF_FORWARD_ACTIVE_ENERGY,
8
+ CONF_FREQUENCY,
9
+ CONF_ID,
9
10
  CONF_PHASE_A,
11
+ CONF_PHASE_ANGLE,
10
12
  CONF_PHASE_B,
11
13
  CONF_PHASE_C,
12
- CONF_PHASE_ANGLE,
13
14
  CONF_POWER,
14
15
  CONF_POWER_FACTOR,
15
- CONF_APPARENT_POWER,
16
- CONF_FREQUENCY,
17
- CONF_FORWARD_ACTIVE_ENERGY,
16
+ CONF_REACTIVE_POWER,
18
17
  CONF_REVERSE_ACTIVE_ENERGY,
18
+ CONF_VOLTAGE,
19
19
  DEVICE_CLASS_CURRENT,
20
20
  DEVICE_CLASS_ENERGY,
21
21
  DEVICE_CLASS_POWER,
@@ -23,13 +23,13 @@ from esphome.const import (
23
23
  DEVICE_CLASS_TEMPERATURE,
24
24
  DEVICE_CLASS_VOLTAGE,
25
25
  ENTITY_CATEGORY_DIAGNOSTIC,
26
- ICON_LIGHTBULB,
27
26
  ICON_CURRENT_AC,
27
+ ICON_LIGHTBULB,
28
28
  STATE_CLASS_MEASUREMENT,
29
29
  STATE_CLASS_TOTAL_INCREASING,
30
30
  UNIT_AMPERE,
31
- UNIT_DEGREES,
32
31
  UNIT_CELSIUS,
32
+ UNIT_DEGREES,
33
33
  UNIT_HERTZ,
34
34
  UNIT_VOLT,
35
35
  UNIT_VOLT_AMPS_REACTIVE,
@@ -37,6 +37,8 @@ from esphome.const import (
37
37
  UNIT_WATT_HOURS,
38
38
  )
39
39
 
40
+ from . import atm90e32_ns
41
+
40
42
  CONF_LINE_FREQUENCY = "line_frequency"
41
43
  CONF_CHIP_TEMPERATURE = "chip_temperature"
42
44
  CONF_GAIN_PGA = "gain_pga"
@@ -46,6 +48,7 @@ CONF_GAIN_CT = "gain_ct"
46
48
  CONF_HARMONIC_POWER = "harmonic_power"
47
49
  CONF_PEAK_CURRENT = "peak_current"
48
50
  CONF_PEAK_CURRENT_SIGNED = "peak_current_signed"
51
+ CONF_ENABLE_OFFSET_CALIBRATION = "enable_offset_calibration"
49
52
  UNIT_DEG = "degrees"
50
53
  LINE_FREQS = {
51
54
  "50HZ": 50,
@@ -61,7 +64,6 @@ PGA_GAINS = {
61
64
  "4X": 0x2A,
62
65
  }
63
66
 
64
- atm90e32_ns = cg.esphome_ns.namespace("atm90e32")
65
67
  ATM90E32Component = atm90e32_ns.class_(
66
68
  "ATM90E32Component", cg.PollingComponent, spi.SPIDevice
67
69
  )
@@ -164,6 +166,7 @@ CONFIG_SCHEMA = (
164
166
  ),
165
167
  cv.Optional(CONF_GAIN_PGA, default="2X"): cv.enum(PGA_GAINS, upper=True),
166
168
  cv.Optional(CONF_PEAK_CURRENT_SIGNED, default=False): cv.boolean,
169
+ cv.Optional(CONF_ENABLE_OFFSET_CALIBRATION, default=False): cv.boolean,
167
170
  }
168
171
  )
169
172
  .extend(cv.polling_component_schema("60s"))
@@ -227,3 +230,4 @@ async def to_code(config):
227
230
  cg.add(var.set_current_phases(config[CONF_CURRENT_PHASES]))
228
231
  cg.add(var.set_pga_gain(config[CONF_GAIN_PGA]))
229
232
  cg.add(var.set_peak_current_signed(config[CONF_PEAK_CURRENT_SIGNED]))
233
+ cg.add(var.set_enable_offset_calibration(config[CONF_ENABLE_OFFSET_CALIBRATION]))
@@ -90,7 +90,7 @@ struct BedjetStatusPacket {
90
90
  int unused_6 : 1; // 0x4
91
91
  bool is_dual_zone : 1; /// Is part of a Dual Zone configuration
92
92
  int unused_7 : 1; // 0x1
93
- } dual_zone_flags;
93
+ } dual_zone_flags; // NOLINT(clang-diagnostic-unaligned-access)
94
94
 
95
95
  uint8_t unused_4 : 8; // Unknown 23-24 = 0x1310
96
96
  uint8_t unused_5 : 8; // Unknown 23-24 = 0x1310
@@ -18,10 +18,11 @@ class BinaryLightOutput : public light::LightOutput {
18
18
  void write_state(light::LightState *state) override {
19
19
  bool binary;
20
20
  state->current_values_as_binary(&binary);
21
- if (binary)
21
+ if (binary) {
22
22
  this->output_->turn_on();
23
- else
23
+ } else {
24
24
  this->output_->turn_off();
25
+ }
25
26
  }
26
27
 
27
28
  protected:
@@ -1,10 +1,8 @@
1
- import esphome.codegen as cg
2
- import esphome.config_validation as cv
3
- from esphome.cpp_generator import MockObjClass
4
- from esphome.cpp_helpers import setup_entity
5
1
  from esphome import automation, core
6
2
  from esphome.automation import Condition, maybe_simple_id
3
+ import esphome.codegen as cg
7
4
  from esphome.components import mqtt, web_server
5
+ import esphome.config_validation as cv
8
6
  from esphome.const import (
9
7
  CONF_DELAY,
10
8
  CONF_DEVICE_CLASS,
@@ -16,6 +14,7 @@ from esphome.const import (
16
14
  CONF_INVERTED,
17
15
  CONF_MAX_LENGTH,
18
16
  CONF_MIN_LENGTH,
17
+ CONF_MQTT_ID,
19
18
  CONF_ON_CLICK,
20
19
  CONF_ON_DOUBLE_CLICK,
21
20
  CONF_ON_MULTI_CLICK,
@@ -26,7 +25,6 @@ from esphome.const import (
26
25
  CONF_STATE,
27
26
  CONF_TIMING,
28
27
  CONF_TRIGGER_ID,
29
- CONF_MQTT_ID,
30
28
  CONF_WEB_SERVER_ID,
31
29
  DEVICE_CLASS_BATTERY,
32
30
  DEVICE_CLASS_BATTERY_CHARGING,
@@ -59,6 +57,8 @@ from esphome.const import (
59
57
  DEVICE_CLASS_WINDOW,
60
58
  )
61
59
  from esphome.core import CORE, coroutine_with_priority
60
+ from esphome.cpp_generator import MockObjClass
61
+ from esphome.cpp_helpers import setup_entity
62
62
  from esphome.util import Registry
63
63
 
64
64
  CODEOWNERS = ["@esphome/core"]
@@ -1,7 +1,8 @@
1
+ from esphome import automation
2
+ from esphome.automation import maybe_simple_id
1
3
  import esphome.codegen as cg
4
+ from esphome.components import esp32_ble_client, esp32_ble_tracker
2
5
  import esphome.config_validation as cv
3
- from esphome.automation import maybe_simple_id
4
- from esphome.components import esp32_ble_tracker, esp32_ble_client
5
6
  from esphome.const import (
6
7
  CONF_CHARACTERISTIC_UUID,
7
8
  CONF_ID,
@@ -13,7 +14,6 @@ from esphome.const import (
13
14
  CONF_TRIGGER_ID,
14
15
  CONF_VALUE,
15
16
  )
16
- from esphome import automation
17
17
 
18
18
  AUTO_LOAD = ["esp32_ble_client"]
19
19
  CODEOWNERS = ["@buxtronix", "@clydebarrow"]
@@ -1,6 +1,6 @@
1
1
  import esphome.codegen as cg
2
- import esphome.config_validation as cv
3
2
  from esphome.components import ble_client, esp32_ble_tracker, output
3
+ import esphome.config_validation as cv
4
4
  from esphome.const import CONF_CHARACTERISTIC_UUID, CONF_ID, CONF_SERVICE_UUID
5
5
 
6
6
  from .. import ble_client_ns
@@ -1,17 +1,18 @@
1
+ from esphome import automation
1
2
  import esphome.codegen as cg
3
+ from esphome.components import ble_client, esp32_ble_tracker, sensor
2
4
  import esphome.config_validation as cv
3
- from esphome.components import sensor, ble_client, esp32_ble_tracker
4
5
  from esphome.const import (
5
6
  CONF_CHARACTERISTIC_UUID,
6
7
  CONF_LAMBDA,
8
+ CONF_SERVICE_UUID,
7
9
  CONF_TRIGGER_ID,
8
10
  CONF_TYPE,
9
- CONF_SERVICE_UUID,
10
11
  DEVICE_CLASS_SIGNAL_STRENGTH,
11
12
  STATE_CLASS_MEASUREMENT,
12
13
  UNIT_DECIBEL_MILLIWATT,
13
14
  )
14
- from esphome import automation
15
+
15
16
  from .. import ble_client_ns
16
17
 
17
18
  DEPENDENCIES = ["ble_client"]
@@ -1,7 +1,8 @@
1
1
  import esphome.codegen as cg
2
+ from esphome.components import ble_client, switch
2
3
  import esphome.config_validation as cv
3
- from esphome.components import switch, ble_client
4
4
  from esphome.const import ICON_BLUETOOTH
5
+
5
6
  from .. import ble_client_ns
6
7
 
7
8
  BLEClientSwitch = ble_client_ns.class_(
@@ -1,13 +1,14 @@
1
+ from esphome import automation
1
2
  import esphome.codegen as cg
3
+ from esphome.components import ble_client, esp32_ble_tracker, text_sensor
2
4
  import esphome.config_validation as cv
3
- from esphome.components import text_sensor, ble_client, esp32_ble_tracker
4
5
  from esphome.const import (
5
6
  CONF_CHARACTERISTIC_UUID,
6
7
  CONF_ID,
7
- CONF_TRIGGER_ID,
8
8
  CONF_SERVICE_UUID,
9
+ CONF_TRIGGER_ID,
9
10
  )
10
- from esphome import automation
11
+
11
12
  from .. import ble_client_ns
12
13
 
13
14
  DEPENDENCIES = ["ble_client"]
@@ -1,13 +1,13 @@
1
1
  import esphome.codegen as cg
2
- import esphome.config_validation as cv
3
2
  from esphome.components import binary_sensor, esp32_ble_tracker
3
+ import esphome.config_validation as cv
4
4
  from esphome.const import (
5
- CONF_MAC_ADDRESS,
6
- CONF_SERVICE_UUID,
7
5
  CONF_IBEACON_MAJOR,
8
6
  CONF_IBEACON_MINOR,
9
7
  CONF_IBEACON_UUID,
8
+ CONF_MAC_ADDRESS,
10
9
  CONF_MIN_RSSI,
10
+ CONF_SERVICE_UUID,
11
11
  CONF_TIMEOUT,
12
12
  )
13
13
 
@@ -1,12 +1,12 @@
1
1
  import esphome.codegen as cg
2
+ from esphome.components import esp32_ble_tracker, sensor
2
3
  import esphome.config_validation as cv
3
- from esphome.components import sensor, esp32_ble_tracker
4
4
  from esphome.const import (
5
5
  CONF_IBEACON_MAJOR,
6
6
  CONF_IBEACON_MINOR,
7
7
  CONF_IBEACON_UUID,
8
- CONF_SERVICE_UUID,
9
8
  CONF_MAC_ADDRESS,
9
+ CONF_SERVICE_UUID,
10
10
  DEVICE_CLASS_SIGNAL_STRENGTH,
11
11
  STATE_CLASS_MEASUREMENT,
12
12
  UNIT_DECIBEL_MILLIWATT,
@@ -1,6 +1,6 @@
1
1
  import esphome.codegen as cg
2
+ from esphome.components import esp32_ble_tracker, text_sensor
2
3
  import esphome.config_validation as cv
3
- from esphome.components import text_sensor, esp32_ble_tracker
4
4
 
5
5
  DEPENDENCIES = ["esp32_ble_tracker"]
6
6
 
@@ -1,8 +1,8 @@
1
- from esphome.components import esp32_ble_tracker, esp32_ble_client
2
- import esphome.config_validation as cv
3
1
  import esphome.codegen as cg
4
- from esphome.const import CONF_ACTIVE, CONF_ID
2
+ from esphome.components import esp32_ble_client, esp32_ble_tracker
5
3
  from esphome.components.esp32 import add_idf_sdkconfig_option
4
+ import esphome.config_validation as cv
5
+ from esphome.const import CONF_ACTIVE, CONF_ID
6
6
 
7
7
  AUTO_LOAD = ["esp32_ble_client", "esp32_ble_tracker"]
8
8
  DEPENDENCIES = ["api", "esp32"]