esphome 2024.10.3__py3-none-any.whl → 2024.11.0b1__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 (228) hide show
  1. esphome/__main__.py +22 -4
  2. esphome/automation.py +29 -2
  3. esphome/components/animation/__init__.py +5 -8
  4. esphome/components/animation/animation.cpp +1 -1
  5. esphome/components/audio/__init__.py +9 -0
  6. esphome/components/audio/audio.h +21 -0
  7. esphome/components/axs15231/__init__.py +6 -0
  8. esphome/components/axs15231/touchscreen/__init__.py +36 -0
  9. esphome/components/axs15231/touchscreen/axs15231_touchscreen.cpp +64 -0
  10. esphome/components/axs15231/touchscreen/axs15231_touchscreen.h +27 -0
  11. esphome/components/bme68x_bsec2/__init__.py +1 -1
  12. esphome/components/bytebuffer/__init__.py +5 -0
  13. esphome/components/bytebuffer/bytebuffer.h +421 -0
  14. esphome/components/climate/__init__.py +14 -13
  15. esphome/components/datetime/__init__.py +3 -3
  16. esphome/components/debug/debug_esp32.cpp +16 -8
  17. esphome/components/dfplayer/dfplayer.cpp +132 -6
  18. esphome/components/dfplayer/dfplayer.h +19 -53
  19. esphome/components/display/display.cpp +142 -0
  20. esphome/components/display/display.h +7 -0
  21. esphome/components/es8311/__init__.py +0 -0
  22. esphome/components/es8311/audio_dac.py +70 -0
  23. esphome/components/es8311/es8311.cpp +227 -0
  24. esphome/components/es8311/es8311.h +135 -0
  25. esphome/components/es8311/es8311_const.h +195 -0
  26. esphome/components/esp32/boards.py +199 -1
  27. esphome/components/esp32/gpio.py +3 -1
  28. esphome/components/esp32_ble/const_esp32c6.h +7 -0
  29. esphome/components/esp32_ble_client/ble_client_base.h +1 -1
  30. esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +2 -1
  31. esphome/components/esp32_rmt_led_strip/led_strip.cpp +2 -2
  32. esphome/components/esp32_rmt_led_strip/led_strip.h +2 -0
  33. esphome/components/esp32_rmt_led_strip/light.py +3 -1
  34. esphome/components/esp8266/gpio.py +7 -5
  35. esphome/components/ethernet/__init__.py +55 -1
  36. esphome/components/ethernet/ethernet_component.cpp +14 -1
  37. esphome/components/ethernet/ethernet_component.h +7 -1
  38. esphome/components/font/__init__.py +213 -108
  39. esphome/components/gp8403/output/__init__.py +1 -1
  40. esphome/components/host/gpio.py +6 -4
  41. esphome/components/http_request/__init__.py +12 -0
  42. esphome/components/http_request/http_request.h +65 -3
  43. esphome/components/http_request/http_request_arduino.cpp +2 -3
  44. esphome/components/http_request/http_request_idf.cpp +6 -14
  45. esphome/components/http_request/ota/ota_http_request.cpp +1 -1
  46. esphome/components/http_request/update/http_request_update.cpp +1 -1
  47. esphome/components/i2c_device/__init__.py +26 -0
  48. esphome/components/i2c_device/i2c_device.cpp +17 -0
  49. esphome/components/i2c_device/i2c_device.h +18 -0
  50. esphome/components/i2s_audio/__init__.py +1 -3
  51. esphome/components/i2s_audio/speaker/__init__.py +12 -4
  52. esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +432 -197
  53. esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +91 -32
  54. esphome/components/ili9xxx/display.py +5 -1
  55. esphome/components/image/__init__.py +5 -8
  56. esphome/components/image/image.cpp +14 -14
  57. esphome/components/image/image.h +20 -24
  58. esphome/components/internal_temperature/internal_temperature.cpp +51 -2
  59. esphome/components/internal_temperature/internal_temperature.h +1 -0
  60. esphome/components/libretiny/gpio.py +4 -2
  61. esphome/components/light/__init__.py +32 -1
  62. esphome/components/light/automation.py +39 -32
  63. esphome/components/light/effects.py +36 -36
  64. esphome/components/light/light_state.cpp +6 -16
  65. esphome/components/light/light_state.h +34 -0
  66. esphome/components/light/types.py +3 -1
  67. esphome/components/logger/logger_esp32.cpp +15 -0
  68. esphome/components/lvgl/__init__.py +202 -95
  69. esphome/components/lvgl/automation.py +42 -40
  70. esphome/components/lvgl/binary_sensor/__init__.py +8 -15
  71. esphome/components/lvgl/defines.py +14 -8
  72. esphome/components/lvgl/encoders.py +11 -8
  73. esphome/components/lvgl/keypads.py +77 -0
  74. esphome/components/lvgl/light/__init__.py +6 -8
  75. esphome/components/lvgl/lv_validation.py +2 -4
  76. esphome/components/lvgl/lvcode.py +3 -9
  77. esphome/components/lvgl/lvgl_esphome.cpp +210 -89
  78. esphome/components/lvgl/lvgl_esphome.h +113 -30
  79. esphome/components/lvgl/lvgl_proxy.h +17 -0
  80. esphome/components/lvgl/number/__init__.py +10 -15
  81. esphome/components/lvgl/schemas.py +4 -2
  82. esphome/components/lvgl/select/__init__.py +12 -37
  83. esphome/components/lvgl/select/lvgl_select.h +27 -33
  84. esphome/components/lvgl/sensor/__init__.py +8 -14
  85. esphome/components/lvgl/styles.py +3 -4
  86. esphome/components/lvgl/switch/__init__.py +8 -13
  87. esphome/components/lvgl/text/__init__.py +5 -6
  88. esphome/components/lvgl/text_sensor/__init__.py +15 -15
  89. esphome/components/lvgl/touchscreens.py +2 -3
  90. esphome/components/lvgl/trigger.py +7 -9
  91. esphome/components/lvgl/types.py +9 -3
  92. esphome/components/lvgl/widgets/__init__.py +32 -21
  93. esphome/components/lvgl/widgets/dropdown.py +22 -10
  94. esphome/components/lvgl/widgets/msgbox.py +6 -5
  95. esphome/components/lvgl/widgets/obj.py +4 -2
  96. esphome/components/lvgl/widgets/page.py +3 -2
  97. esphome/components/lvgl/widgets/qrcode.py +54 -0
  98. esphome/components/lvgl/widgets/roller.py +21 -14
  99. esphome/components/lvgl/widgets/tileview.py +2 -1
  100. esphome/components/max17043/__init__.py +1 -0
  101. esphome/components/max17043/automation.h +20 -0
  102. esphome/components/max17043/max17043.cpp +98 -0
  103. esphome/components/max17043/max17043.h +29 -0
  104. esphome/components/max17043/sensor.py +77 -0
  105. esphome/components/media_player/__init__.py +11 -0
  106. esphome/components/media_player/automation.h +10 -0
  107. esphome/components/media_player/media_player.cpp +4 -0
  108. esphome/components/midea/air_conditioner.cpp +17 -1
  109. esphome/components/mlx90393/sensor.py +1 -1
  110. esphome/components/modbus_controller/__init__.py +31 -1
  111. esphome/components/modbus_controller/automation.h +16 -0
  112. esphome/components/modbus_controller/const.py +2 -0
  113. esphome/components/modbus_controller/modbus_controller.cpp +14 -2
  114. esphome/components/modbus_controller/modbus_controller.h +9 -0
  115. esphome/components/mopeka_pro_check/mopeka_pro_check.cpp +40 -21
  116. esphome/components/mopeka_pro_check/mopeka_pro_check.h +9 -2
  117. esphome/components/mopeka_pro_check/sensor.py +41 -0
  118. esphome/components/mqtt/__init__.py +36 -0
  119. esphome/components/mqtt/mqtt_client.cpp +27 -3
  120. esphome/components/mqtt/mqtt_client.h +27 -2
  121. esphome/components/mqtt/mqtt_climate.cpp +4 -2
  122. esphome/components/mqtt/mqtt_component.cpp +6 -0
  123. esphome/components/mqtt/mqtt_component.h +4 -0
  124. esphome/components/mqtt/mqtt_const.h +6 -0
  125. esphome/components/online_image/online_image.cpp +2 -8
  126. esphome/components/online_image/online_image.h +2 -6
  127. esphome/components/opentherm/__init__.py +35 -9
  128. esphome/components/opentherm/binary_sensor/__init__.py +33 -0
  129. esphome/components/opentherm/const.py +11 -0
  130. esphome/components/opentherm/generate.py +142 -0
  131. esphome/components/opentherm/hub.cpp +130 -24
  132. esphome/components/opentherm/hub.h +62 -9
  133. esphome/components/opentherm/input.h +18 -0
  134. esphome/components/opentherm/input.py +51 -0
  135. esphome/components/opentherm/number/__init__.py +74 -0
  136. esphome/components/opentherm/number/number.cpp +40 -0
  137. esphome/components/opentherm/number/number.h +31 -0
  138. esphome/components/opentherm/opentherm.cpp +30 -0
  139. esphome/components/opentherm/opentherm.h +34 -2
  140. esphome/components/opentherm/opentherm_macros.h +151 -0
  141. esphome/components/opentherm/output/__init__.py +47 -0
  142. esphome/components/opentherm/output/output.cpp +18 -0
  143. esphome/components/opentherm/output/output.h +33 -0
  144. esphome/components/opentherm/schema.py +814 -0
  145. esphome/components/opentherm/sensor/__init__.py +51 -0
  146. esphome/components/opentherm/switch/__init__.py +43 -0
  147. esphome/components/opentherm/switch/switch.cpp +28 -0
  148. esphome/components/opentherm/switch/switch.h +20 -0
  149. esphome/components/opentherm/validate.py +31 -0
  150. esphome/components/pcd8544/display.py +8 -4
  151. esphome/components/prometheus/prometheus_handler.cpp +176 -14
  152. esphome/components/prometheus/prometheus_handler.h +25 -7
  153. esphome/components/qspi_amoled/display.py +1 -141
  154. esphome/components/qspi_dbi/display.py +185 -0
  155. esphome/components/qspi_dbi/models.py +64 -0
  156. esphome/components/{qspi_amoled/qspi_amoled.cpp → qspi_dbi/qspi_dbi.cpp} +95 -46
  157. esphome/components/{qspi_amoled/qspi_amoled.h → qspi_dbi/qspi_dbi.h} +26 -15
  158. esphome/components/rp2040/__init__.py +6 -3
  159. esphome/components/rp2040/gpio.py +5 -3
  160. esphome/components/rtttl/rtttl.cpp +4 -1
  161. esphome/components/rtttl/rtttl.h +1 -0
  162. esphome/components/sdl/sdl_esphome.cpp +22 -5
  163. esphome/components/sdl/sdl_esphome.h +1 -0
  164. esphome/components/sensor/__init__.py +18 -8
  165. esphome/components/sensor/filter.cpp +19 -18
  166. esphome/components/sensor/filter.h +9 -10
  167. esphome/components/sgp4x/sgp4x.cpp +40 -74
  168. esphome/components/sgp4x/sgp4x.h +5 -3
  169. esphome/components/speaker/__init__.py +51 -5
  170. esphome/components/speaker/automation.h +25 -0
  171. esphome/components/speaker/speaker.h +72 -1
  172. esphome/components/spi/__init__.py +15 -14
  173. esphome/components/spi_device/__init__.py +4 -15
  174. esphome/components/ssd1306_spi/display.py +6 -2
  175. esphome/components/ssd1322_spi/display.py +6 -2
  176. esphome/components/ssd1325_spi/display.py +6 -2
  177. esphome/components/ssd1327_spi/display.py +6 -2
  178. esphome/components/ssd1331_spi/display.py +6 -2
  179. esphome/components/ssd1351_spi/display.py +6 -2
  180. esphome/components/st7567_spi/display.py +6 -2
  181. esphome/components/st7701s/display.py +5 -1
  182. esphome/components/st7735/display.py +10 -5
  183. esphome/components/st7789v/display.py +12 -7
  184. esphome/components/statsd/statsd.cpp +2 -0
  185. esphome/components/statsd/statsd.h +2 -0
  186. esphome/components/sun/sun.h +3 -0
  187. esphome/components/tc74/__init__.py +1 -0
  188. esphome/components/tc74/sensor.py +32 -0
  189. esphome/components/tc74/tc74.cpp +68 -0
  190. esphome/components/tc74/tc74.h +28 -0
  191. esphome/components/touchscreen/__init__.py +41 -50
  192. esphome/components/touchscreen/touchscreen.h +4 -8
  193. esphome/components/udp/udp_component.cpp +6 -3
  194. esphome/components/udp/udp_component.h +4 -2
  195. esphome/components/waveshare_epaper/display.py +6 -2
  196. esphome/components/web_server/web_server.cpp +22 -0
  197. esphome/components/web_server/web_server.h +3 -0
  198. esphome/components/weikai/weikai.h +2 -2
  199. esphome/components/wifi/wifi_component.cpp +2 -2
  200. esphome/components/wifi/wifi_component_esp32_arduino.cpp +4 -4
  201. esphome/components/wifi/wifi_component_esp8266.cpp +4 -4
  202. esphome/components/wifi/wifi_component_esp_idf.cpp +2 -2
  203. esphome/components/xpt2046/touchscreen/__init__.py +7 -32
  204. esphome/config_validation.py +3 -1
  205. esphome/const.py +8 -1
  206. esphome/core/defines.h +8 -2
  207. esphome/core/helpers.cpp +32 -17
  208. esphome/core/helpers.h +32 -16
  209. esphome/core/ring_buffer.cpp +2 -2
  210. esphome/core/ring_buffer.h +2 -2
  211. esphome/dashboard/core.py +25 -0
  212. esphome/dashboard/status/mdns.py +3 -4
  213. esphome/dashboard/web_server.py +54 -19
  214. esphome/espota2.py +36 -35
  215. esphome/helpers.py +68 -16
  216. esphome/mqtt.py +9 -2
  217. esphome/storage_json.py +4 -0
  218. esphome/writer.py +7 -18
  219. esphome/zeroconf.py +8 -6
  220. {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/METADATA +7 -5
  221. {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/RECORD +226 -180
  222. esphome/core/bytebuffer.cpp +0 -167
  223. esphome/core/bytebuffer.h +0 -144
  224. /esphome/components/{qspi_amoled → qspi_dbi}/__init__.py +0 -0
  225. {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/LICENSE +0 -0
  226. {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/WHEEL +0 -0
  227. {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/entry_points.txt +0 -0
  228. {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/top_level.txt +0 -0
@@ -103,6 +103,173 @@ ESP32_BOARD_PINS = {
103
103
  "LED": 13,
104
104
  "LED_BUILTIN": 13,
105
105
  },
106
+ "adafruit_feather_esp32s3": {
107
+ "BUTTON": 0,
108
+ "A0": 18,
109
+ "A1": 17,
110
+ "A2": 16,
111
+ "A3": 15,
112
+ "A4": 14,
113
+ "A5": 8,
114
+ "SCK": 36,
115
+ "MOSI": 35,
116
+ "MISO": 37,
117
+ "RX": 38,
118
+ "TX": 39,
119
+ "SCL": 4,
120
+ "SDA": 3,
121
+ "NEOPIXEL": 33,
122
+ "PIN_NEOPIXEL": 33,
123
+ "NEOPIXEL_POWER": 21,
124
+ "I2C_POWER": 7,
125
+ "LED": 13,
126
+ "LED_BUILTIN": 13,
127
+ },
128
+ "adafruit_feather_esp32s3_nopsram": {
129
+ "BUTTON": 0,
130
+ "A0": 18,
131
+ "A1": 17,
132
+ "A2": 16,
133
+ "A3": 15,
134
+ "A4": 14,
135
+ "A5": 8,
136
+ "SCK": 36,
137
+ "MOSI": 35,
138
+ "MISO": 37,
139
+ "RX": 38,
140
+ "TX": 39,
141
+ "SCL": 4,
142
+ "SDA": 3,
143
+ "NEOPIXEL": 33,
144
+ "PIN_NEOPIXEL": 33,
145
+ "NEOPIXEL_POWER": 21,
146
+ "I2C_POWER": 7,
147
+ "LED": 13,
148
+ "LED_BUILTIN": 13,
149
+ },
150
+ "adafruit_feather_esp32s3_tft": {
151
+ "BUTTON": 0,
152
+ "A0": 18,
153
+ "A1": 17,
154
+ "A2": 16,
155
+ "A3": 15,
156
+ "A4": 14,
157
+ "A5": 8,
158
+ "SCK": 36,
159
+ "MOSI": 35,
160
+ "MISO": 37,
161
+ "RX": 2,
162
+ "TX": 1,
163
+ "SCL": 41,
164
+ "SDA": 42,
165
+ "NEOPIXEL": 33,
166
+ "PIN_NEOPIXEL": 33,
167
+ "NEOPIXEL_POWER": 34,
168
+ "TFT_I2C_POWER": 21,
169
+ "TFT_CS": 7,
170
+ "TFT_DC": 39,
171
+ "TFT_RESET": 40,
172
+ "TFT_BACKLIGHT": 45,
173
+ "LED": 13,
174
+ "LED_BUILTIN": 13,
175
+ },
176
+ "adafruit_funhouse_esp32s2": {
177
+ "BUTTON_UP": 5,
178
+ "BUTTON_DOWN": 3,
179
+ "BUTTON_SELECT": 4,
180
+ "DOTSTAR_DATA": 14,
181
+ "DOTSTAR_CLOCK": 15,
182
+ "PIR_SENSE": 16,
183
+ "A0": 17,
184
+ "A1": 2,
185
+ "A2": 1,
186
+ "CAP6": 6,
187
+ "CAP7": 7,
188
+ "CAP8": 8,
189
+ "CAP9": 9,
190
+ "CAP10": 10,
191
+ "CAP11": 11,
192
+ "CAP12": 12,
193
+ "CAP13": 13,
194
+ "SPEAKER": 42,
195
+ "LED": 37,
196
+ "LIGHT": 18,
197
+ "TFT_MOSI": 35,
198
+ "TFT_SCK": 36,
199
+ "TFT_CS": 40,
200
+ "TFT_DC": 39,
201
+ "TFT_RESET": 41,
202
+ "TFT_BACKLIGHT": 21,
203
+ "RED_LED": 31,
204
+ "BUTTON": 0,
205
+ },
206
+ "adafruit_itsybitsy_esp32": {
207
+ "A0": 25,
208
+ "A1": 26,
209
+ "A2": 4,
210
+ "A3": 38,
211
+ "A4": 37,
212
+ "A5": 36,
213
+ "SCK": 19,
214
+ "MOSI": 21,
215
+ "MISO": 22,
216
+ "SCL": 27,
217
+ "SDA": 15,
218
+ "TX": 20,
219
+ "RX": 8,
220
+ "NEOPIXEL": 0,
221
+ "PIN_NEOPIXEL": 0,
222
+ "NEOPIXEL_POWER": 2,
223
+ "BUTTON": 35,
224
+ },
225
+ "adafruit_magtag29_esp32s2": {
226
+ "A1": 18,
227
+ "BUTTON_A": 15,
228
+ "BUTTON_B": 14,
229
+ "BUTTON_C": 12,
230
+ "BUTTON_D": 11,
231
+ "SDA": 33,
232
+ "SCL": 34,
233
+ "SPEAKER": 17,
234
+ "SPEAKER_ENABLE": 16,
235
+ "VOLTAGE_MONITOR": 4,
236
+ "ACCELEROMETER_INT": 9,
237
+ "ACCELEROMETER_INTERRUPT": 9,
238
+ "LIGHT": 3,
239
+ "NEOPIXEL": 1,
240
+ "PIN_NEOPIXEL": 1,
241
+ "NEOPIXEL_POWER": 21,
242
+ "EPD_BUSY": 5,
243
+ "EPD_RESET": 6,
244
+ "EPD_DC": 7,
245
+ "EPD_CS": 8,
246
+ "EPD_MOSI": 35,
247
+ "EPD_SCK": 36,
248
+ "EPD_MISO": 37,
249
+ "BUTTON": 0,
250
+ "LED": 13,
251
+ "LED_BUILTIN": 13,
252
+ },
253
+ "adafruit_metro_esp32s2": {
254
+ "A0": 17,
255
+ "A1": 18,
256
+ "A2": 1,
257
+ "A3": 2,
258
+ "A4": 3,
259
+ "A5": 4,
260
+ "RX": 38,
261
+ "TX": 37,
262
+ "SCL": 34,
263
+ "SDA": 33,
264
+ "MISO": 37,
265
+ "SCK": 36,
266
+ "MOSI": 35,
267
+ "NEOPIXEL": 45,
268
+ "PIN_NEOPIXEL": 45,
269
+ "LED": 42,
270
+ "LED_BUILTIN": 42,
271
+ "BUTTON": 0,
272
+ },
106
273
  "adafruit_qtpy_esp32c3": {
107
274
  "A0": 4,
108
275
  "A1": 3,
@@ -141,6 +308,26 @@ ESP32_BOARD_PINS = {
141
308
  "BUTTON": 0,
142
309
  "SWITCH": 0,
143
310
  },
311
+ "adafruit_qtpy_esp32s3_nopsram": {
312
+ "A0": 18,
313
+ "A1": 17,
314
+ "A2": 9,
315
+ "A3": 8,
316
+ "SDA": 7,
317
+ "SCL": 6,
318
+ "MOSI": 35,
319
+ "MISO": 37,
320
+ "SCK": 36,
321
+ "RX": 16,
322
+ "TX": 5,
323
+ "SDA1": 41,
324
+ "SCL1": 40,
325
+ "NEOPIXEL": 39,
326
+ "PIN_NEOPIXEL": 39,
327
+ "NEOPIXEL_POWER": 38,
328
+ "BUTTON": 0,
329
+ "SWITCH": 0,
330
+ },
144
331
  "adafruit_qtpy_esp32": {
145
332
  "A0": 26,
146
333
  "A1": 25,
@@ -1068,7 +1255,18 @@ ESP32_BOARD_PINS = {
1068
1255
  "_VBAT": 35,
1069
1256
  },
1070
1257
  "wemosbat": {"LED": 16},
1071
- "wesp32": {"MISO": 32, "SCL": 4, "SDA": 15},
1258
+ "wesp32": {
1259
+ "MISO": 32,
1260
+ "MOSI": 23,
1261
+ "SCK": 18,
1262
+ "SCL": 4,
1263
+ "SDA": 15,
1264
+ "MISO1": 12,
1265
+ "MOSI1": 13,
1266
+ "SCK1": 14,
1267
+ "SCL1": 5,
1268
+ "SDA1": 33,
1269
+ },
1072
1270
  "widora-air": {
1073
1271
  "A1": 39,
1074
1272
  "A2": 35,
@@ -67,8 +67,10 @@ def _translate_pin(value):
67
67
  "This variable only supports pin numbers, not full pin schemas "
68
68
  "(with inverted and mode)."
69
69
  )
70
- if isinstance(value, int):
70
+ if isinstance(value, int) and not isinstance(value, bool):
71
71
  return value
72
+ if not isinstance(value, str):
73
+ raise cv.Invalid(f"Invalid pin number: {value}")
72
74
  try:
73
75
  return int(value)
74
76
  except ValueError:
@@ -40,6 +40,9 @@ static const esp_bt_controller_config_t BT_CONTROLLER_CONFIG = {
40
40
  .controller_run_cpu = 0,
41
41
  .enable_qa_test = RUN_QA_TEST,
42
42
  .enable_bqb_test = RUN_BQB_TEST,
43
+ #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 1)
44
+ // The following fields have been removed since ESP IDF version 5.3.1, see commit:
45
+ // https://github.com/espressif/esp-idf/commit/e761c1de8f9c0777829d597b4d5a33bb070a30a8
43
46
  .enable_uart_hci = HCI_UART_EN,
44
47
  .ble_hci_uart_port = DEFAULT_BT_LE_HCI_UART_PORT,
45
48
  .ble_hci_uart_baud = DEFAULT_BT_LE_HCI_UART_BAUD,
@@ -47,6 +50,7 @@ static const esp_bt_controller_config_t BT_CONTROLLER_CONFIG = {
47
50
  .ble_hci_uart_stop_bits = DEFAULT_BT_LE_HCI_UART_STOP_BITS,
48
51
  .ble_hci_uart_flow_ctrl = DEFAULT_BT_LE_HCI_UART_FLOW_CTRL,
49
52
  .ble_hci_uart_uart_parity = DEFAULT_BT_LE_HCI_UART_PARITY,
53
+ #endif
50
54
  .enable_tx_cca = DEFAULT_BT_LE_TX_CCA_ENABLED,
51
55
  .cca_rssi_thresh = 256 - DEFAULT_BT_LE_CCA_RSSI_THRESH,
52
56
  .sleep_en = NIMBLE_SLEEP_ENABLE,
@@ -58,6 +62,9 @@ static const esp_bt_controller_config_t BT_CONTROLLER_CONFIG = {
58
62
  .cpu_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ,
59
63
  .ignore_wl_for_direct_adv = 0,
60
64
  .enable_pcl = DEFAULT_BT_LE_POWER_CONTROL_ENABLED,
65
+ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 3)
66
+ .csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT,
67
+ #endif
61
68
  .config_magic = CONFIG_MAGIC,
62
69
  };
63
70
 
@@ -35,7 +35,7 @@ class BLEClientBase : public espbt::ESPBTClient, public Component {
35
35
  void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) override;
36
36
  void connect() override;
37
37
  esp_err_t pair();
38
- void disconnect();
38
+ void disconnect() override;
39
39
  void release_services();
40
40
 
41
41
  bool connected() { return this->state_ == espbt::ClientState::ESTABLISHED; }
@@ -11,9 +11,9 @@
11
11
 
12
12
  #ifdef USE_ESP32
13
13
 
14
+ #include <esp_bt_defs.h>
14
15
  #include <esp_gap_ble_api.h>
15
16
  #include <esp_gattc_api.h>
16
- #include <esp_bt_defs.h>
17
17
 
18
18
  #include <freertos/FreeRTOS.h>
19
19
  #include <freertos/semphr.h>
@@ -172,6 +172,7 @@ class ESPBTClient : public ESPBTDeviceListener {
172
172
  esp_ble_gattc_cb_param_t *param) = 0;
173
173
  virtual void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) = 0;
174
174
  virtual void connect() = 0;
175
+ virtual void disconnect() = 0;
175
176
  virtual void set_state(ClientState st) { this->state_ = st; }
176
177
  ClientState state() const { return state_; }
177
178
  int app_id;
@@ -22,7 +22,7 @@ void ESP32RMTLEDStripLightOutput::setup() {
22
22
 
23
23
  size_t buffer_size = this->get_buffer_size_();
24
24
 
25
- ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
25
+ RAMAllocator<uint8_t> allocator(this->use_psram_ ? 0 : RAMAllocator<uint8_t>::ALLOC_INTERNAL);
26
26
  this->buf_ = allocator.allocate(buffer_size);
27
27
  if (this->buf_ == nullptr) {
28
28
  ESP_LOGE(TAG, "Cannot allocate LED buffer!");
@@ -37,7 +37,7 @@ void ESP32RMTLEDStripLightOutput::setup() {
37
37
  return;
38
38
  }
39
39
 
40
- ExternalRAMAllocator<rmt_item32_t> rmt_allocator(ExternalRAMAllocator<rmt_item32_t>::ALLOW_FAILURE);
40
+ RAMAllocator<rmt_item32_t> rmt_allocator(this->use_psram_ ? 0 : RAMAllocator<rmt_item32_t>::ALLOC_INTERNAL);
41
41
  this->rmt_buf_ = rmt_allocator.allocate(buffer_size * 8 +
42
42
  1); // 8 bits per byte, 1 rmt_item32_t per bit + 1 rmt_item32_t for reset
43
43
 
@@ -45,6 +45,7 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
45
45
  void set_num_leds(uint16_t num_leds) { this->num_leds_ = num_leds; }
46
46
  void set_is_rgbw(bool is_rgbw) { this->is_rgbw_ = is_rgbw; }
47
47
  void set_is_wrgb(bool is_wrgb) { this->is_wrgb_ = is_wrgb; }
48
+ void set_use_psram(bool use_psram) { this->use_psram_ = use_psram; }
48
49
 
49
50
  /// Set a maximum refresh rate in µs as some lights do not like being updated too often.
50
51
  void set_max_refresh_rate(uint32_t interval_us) { this->max_refresh_rate_ = interval_us; }
@@ -75,6 +76,7 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
75
76
  uint16_t num_leds_;
76
77
  bool is_rgbw_;
77
78
  bool is_wrgb_;
79
+ bool use_psram_;
78
80
 
79
81
  rmt_item32_t bit0_, bit1_, reset_;
80
82
  RGBOrder rgb_order_;
@@ -55,7 +55,7 @@ CHIPSETS = {
55
55
  "SM16703": LEDStripTimings(300, 900, 900, 300, 0, 0),
56
56
  }
57
57
 
58
-
58
+ CONF_USE_PSRAM = "use_psram"
59
59
  CONF_IS_WRGB = "is_wrgb"
60
60
  CONF_BIT0_HIGH = "bit0_high"
61
61
  CONF_BIT0_LOW = "bit0_low"
@@ -77,6 +77,7 @@ CONFIG_SCHEMA = cv.All(
77
77
  cv.Optional(CONF_CHIPSET): cv.one_of(*CHIPSETS, upper=True),
78
78
  cv.Optional(CONF_IS_RGBW, default=False): cv.boolean,
79
79
  cv.Optional(CONF_IS_WRGB, default=False): cv.boolean,
80
+ cv.Optional(CONF_USE_PSRAM, default=True): cv.boolean,
80
81
  cv.Inclusive(
81
82
  CONF_BIT0_HIGH,
82
83
  "custom",
@@ -145,6 +146,7 @@ async def to_code(config):
145
146
  cg.add(var.set_rgb_order(config[CONF_RGB_ORDER]))
146
147
  cg.add(var.set_is_rgbw(config[CONF_IS_RGBW]))
147
148
  cg.add(var.set_is_wrgb(config[CONF_IS_WRGB]))
149
+ cg.add(var.set_use_psram(config[CONF_USE_PSRAM]))
148
150
 
149
151
  cg.add(
150
152
  var.set_rmt_channel(
@@ -1,6 +1,9 @@
1
- import logging
2
1
  from dataclasses import dataclass
2
+ import logging
3
3
 
4
+ from esphome import pins
5
+ import esphome.codegen as cg
6
+ import esphome.config_validation as cv
4
7
  from esphome.const import (
5
8
  CONF_ANALOG,
6
9
  CONF_ID,
@@ -14,10 +17,7 @@ from esphome.const import (
14
17
  CONF_PULLUP,
15
18
  PLATFORM_ESP8266,
16
19
  )
17
- from esphome import pins
18
20
  from esphome.core import CORE, coroutine_with_priority
19
- import esphome.config_validation as cv
20
- import esphome.codegen as cg
21
21
 
22
22
  from . import boards
23
23
  from .const import KEY_BOARD, KEY_ESP8266, KEY_PIN_INITIAL_STATES, esp8266_ns
@@ -48,8 +48,10 @@ def _translate_pin(value):
48
48
  "This variable only supports pin numbers, not full pin schemas "
49
49
  "(with inverted and mode)."
50
50
  )
51
- if isinstance(value, int):
51
+ if isinstance(value, int) and not isinstance(value, bool):
52
52
  return value
53
+ if not isinstance(value, str):
54
+ raise cv.Invalid(f"Invalid pin number: {value}")
53
55
  try:
54
56
  return int(value)
55
57
  except ValueError:
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  from esphome import pins
2
3
  import esphome.codegen as cg
3
4
  from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant
@@ -23,6 +24,7 @@ from esphome.const import (
23
24
  CONF_MISO_PIN,
24
25
  CONF_MOSI_PIN,
25
26
  CONF_PAGE_ID,
27
+ CONF_POLLING_INTERVAL,
26
28
  CONF_RESET_PIN,
27
29
  CONF_SPI,
28
30
  CONF_STATIC_IP,
@@ -30,13 +32,16 @@ from esphome.const import (
30
32
  CONF_TYPE,
31
33
  CONF_USE_ADDRESS,
32
34
  CONF_VALUE,
35
+ KEY_CORE,
36
+ KEY_FRAMEWORK_VERSION,
33
37
  )
34
- from esphome.core import CORE, coroutine_with_priority
38
+ from esphome.core import CORE, TimePeriodMilliseconds, coroutine_with_priority
35
39
  import esphome.final_validate as fv
36
40
 
37
41
  CONFLICTS_WITH = ["wifi"]
38
42
  DEPENDENCIES = ["esp32"]
39
43
  AUTO_LOAD = ["network"]
44
+ LOGGER = logging.getLogger(__name__)
40
45
 
41
46
  ethernet_ns = cg.esphome_ns.namespace("ethernet")
42
47
  PHYRegister = ethernet_ns.struct("PHYRegister")
@@ -63,6 +68,7 @@ ETHERNET_TYPES = {
63
68
  }
64
69
 
65
70
  SPI_ETHERNET_TYPES = ["W5500"]
71
+ SPI_ETHERNET_DEFAULT_POLLING_INTERVAL = TimePeriodMilliseconds(milliseconds=10)
66
72
 
67
73
  emac_rmii_clock_mode_t = cg.global_ns.enum("emac_rmii_clock_mode_t")
68
74
  emac_rmii_clock_gpio_t = cg.global_ns.enum("emac_rmii_clock_gpio_t")
@@ -100,6 +106,24 @@ EthernetComponent = ethernet_ns.class_("EthernetComponent", cg.Component)
100
106
  ManualIP = ethernet_ns.struct("ManualIP")
101
107
 
102
108
 
109
+ def _is_framework_spi_polling_mode_supported():
110
+ # SPI Ethernet without IRQ feature is added in
111
+ # esp-idf >= (5.3+ ,5.2.1+, 5.1.4) and arduino-esp32 >= 3.0.0
112
+ framework_version = CORE.data[KEY_CORE][KEY_FRAMEWORK_VERSION]
113
+ if CORE.using_esp_idf:
114
+ if framework_version >= cv.Version(5, 3, 0):
115
+ return True
116
+ if cv.Version(5, 3, 0) > framework_version >= cv.Version(5, 2, 1):
117
+ return True
118
+ if cv.Version(5, 2, 0) > framework_version >= cv.Version(5, 1, 4):
119
+ return True
120
+ return False
121
+ if CORE.using_arduino:
122
+ return framework_version >= cv.Version(3, 0, 0)
123
+ # fail safe: Unknown framework
124
+ return False
125
+
126
+
103
127
  def _validate(config):
104
128
  if CONF_USE_ADDRESS not in config:
105
129
  if CONF_MANUAL_IP in config:
@@ -107,6 +131,27 @@ def _validate(config):
107
131
  else:
108
132
  use_address = CORE.name + config[CONF_DOMAIN]
109
133
  config[CONF_USE_ADDRESS] = use_address
134
+ if config[CONF_TYPE] in SPI_ETHERNET_TYPES:
135
+ if _is_framework_spi_polling_mode_supported():
136
+ if CONF_POLLING_INTERVAL in config and CONF_INTERRUPT_PIN in config:
137
+ raise cv.Invalid(
138
+ f"Cannot specify more than one of {CONF_INTERRUPT_PIN}, {CONF_POLLING_INTERVAL}"
139
+ )
140
+ if CONF_POLLING_INTERVAL not in config and CONF_INTERRUPT_PIN not in config:
141
+ config[CONF_POLLING_INTERVAL] = SPI_ETHERNET_DEFAULT_POLLING_INTERVAL
142
+ else:
143
+ if CONF_POLLING_INTERVAL in config:
144
+ raise cv.Invalid(
145
+ "In this version of the framework "
146
+ f"({CORE.target_framework} {CORE.data[KEY_CORE][KEY_FRAMEWORK_VERSION]}), "
147
+ f"'{CONF_POLLING_INTERVAL}' is not supported."
148
+ )
149
+ if CONF_INTERRUPT_PIN not in config:
150
+ raise cv.Invalid(
151
+ "In this version of the framework "
152
+ f"({CORE.target_framework} {CORE.data[KEY_CORE][KEY_FRAMEWORK_VERSION]}), "
153
+ f"'{CONF_INTERRUPT_PIN}' is a required option for [ethernet]."
154
+ )
110
155
  return config
111
156
 
112
157
 
@@ -157,6 +202,11 @@ SPI_SCHEMA = BASE_SCHEMA.extend(
157
202
  cv.Optional(CONF_CLOCK_SPEED, default="26.67MHz"): cv.All(
158
203
  cv.frequency, cv.int_range(int(8e6), int(80e6))
159
204
  ),
205
+ # Set default value (SPI_ETHERNET_DEFAULT_POLLING_INTERVAL) at _validate()
206
+ cv.Optional(CONF_POLLING_INTERVAL): cv.All(
207
+ cv.positive_time_period_milliseconds,
208
+ cv.Range(min=TimePeriodMilliseconds(milliseconds=1)),
209
+ ),
160
210
  }
161
211
  ),
162
212
  )
@@ -234,6 +284,10 @@ async def to_code(config):
234
284
  cg.add(var.set_cs_pin(config[CONF_CS_PIN]))
235
285
  if CONF_INTERRUPT_PIN in config:
236
286
  cg.add(var.set_interrupt_pin(config[CONF_INTERRUPT_PIN]))
287
+ else:
288
+ cg.add(var.set_polling_interval(config[CONF_POLLING_INTERVAL]))
289
+ if _is_framework_spi_polling_mode_supported():
290
+ cg.add_define("USE_ETHERNET_SPI_POLLING_SUPPORT")
237
291
  if CONF_RESET_PIN in config:
238
292
  cg.add(var.set_reset_pin(config[CONF_RESET_PIN]))
239
293
  cg.add(var.set_clock_speed(config[CONF_CLOCK_SPEED]))
@@ -116,6 +116,9 @@ void EthernetComponent::setup() {
116
116
  eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(spi_handle);
117
117
  #endif
118
118
  w5500_config.int_gpio_num = this->interrupt_pin_;
119
+ #ifdef USE_ETHERNET_SPI_POLLING_SUPPORT
120
+ w5500_config.poll_period_ms = this->polling_interval_;
121
+ #endif
119
122
  phy_config.phy_addr = this->phy_addr_spi_;
120
123
  phy_config.reset_gpio_num = this->reset_pin_;
121
124
 
@@ -327,7 +330,14 @@ void EthernetComponent::dump_config() {
327
330
  ESP_LOGCONFIG(TAG, " MISO Pin: %u", this->miso_pin_);
328
331
  ESP_LOGCONFIG(TAG, " MOSI Pin: %u", this->mosi_pin_);
329
332
  ESP_LOGCONFIG(TAG, " CS Pin: %u", this->cs_pin_);
330
- ESP_LOGCONFIG(TAG, " IRQ Pin: %u", this->interrupt_pin_);
333
+ #ifdef USE_ETHERNET_SPI_POLLING_SUPPORT
334
+ if (this->polling_interval_ != 0) {
335
+ ESP_LOGCONFIG(TAG, " Polling Interval: %lu ms", this->polling_interval_);
336
+ } else
337
+ #endif
338
+ {
339
+ ESP_LOGCONFIG(TAG, " IRQ Pin: %d", this->interrupt_pin_);
340
+ }
331
341
  ESP_LOGCONFIG(TAG, " Reset Pin: %d", this->reset_pin_);
332
342
  ESP_LOGCONFIG(TAG, " Clock Speed: %d MHz", this->clock_speed_ / 1000000);
333
343
  #else
@@ -536,6 +546,9 @@ void EthernetComponent::set_cs_pin(uint8_t cs_pin) { this->cs_pin_ = cs_pin; }
536
546
  void EthernetComponent::set_interrupt_pin(uint8_t interrupt_pin) { this->interrupt_pin_ = interrupt_pin; }
537
547
  void EthernetComponent::set_reset_pin(uint8_t reset_pin) { this->reset_pin_ = reset_pin; }
538
548
  void EthernetComponent::set_clock_speed(int clock_speed) { this->clock_speed_ = clock_speed; }
549
+ #ifdef USE_ETHERNET_SPI_POLLING_SUPPORT
550
+ void EthernetComponent::set_polling_interval(uint32_t polling_interval) { this->polling_interval_ = polling_interval; }
551
+ #endif
539
552
  #else
540
553
  void EthernetComponent::set_phy_addr(uint8_t phy_addr) { this->phy_addr_ = phy_addr; }
541
554
  void EthernetComponent::set_power_pin(int power_pin) { this->power_pin_ = power_pin; }
@@ -67,6 +67,9 @@ class EthernetComponent : public Component {
67
67
  void set_interrupt_pin(uint8_t interrupt_pin);
68
68
  void set_reset_pin(uint8_t reset_pin);
69
69
  void set_clock_speed(int clock_speed);
70
+ #ifdef USE_ETHERNET_SPI_POLLING_SUPPORT
71
+ void set_polling_interval(uint32_t polling_interval);
72
+ #endif
70
73
  #else
71
74
  void set_phy_addr(uint8_t phy_addr);
72
75
  void set_power_pin(int power_pin);
@@ -108,10 +111,13 @@ class EthernetComponent : public Component {
108
111
  uint8_t miso_pin_;
109
112
  uint8_t mosi_pin_;
110
113
  uint8_t cs_pin_;
111
- uint8_t interrupt_pin_;
114
+ int interrupt_pin_{-1};
112
115
  int reset_pin_{-1};
113
116
  int phy_addr_spi_{-1};
114
117
  int clock_speed_;
118
+ #ifdef USE_ETHERNET_SPI_POLLING_SUPPORT
119
+ uint32_t polling_interval_{0};
120
+ #endif
115
121
  #else
116
122
  uint8_t phy_addr_{0};
117
123
  int power_pin_{-1};