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,100 @@
1
+ #include "homeassistant_number.h"
2
+
3
+ #include "esphome/components/api/api_pb2.h"
4
+ #include "esphome/components/api/api_server.h"
5
+ #include "esphome/core/log.h"
6
+
7
+ namespace esphome {
8
+ namespace homeassistant {
9
+
10
+ static const char *const TAG = "homeassistant.number";
11
+
12
+ void HomeassistantNumber::state_changed_(const std::string &state) {
13
+ auto number_value = parse_number<float>(state);
14
+ if (!number_value.has_value()) {
15
+ ESP_LOGW(TAG, "'%s': Can't convert '%s' to number!", this->entity_id_.c_str(), state.c_str());
16
+ this->publish_state(NAN);
17
+ return;
18
+ }
19
+ if (this->state == number_value.value()) {
20
+ return;
21
+ }
22
+ ESP_LOGD(TAG, "'%s': Got state %s", this->entity_id_.c_str(), state.c_str());
23
+ this->publish_state(number_value.value());
24
+ }
25
+
26
+ void HomeassistantNumber::min_retrieved_(const std::string &min) {
27
+ auto min_value = parse_number<float>(min);
28
+ if (!min_value.has_value()) {
29
+ ESP_LOGE(TAG, "'%s': Can't convert 'min' value '%s' to number!", this->entity_id_.c_str(), min.c_str());
30
+ }
31
+ ESP_LOGD(TAG, "'%s': Min retrieved: %s", get_name().c_str(), min.c_str());
32
+ this->traits.set_min_value(min_value.value());
33
+ }
34
+
35
+ void HomeassistantNumber::max_retrieved_(const std::string &max) {
36
+ auto max_value = parse_number<float>(max);
37
+ if (!max_value.has_value()) {
38
+ ESP_LOGE(TAG, "'%s': Can't convert 'max' value '%s' to number!", this->entity_id_.c_str(), max.c_str());
39
+ }
40
+ ESP_LOGD(TAG, "'%s': Max retrieved: %s", get_name().c_str(), max.c_str());
41
+ this->traits.set_max_value(max_value.value());
42
+ }
43
+
44
+ void HomeassistantNumber::step_retrieved_(const std::string &step) {
45
+ auto step_value = parse_number<float>(step);
46
+ if (!step_value.has_value()) {
47
+ ESP_LOGE(TAG, "'%s': Can't convert 'step' value '%s' to number!", this->entity_id_.c_str(), step.c_str());
48
+ }
49
+ ESP_LOGD(TAG, "'%s': Step Retrieved %s", get_name().c_str(), step.c_str());
50
+ this->traits.set_step(step_value.value());
51
+ }
52
+
53
+ void HomeassistantNumber::setup() {
54
+ api::global_api_server->subscribe_home_assistant_state(
55
+ this->entity_id_, nullopt, std::bind(&HomeassistantNumber::state_changed_, this, std::placeholders::_1));
56
+
57
+ api::global_api_server->get_home_assistant_state(
58
+ this->entity_id_, optional<std::string>("min"),
59
+ std::bind(&HomeassistantNumber::min_retrieved_, this, std::placeholders::_1));
60
+ api::global_api_server->get_home_assistant_state(
61
+ this->entity_id_, optional<std::string>("max"),
62
+ std::bind(&HomeassistantNumber::max_retrieved_, this, std::placeholders::_1));
63
+ api::global_api_server->get_home_assistant_state(
64
+ this->entity_id_, optional<std::string>("step"),
65
+ std::bind(&HomeassistantNumber::step_retrieved_, this, std::placeholders::_1));
66
+ }
67
+
68
+ void HomeassistantNumber::dump_config() {
69
+ LOG_NUMBER("", "Homeassistant Number", this);
70
+ ESP_LOGCONFIG(TAG, " Entity ID: '%s'", this->entity_id_.c_str());
71
+ }
72
+
73
+ float HomeassistantNumber::get_setup_priority() const { return setup_priority::AFTER_CONNECTION; }
74
+
75
+ void HomeassistantNumber::control(float value) {
76
+ if (!api::global_api_server->is_connected()) {
77
+ ESP_LOGE(TAG, "No clients connected to API server");
78
+ return;
79
+ }
80
+
81
+ this->publish_state(value);
82
+
83
+ api::HomeassistantServiceResponse resp;
84
+ resp.service = "number.set_value";
85
+
86
+ api::HomeassistantServiceMap entity_id;
87
+ entity_id.key = "entity_id";
88
+ entity_id.value = this->entity_id_;
89
+ resp.data.push_back(entity_id);
90
+
91
+ api::HomeassistantServiceMap entity_value;
92
+ entity_value.key = "value";
93
+ entity_value.value = to_string(value);
94
+ resp.data.push_back(entity_value);
95
+
96
+ api::global_api_server->send_homeassistant_service_call(resp);
97
+ }
98
+
99
+ } // namespace homeassistant
100
+ } // namespace esphome
@@ -0,0 +1,31 @@
1
+ #pragma once
2
+
3
+ #include <map>
4
+ #include <string>
5
+
6
+ #include "esphome/components/number/number.h"
7
+ #include "esphome/core/component.h"
8
+
9
+ namespace esphome {
10
+ namespace homeassistant {
11
+
12
+ class HomeassistantNumber : public number::Number, public Component {
13
+ public:
14
+ void set_entity_id(const std::string &entity_id) { this->entity_id_ = entity_id; }
15
+
16
+ void setup() override;
17
+ void dump_config() override;
18
+ float get_setup_priority() const override;
19
+
20
+ protected:
21
+ void state_changed_(const std::string &state);
22
+ void min_retrieved_(const std::string &min);
23
+ void max_retrieved_(const std::string &max);
24
+ void step_retrieved_(const std::string &step);
25
+
26
+ void control(float value) override;
27
+
28
+ std::string entity_id_;
29
+ };
30
+ } // namespace homeassistant
31
+ } // namespace esphome
@@ -0,0 +1,30 @@
1
+ import esphome.codegen as cg
2
+ from esphome.components import switch
3
+ import esphome.config_validation as cv
4
+ from esphome.const import CONF_ID
5
+
6
+ from .. import (
7
+ HOME_ASSISTANT_IMPORT_CONTROL_SCHEMA,
8
+ homeassistant_ns,
9
+ setup_home_assistant_entity,
10
+ )
11
+
12
+ CODEOWNERS = ["@Links2004"]
13
+ DEPENDENCIES = ["api"]
14
+
15
+ HomeassistantSwitch = homeassistant_ns.class_(
16
+ "HomeassistantSwitch", switch.Switch, cg.Component
17
+ )
18
+
19
+ CONFIG_SCHEMA = (
20
+ switch.switch_schema(HomeassistantSwitch)
21
+ .extend(cv.COMPONENT_SCHEMA)
22
+ .extend(HOME_ASSISTANT_IMPORT_CONTROL_SCHEMA)
23
+ )
24
+
25
+
26
+ async def to_code(config):
27
+ var = cg.new_Pvariable(config[CONF_ID])
28
+ await cg.register_component(var, config)
29
+ await switch.register_switch(var, config)
30
+ setup_home_assistant_entity(var, config)
@@ -0,0 +1,59 @@
1
+ #include "homeassistant_switch.h"
2
+ #include "esphome/components/api/api_server.h"
3
+ #include "esphome/core/log.h"
4
+
5
+ namespace esphome {
6
+ namespace homeassistant {
7
+
8
+ static const char *const TAG = "homeassistant.switch";
9
+
10
+ using namespace esphome::switch_;
11
+
12
+ void HomeassistantSwitch::setup() {
13
+ api::global_api_server->subscribe_home_assistant_state(this->entity_id_, nullopt, [this](const std::string &state) {
14
+ auto val = parse_on_off(state.c_str());
15
+ switch (val) {
16
+ case PARSE_NONE:
17
+ case PARSE_TOGGLE:
18
+ ESP_LOGW(TAG, "Can't convert '%s' to binary state!", state.c_str());
19
+ break;
20
+ case PARSE_ON:
21
+ case PARSE_OFF:
22
+ bool new_state = val == PARSE_ON;
23
+ ESP_LOGD(TAG, "'%s': Got state %s", this->entity_id_.c_str(), ONOFF(new_state));
24
+ this->publish_state(new_state);
25
+ break;
26
+ }
27
+ });
28
+ }
29
+
30
+ void HomeassistantSwitch::dump_config() {
31
+ LOG_SWITCH("", "Homeassistant Switch", this);
32
+ ESP_LOGCONFIG(TAG, " Entity ID: '%s'", this->entity_id_.c_str());
33
+ }
34
+
35
+ float HomeassistantSwitch::get_setup_priority() const { return setup_priority::AFTER_CONNECTION; }
36
+
37
+ void HomeassistantSwitch::write_state(bool state) {
38
+ if (!api::global_api_server->is_connected()) {
39
+ ESP_LOGE(TAG, "No clients connected to API server");
40
+ return;
41
+ }
42
+
43
+ api::HomeassistantServiceResponse resp;
44
+ if (state) {
45
+ resp.service = "switch.turn_on";
46
+ } else {
47
+ resp.service = "switch.turn_off";
48
+ }
49
+
50
+ api::HomeassistantServiceMap entity_id_kv;
51
+ entity_id_kv.key = "entity_id";
52
+ entity_id_kv.value = this->entity_id_;
53
+ resp.data.push_back(entity_id_kv);
54
+
55
+ api::global_api_server->send_homeassistant_service_call(resp);
56
+ }
57
+
58
+ } // namespace homeassistant
59
+ } // namespace esphome
@@ -0,0 +1,22 @@
1
+ #pragma once
2
+
3
+ #include "esphome/components/switch/switch.h"
4
+ #include "esphome/core/component.h"
5
+
6
+ namespace esphome {
7
+ namespace homeassistant {
8
+
9
+ class HomeassistantSwitch : public switch_::Switch, public Component {
10
+ public:
11
+ void set_entity_id(const std::string &entity_id) { this->entity_id_ = entity_id; }
12
+ void setup() override;
13
+ void dump_config() override;
14
+ float get_setup_priority() const override;
15
+
16
+ protected:
17
+ void write_state(bool state) override;
18
+ std::string entity_id_;
19
+ };
20
+
21
+ } // namespace homeassistant
22
+ } // namespace esphome
@@ -1,15 +1,14 @@
1
+ import esphome.codegen as cg
2
+ import esphome.config_validation as cv
1
3
  from esphome.const import (
4
+ CONF_MAC_ADDRESS,
2
5
  KEY_CORE,
3
6
  KEY_FRAMEWORK_VERSION,
4
7
  KEY_TARGET_FRAMEWORK,
5
8
  KEY_TARGET_PLATFORM,
6
9
  PLATFORM_HOST,
7
- CONF_MAC_ADDRESS,
8
10
  )
9
11
  from esphome.core import CORE
10
- from esphome.helpers import IS_MACOS
11
- import esphome.config_validation as cv
12
- import esphome.codegen as cg
13
12
 
14
13
  from .const import KEY_HOST
15
14
 
@@ -42,8 +41,5 @@ async def to_code(config):
42
41
  cg.add_build_flag("-DUSE_HOST")
43
42
  cg.add_define("USE_ESPHOME_HOST_MAC_ADDRESS", config[CONF_MAC_ADDRESS].parts)
44
43
  cg.add_build_flag("-std=c++17")
45
- cg.add_build_flag("-lsodium")
46
- if IS_MACOS:
47
- cg.add_build_flag("-L/opt/homebrew/lib")
48
44
  cg.add_define("ESPHOME_BOARD", "host")
49
45
  cg.add_platformio_option("platform", "platformio/native")
@@ -14,7 +14,7 @@ from esphome.const import (
14
14
  from esphome.core import CORE, Lambda
15
15
 
16
16
  DEPENDENCIES = ["network"]
17
- AUTO_LOAD = ["json"]
17
+ AUTO_LOAD = ["json", "watchdog"]
18
18
 
19
19
  http_request_ns = cg.esphome_ns.namespace("http_request")
20
20
  HttpRequestComponent = http_request_ns.class_("HttpRequestComponent", cg.Component)
@@ -40,6 +40,8 @@ CONF_VERIFY_SSL = "verify_ssl"
40
40
  CONF_FOLLOW_REDIRECTS = "follow_redirects"
41
41
  CONF_REDIRECT_LIMIT = "redirect_limit"
42
42
  CONF_WATCHDOG_TIMEOUT = "watchdog_timeout"
43
+ CONF_BUFFER_SIZE_RX = "buffer_size_rx"
44
+ CONF_BUFFER_SIZE_TX = "buffer_size_tx"
43
45
 
44
46
  CONF_MAX_RESPONSE_BUFFER_SIZE = "max_response_buffer_size"
45
47
  CONF_ON_RESPONSE = "on_response"
@@ -110,6 +112,12 @@ CONFIG_SCHEMA = cv.All(
110
112
  cv.positive_not_null_time_period,
111
113
  cv.positive_time_period_milliseconds,
112
114
  ),
115
+ cv.SplitDefault(CONF_BUFFER_SIZE_RX, esp32_idf=512): cv.All(
116
+ cv.uint16_t, cv.only_with_esp_idf
117
+ ),
118
+ cv.SplitDefault(CONF_BUFFER_SIZE_TX, esp32_idf=512): cv.All(
119
+ cv.uint16_t, cv.only_with_esp_idf
120
+ ),
113
121
  }
114
122
  ).extend(cv.COMPONENT_SCHEMA),
115
123
  cv.require_framework_version(
@@ -137,6 +145,9 @@ async def to_code(config):
137
145
 
138
146
  if CORE.is_esp32:
139
147
  if CORE.using_esp_idf:
148
+ cg.add(var.set_buffer_size_rx(config[CONF_BUFFER_SIZE_RX]))
149
+ cg.add(var.set_buffer_size_tx(config[CONF_BUFFER_SIZE_TX]))
150
+
140
151
  esp32.add_idf_sdkconfig_option(
141
152
  "CONFIG_MBEDTLS_CERTIFICATE_BUNDLE",
142
153
  config.get(CONF_VERIFY_SSL),
@@ -3,12 +3,12 @@
3
3
  #ifdef USE_ARDUINO
4
4
 
5
5
  #include "esphome/components/network/util.h"
6
+ #include "esphome/components/watchdog/watchdog.h"
7
+
6
8
  #include "esphome/core/application.h"
7
9
  #include "esphome/core/defines.h"
8
10
  #include "esphome/core/log.h"
9
11
 
10
- #include "watchdog.h"
11
-
12
12
  namespace esphome {
13
13
  namespace http_request {
14
14
 
@@ -3,6 +3,8 @@
3
3
  #ifdef USE_ESP_IDF
4
4
 
5
5
  #include "esphome/components/network/util.h"
6
+ #include "esphome/components/watchdog/watchdog.h"
7
+
6
8
  #include "esphome/core/application.h"
7
9
  #include "esphome/core/defines.h"
8
10
  #include "esphome/core/log.h"
@@ -11,13 +13,17 @@
11
13
  #include "esp_crt_bundle.h"
12
14
  #endif
13
15
 
14
- #include "watchdog.h"
15
-
16
16
  namespace esphome {
17
17
  namespace http_request {
18
18
 
19
19
  static const char *const TAG = "http_request.idf";
20
20
 
21
+ void HttpRequestIDF::dump_config() {
22
+ HttpRequestComponent::dump_config();
23
+ ESP_LOGCONFIG(TAG, " Buffer Size RX: %u", this->buffer_size_rx_);
24
+ ESP_LOGCONFIG(TAG, " Buffer Size TX: %u", this->buffer_size_tx_);
25
+ }
26
+
21
27
  std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::string method, std::string body,
22
28
  std::list<Header> headers) {
23
29
  if (!network::is_connected()) {
@@ -63,6 +69,9 @@ std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::strin
63
69
  config.user_agent = this->useragent_;
64
70
  }
65
71
 
72
+ config.buffer_size = this->buffer_size_rx_;
73
+ config.buffer_size_tx = this->buffer_size_tx_;
74
+
66
75
  const uint32_t start = millis();
67
76
  watchdog::WatchdogManager wdm(this->get_watchdog_timeout());
68
77
 
@@ -24,8 +24,18 @@ class HttpContainerIDF : public HttpContainer {
24
24
 
25
25
  class HttpRequestIDF : public HttpRequestComponent {
26
26
  public:
27
+ void dump_config() override;
28
+
27
29
  std::shared_ptr<HttpContainer> start(std::string url, std::string method, std::string body,
28
30
  std::list<Header> headers) override;
31
+
32
+ void set_buffer_size_rx(uint16_t buffer_size_rx) { this->buffer_size_rx_ = buffer_size_rx; }
33
+ void set_buffer_size_tx(uint16_t buffer_size_tx) { this->buffer_size_tx_ = buffer_size_tx; }
34
+
35
+ protected:
36
+ // if zero ESP-IDF will use DEFAULT_HTTP_BUF_SIZE
37
+ uint16_t buffer_size_rx_{};
38
+ uint16_t buffer_size_tx_{};
29
39
  };
30
40
 
31
41
  } // namespace http_request
@@ -1,11 +1,11 @@
1
1
  #include "ota_http_request.h"
2
- #include "../watchdog.h"
3
2
 
4
3
  #include "esphome/core/application.h"
5
4
  #include "esphome/core/defines.h"
6
5
  #include "esphome/core/log.h"
7
6
 
8
7
  #include "esphome/components/md5/md5.h"
8
+ #include "esphome/components/watchdog/watchdog.h"
9
9
  #include "esphome/components/ota/ota_backend.h"
10
10
  #include "esphome/components/ota/ota_backend_arduino_esp32.h"
11
11
  #include "esphome/components/ota/ota_backend_arduino_esp8266.h"
@@ -138,8 +138,8 @@ void HttpRequestUpdate::update() {
138
138
  this->publish_state();
139
139
  }
140
140
 
141
- void HttpRequestUpdate::perform() {
142
- if (this->state_ != update::UPDATE_STATE_AVAILABLE) {
141
+ void HttpRequestUpdate::perform(bool force) {
142
+ if (this->state_ != update::UPDATE_STATE_AVAILABLE && !force) {
143
143
  return;
144
144
  }
145
145
 
@@ -15,7 +15,8 @@ class HttpRequestUpdate : public update::UpdateEntity, public PollingComponent {
15
15
  void setup() override;
16
16
  void update() override;
17
17
 
18
- void perform() override;
18
+ void perform(bool force) override;
19
+ void check() override { this->update(); }
19
20
 
20
21
  void set_source_url(const std::string &source_url) { this->source_url_ = source_url; }
21
22
 
@@ -39,8 +39,8 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
39
39
  return false;
40
40
  }
41
41
 
42
- this->status_clear_warning();
43
42
  uint32_t data = 0;
43
+ bool final_dout;
44
44
 
45
45
  {
46
46
  InterruptLock lock;
@@ -59,8 +59,17 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
59
59
  this->sck_pin_->digital_write(false);
60
60
  delayMicroseconds(1);
61
61
  }
62
+ final_dout = this->dout_pin_->digital_read();
62
63
  }
63
64
 
65
+ if (!final_dout) {
66
+ ESP_LOGW(TAG, "HX711 DOUT pin not high after reading (data 0x%" PRIx32 ")!", data);
67
+ this->status_set_warning();
68
+ return false;
69
+ }
70
+
71
+ this->status_clear_warning();
72
+
64
73
  if (data & 0x800000ULL) {
65
74
  data |= 0xFF000000ULL;
66
75
  }
@@ -236,7 +236,7 @@ void HydreonRGxxComponent::process_line_() {
236
236
  }
237
237
  bool is_data_line = false;
238
238
  for (int i = 0; i < NUM_SENSORS; i++) {
239
- if (this->sensors_[i] != nullptr && this->buffer_starts_with_(PROTOCOL_NAMES[i])) {
239
+ if (this->sensors_[i] != nullptr && this->buffer_.find(PROTOCOL_NAMES[i]) != std::string::npos) {
240
240
  is_data_line = true;
241
241
  break;
242
242
  }
@@ -180,7 +180,11 @@ void I2SAudioSpeaker::player_task(void *params) {
180
180
  }
181
181
  }
182
182
 
183
- void I2SAudioSpeaker::stop() {
183
+ void I2SAudioSpeaker::stop() { this->stop_(false); }
184
+
185
+ void I2SAudioSpeaker::finish() { this->stop_(true); }
186
+
187
+ void I2SAudioSpeaker::stop_(bool wait_on_empty) {
184
188
  if (this->is_failed())
185
189
  return;
186
190
  if (this->state_ == speaker::STATE_STOPPED)
@@ -192,7 +196,11 @@ void I2SAudioSpeaker::stop() {
192
196
  this->state_ = speaker::STATE_STOPPING;
193
197
  DataEvent data;
194
198
  data.stop = true;
195
- xQueueSendToFront(this->buffer_queue_, &data, portMAX_DELAY);
199
+ if (wait_on_empty) {
200
+ xQueueSend(this->buffer_queue_, &data, portMAX_DELAY);
201
+ } else {
202
+ xQueueSendToFront(this->buffer_queue_, &data, portMAX_DELAY);
203
+ }
196
204
  }
197
205
 
198
206
  void I2SAudioSpeaker::watch_() {
@@ -233,6 +241,7 @@ void I2SAudioSpeaker::loop() {
233
241
  switch (this->state_) {
234
242
  case speaker::STATE_STARTING:
235
243
  this->start_();
244
+ [[fallthrough]];
236
245
  case speaker::STATE_RUNNING:
237
246
  case speaker::STATE_STOPPING:
238
247
  this->watch_();
@@ -53,6 +53,7 @@ class I2SAudioSpeaker : public Component, public speaker::Speaker, public I2SAud
53
53
 
54
54
  void start() override;
55
55
  void stop() override;
56
+ void finish() override;
56
57
 
57
58
  size_t play(const uint8_t *data, size_t length) override;
58
59
 
@@ -60,6 +61,7 @@ class I2SAudioSpeaker : public Component, public speaker::Speaker, public I2SAud
60
61
 
61
62
  protected:
62
63
  void start_();
64
+ void stop_(bool wait_on_empty);
63
65
  void watch_();
64
66
 
65
67
  static void player_task(void *params);
@@ -92,7 +92,9 @@ static const uint8_t ILI9XXX_GMCTRN1 = 0xE1;
92
92
 
93
93
  static const uint8_t ILI9XXX_CSCON = 0xF0;
94
94
  static const uint8_t ILI9XXX_ADJCTL3 = 0xF7;
95
- static const uint8_t ILI9XXX_DELAY = 0xFF; // followed by one byte of delay time in ms
95
+ static const uint8_t ILI9XXX_DELAY_FLAG = 0xFF;
96
+ // special marker for delay - command byte reprents ms, length byte is an impossible value
97
+ #define ILI9XXX_DELAY(ms) ((uint8_t) ((ms) | 0x80)), ILI9XXX_DELAY_FLAG
96
98
 
97
99
  } // namespace ili9xxx
98
100
  } // namespace esphome
@@ -34,8 +34,8 @@ void ILI9XXXDisplay::setup() {
34
34
  ESP_LOGD(TAG, "Setting up ILI9xxx");
35
35
 
36
36
  this->setup_pins_();
37
- this->init_lcd(this->init_sequence_);
38
- this->init_lcd(this->extra_init_sequence_.data());
37
+ this->init_lcd_(this->init_sequence_);
38
+ this->init_lcd_(this->extra_init_sequence_.data());
39
39
  switch (this->pixel_mode_) {
40
40
  case PIXEL_MODE_16:
41
41
  if (this->is_18bitdisplay_) {
@@ -405,42 +405,29 @@ void ILI9XXXDisplay::reset_() {
405
405
  }
406
406
  }
407
407
 
408
- void ILI9XXXDisplay::init_lcd(const uint8_t *addr) {
408
+ void ILI9XXXDisplay::init_lcd_(const uint8_t *addr) {
409
409
  if (addr == nullptr)
410
410
  return;
411
411
  uint8_t cmd, x, num_args;
412
412
  while ((cmd = *addr++) != 0) {
413
413
  x = *addr++;
414
- if (cmd == ILI9XXX_DELAY) {
415
- ESP_LOGD(TAG, "Delay %dms", x);
416
- delay(x);
414
+ if (x == ILI9XXX_DELAY_FLAG) {
415
+ cmd &= 0x7F;
416
+ ESP_LOGV(TAG, "Delay %dms", cmd);
417
+ delay(cmd);
417
418
  } else {
418
419
  num_args = x & 0x7F;
419
- ESP_LOGD(TAG, "Command %02X, length %d, bits %02X", cmd, num_args, *addr);
420
+ ESP_LOGV(TAG, "Command %02X, length %d, bits %02X", cmd, num_args, *addr);
420
421
  this->send_command(cmd, addr, num_args);
421
422
  addr += num_args;
422
423
  if (x & 0x80) {
423
- ESP_LOGD(TAG, "Delay 150ms");
424
+ ESP_LOGV(TAG, "Delay 150ms");
424
425
  delay(150); // NOLINT
425
426
  }
426
427
  }
427
428
  }
428
429
  }
429
430
 
430
- void ILI9XXXGC9A01A::init_lcd(const uint8_t *addr) {
431
- if (addr == nullptr)
432
- return;
433
- uint8_t cmd, x, num_args;
434
- while ((cmd = *addr++) != 0) {
435
- x = *addr++;
436
- num_args = x & 0x7F;
437
- this->send_command(cmd, addr, num_args);
438
- addr += num_args;
439
- if (x & 0x80)
440
- delay(150); // NOLINT
441
- }
442
- }
443
-
444
431
  // Tell the display controller where we want to draw pixels.
445
432
  void ILI9XXXDisplay::set_addr_window_(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
446
433
  x1 += this->offset_x_;
@@ -33,7 +33,9 @@ class ILI9XXXDisplay : public display::DisplayBuffer,
33
33
  uint8_t cmd, num_args, bits;
34
34
  const uint8_t *addr = init_sequence;
35
35
  while ((cmd = *addr++) != 0) {
36
- num_args = *addr++ & 0x7F;
36
+ num_args = *addr++;
37
+ if (num_args == ILI9XXX_DELAY_FLAG)
38
+ continue;
37
39
  bits = *addr;
38
40
  switch (cmd) {
39
41
  case ILI9XXX_MADCTL: {
@@ -50,13 +52,10 @@ class ILI9XXXDisplay : public display::DisplayBuffer,
50
52
  break;
51
53
  }
52
54
 
53
- case ILI9XXX_DELAY:
54
- continue; // no args to skip
55
-
56
55
  default:
57
56
  break;
58
57
  }
59
- addr += num_args;
58
+ addr += (num_args & 0x7F);
60
59
  }
61
60
  }
62
61
 
@@ -109,7 +108,7 @@ class ILI9XXXDisplay : public display::DisplayBuffer,
109
108
 
110
109
  virtual void set_madctl();
111
110
  void display_();
112
- virtual void init_lcd(const uint8_t *addr);
111
+ void init_lcd_(const uint8_t *addr);
113
112
  void set_addr_window_(uint16_t x, uint16_t y, uint16_t x2, uint16_t y2);
114
113
  void reset_();
115
114
 
@@ -269,7 +268,6 @@ class ILI9XXXS3BoxLite : public ILI9XXXDisplay {
269
268
  class ILI9XXXGC9A01A : public ILI9XXXDisplay {
270
269
  public:
271
270
  ILI9XXXGC9A01A() : ILI9XXXDisplay(INITCMD_GC9A01A, 240, 240, true) {}
272
- void init_lcd(const uint8_t *addr) override;
273
271
  };
274
272
 
275
273
  //----------- ILI9XXX_24_TFT display --------------
@@ -372,9 +372,9 @@ static const uint8_t PROGMEM INITCMD_GC9A01A[] = {
372
372
 
373
373
  static const uint8_t PROGMEM INITCMD_ST7735[] = {
374
374
  ILI9XXX_SWRESET, 0, // Soft reset, then delay 10ms
375
- ILI9XXX_DELAY, 10,
375
+ ILI9XXX_DELAY(10),
376
376
  ILI9XXX_SLPOUT , 0, // Exit Sleep, delay
377
- ILI9XXX_DELAY, 10,
377
+ ILI9XXX_DELAY(10),
378
378
  ILI9XXX_PIXFMT , 1, 0x05,
379
379
  ILI9XXX_FRMCTR1, 3, // 4: Frame rate control, 3 args + delay:
380
380
  0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
@@ -415,9 +415,9 @@ static const uint8_t PROGMEM INITCMD_ST7735[] = {
415
415
  0x00, 0x00, 0x02, 0x10,
416
416
  ILI9XXX_MADCTL , 1, 0x00, // Memory Access Control, BGR
417
417
  ILI9XXX_NORON , 0,
418
- ILI9XXX_DELAY, 10,
418
+ ILI9XXX_DELAY(10),
419
419
  ILI9XXX_DISPON , 0, // Display on
420
- ILI9XXX_DELAY, 10,
420
+ ILI9XXX_DELAY(10),
421
421
  00, // endo of list
422
422
  };
423
423
 
@@ -1,8 +1,7 @@
1
1
  import re
2
2
 
3
- import esphome.config_validation as cv
4
3
  import esphome.codegen as cg
5
-
4
+ import esphome.config_validation as cv
6
5
  from esphome.const import __version__
7
6
 
8
7
  CODEOWNERS = ["@esphome/core"]
@@ -39,4 +38,4 @@ def _process_next_url(url: str):
39
38
  async def setup_improv_core(var, config):
40
39
  if CONF_NEXT_URL in config:
41
40
  cg.add(var.set_next_url(_process_next_url(config[CONF_NEXT_URL])))
42
- cg.add_library("esphome/Improv", "1.2.3")
41
+ cg.add_library("improv/Improv", "1.2.4")