esphome 2024.12.4__py3-none-any.whl → 2025.2.0b2__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.
- esphome/__main__.py +16 -3
- esphome/components/adc/__init__.py +17 -11
- esphome/components/adc/adc_sensor.h +17 -0
- esphome/components/adc/adc_sensor_common.cpp +55 -0
- esphome/components/adc/adc_sensor_esp32.cpp +8 -5
- esphome/components/adc/adc_sensor_esp8266.cpp +10 -6
- esphome/components/adc/adc_sensor_libretiny.cpp +11 -6
- esphome/components/adc/adc_sensor_rp2040.cpp +13 -10
- esphome/components/adc/sensor.py +9 -3
- esphome/components/ads1115/ads1115.cpp +56 -7
- esphome/components/ads1115/ads1115.h +13 -1
- esphome/components/ads1115/sensor/__init__.py +16 -0
- esphome/components/ads1115/sensor/ads1115_sensor.cpp +2 -1
- esphome/components/ads1115/sensor/ads1115_sensor.h +2 -0
- esphome/components/animation/__init__.py +23 -261
- esphome/components/animation/animation.cpp +2 -2
- esphome/components/animation/animation.h +2 -1
- esphome/components/api/api_pb2.cpp +14 -0
- esphome/components/api/api_pb2.h +1 -0
- esphome/components/audio/__init__.py +112 -0
- esphome/components/audio/audio.cpp +67 -0
- esphome/components/audio/audio.h +125 -7
- esphome/components/audio/audio_decoder.cpp +361 -0
- esphome/components/audio/audio_decoder.h +135 -0
- esphome/components/audio/audio_reader.cpp +308 -0
- esphome/components/audio/audio_reader.h +85 -0
- esphome/components/audio/audio_resampler.cpp +159 -0
- esphome/components/audio/audio_resampler.h +101 -0
- esphome/components/audio/audio_transfer_buffer.cpp +165 -0
- esphome/components/audio/audio_transfer_buffer.h +139 -0
- esphome/components/audio_adc/__init__.py +41 -0
- esphome/components/audio_adc/audio_adc.h +17 -0
- esphome/components/audio_adc/automation.h +23 -0
- esphome/components/bk72xx/__init__.py +1 -0
- esphome/components/ble_client/ble_client.cpp +1 -2
- esphome/components/ble_client/sensor/__init__.py +1 -1
- esphome/components/ble_client/text_sensor/__init__.py +1 -1
- esphome/components/bluetooth_proxy/bluetooth_connection.cpp +5 -0
- esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -0
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
- esphome/components/ch422g/ch422g.h +2 -0
- esphome/components/climate/__init__.py +1 -1
- esphome/components/climate_ir/climate_ir.cpp +2 -1
- esphome/components/coolix/coolix.cpp +2 -1
- esphome/components/cse7766/cse7766.cpp +8 -16
- esphome/components/custom/__init__.py +0 -3
- esphome/components/custom/binary_sensor/__init__.py +2 -28
- esphome/components/custom/climate/__init__.py +2 -27
- esphome/components/custom/cover/__init__.py +2 -27
- esphome/components/custom/light/__init__.py +2 -27
- esphome/components/custom/output/__init__.py +2 -58
- esphome/components/custom/sensor/__init__.py +2 -24
- esphome/components/custom/switch/__init__.py +2 -24
- esphome/components/custom/text_sensor/__init__.py +2 -29
- esphome/components/custom_component/__init__.py +3 -27
- esphome/components/daly_bms/daly_bms.cpp +6 -0
- esphome/components/daly_bms/daly_bms.h +2 -0
- esphome/components/daly_bms/sensor.py +6 -0
- esphome/components/debug/debug_component.cpp +4 -0
- esphome/components/debug/debug_component.h +14 -0
- esphome/components/debug/debug_esp32.cpp +154 -74
- esphome/components/dfplayer/dfplayer.cpp +15 -2
- esphome/components/dfrobot_sen0395/dfrobot_sen0395.cpp +2 -1
- esphome/components/dht/dht.cpp +2 -1
- esphome/components/display/__init__.py +18 -5
- esphome/components/display/display.cpp +2 -1
- esphome/components/display/rect.cpp +2 -1
- esphome/components/es7210/__init__.py +0 -0
- esphome/components/es7210/audio_adc.py +51 -0
- esphome/components/es7210/es7210.cpp +228 -0
- esphome/components/es7210/es7210.h +62 -0
- esphome/components/es7210/es7210_const.h +129 -0
- esphome/components/es7243e/__init__.py +0 -0
- esphome/components/es7243e/audio_adc.py +34 -0
- esphome/components/es7243e/es7243e.cpp +125 -0
- esphome/components/es7243e/es7243e.h +37 -0
- esphome/components/es7243e/es7243e_const.h +54 -0
- esphome/components/es8156/__init__.py +0 -0
- esphome/components/es8156/audio_dac.py +27 -0
- esphome/components/es8156/es8156.cpp +87 -0
- esphome/components/es8156/es8156.h +51 -0
- esphome/components/es8156/es8156_const.h +68 -0
- esphome/components/es8311/audio_dac.py +1 -2
- esphome/components/esp32/__init__.py +1 -0
- esphome/components/esp32/core.cpp +5 -1
- esphome/components/esp32/gpio.h +2 -0
- esphome/components/esp32_ble/__init__.py +39 -0
- esphome/components/esp32_ble/queue.h +4 -4
- esphome/components/esp32_ble_client/ble_client_base.cpp +46 -0
- esphome/components/esp32_ble_client/ble_client_base.h +2 -0
- esphome/components/esp32_ble_server/__init__.py +582 -12
- esphome/components/esp32_ble_server/ble_characteristic.cpp +48 -60
- esphome/components/esp32_ble_server/ble_characteristic.h +24 -17
- esphome/components/esp32_ble_server/ble_descriptor.cpp +21 -9
- esphome/components/esp32_ble_server/ble_descriptor.h +17 -6
- esphome/components/esp32_ble_server/ble_server.cpp +62 -67
- esphome/components/esp32_ble_server/ble_server.h +28 -32
- esphome/components/esp32_ble_server/ble_server_automations.cpp +77 -0
- esphome/components/esp32_ble_server/ble_server_automations.h +115 -0
- esphome/components/esp32_ble_server/ble_service.cpp +17 -15
- esphome/components/esp32_ble_server/ble_service.h +10 -14
- esphome/components/esp32_ble_tracker/__init__.py +6 -39
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +33 -10
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +8 -4
- esphome/components/esp32_improv/__init__.py +2 -8
- esphome/components/esp32_improv/esp32_improv_component.cpp +21 -20
- esphome/components/esp32_improv/esp32_improv_component.h +3 -4
- esphome/components/esp32_rmt/__init__.py +28 -3
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +73 -6
- esphome/components/esp32_rmt_led_strip/led_strip.h +21 -3
- esphome/components/esp32_rmt_led_strip/light.py +72 -7
- esphome/components/esp32_touch/esp32_touch.cpp +5 -0
- esphome/components/esp8266/__init__.py +1 -0
- esphome/components/esp8266/gpio.h +1 -0
- esphome/components/ethernet/__init__.py +10 -10
- esphome/components/event/event.cpp +4 -2
- esphome/components/event/event.h +2 -0
- esphome/components/event_emitter/__init__.py +5 -0
- esphome/components/event_emitter/event_emitter.cpp +14 -0
- esphome/components/event_emitter/event_emitter.h +63 -0
- esphome/components/gcja5/gcja5.cpp +2 -1
- esphome/components/graph/graph.cpp +4 -9
- esphome/components/haier/haier_base.cpp +2 -1
- esphome/components/haier/hon_climate.cpp +2 -1
- esphome/components/heatpumpir/heatpumpir.cpp +2 -1
- esphome/components/host/__init__.py +1 -0
- esphome/components/host/gpio.h +1 -0
- esphome/components/http_request/http_request.h +2 -2
- esphome/components/http_request/http_request_arduino.cpp +1 -1
- esphome/components/http_request/http_request_idf.cpp +1 -1
- esphome/components/i2c/i2c_bus_esp_idf.cpp +4 -0
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +7 -5
- esphome/components/i2s_audio/speaker/__init__.py +53 -6
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +92 -46
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -0
- esphome/components/ili9xxx/display.py +29 -11
- esphome/components/ili9xxx/ili9xxx_display.cpp +2 -5
- esphome/components/ili9xxx/ili9xxx_display.h +2 -1
- esphome/components/image/__init__.py +443 -255
- esphome/components/image/image.cpp +115 -61
- esphome/components/image/image.h +15 -24
- esphome/components/json/json_util.cpp +8 -34
- esphome/components/libretiny/__init__.py +1 -0
- esphome/components/libretiny/gpio_arduino.h +1 -0
- esphome/components/light/light_color_values.h +1 -1
- esphome/components/logger/__init__.py +43 -7
- esphome/components/logger/logger.cpp +16 -11
- esphome/components/logger/logger.h +11 -7
- esphome/components/logger/select/__init__.py +29 -0
- esphome/components/logger/select/logger_level_select.cpp +27 -0
- esphome/components/logger/select/logger_level_select.h +15 -0
- esphome/components/lvgl/__init__.py +96 -73
- esphome/components/lvgl/automation.py +39 -7
- esphome/components/lvgl/defines.py +8 -2
- esphome/components/lvgl/lvgl_esphome.cpp +8 -15
- esphome/components/lvgl/lvgl_esphome.h +20 -5
- esphome/components/lvgl/schemas.py +25 -14
- esphome/components/lvgl/trigger.py +27 -3
- esphome/components/lvgl/widgets/dropdown.py +1 -1
- esphome/components/lvgl/widgets/keyboard.py +8 -1
- esphome/components/lvgl/widgets/meter.py +2 -1
- esphome/components/lvgl/widgets/msgbox.py +1 -1
- esphome/components/lvgl/widgets/obj.py +1 -12
- esphome/components/lvgl/widgets/page.py +37 -2
- esphome/components/lvgl/widgets/tabview.py +1 -1
- esphome/components/max6956/max6956.h +2 -0
- esphome/components/mcp23016/mcp23016.h +2 -0
- esphome/components/mcp23xxx_base/mcp23xxx_base.h +2 -0
- esphome/components/mdns/__init__.py +1 -1
- esphome/components/media_player/__init__.py +37 -8
- esphome/components/media_player/automation.h +11 -2
- esphome/components/media_player/media_player.cpp +8 -0
- esphome/components/media_player/media_player.h +8 -4
- esphome/components/micronova/switch/micronova_switch.cpp +4 -2
- esphome/components/midea/ac_automations.h +3 -1
- esphome/components/midea/air_conditioner.cpp +7 -5
- esphome/components/midea/air_conditioner.h +1 -1
- esphome/components/midea/climate.py +4 -2
- esphome/components/midea/ir_transmitter.h +36 -5
- esphome/components/mixer/__init__.py +0 -0
- esphome/components/mixer/speaker/__init__.py +172 -0
- esphome/components/mixer/speaker/automation.h +19 -0
- esphome/components/mixer/speaker/mixer_speaker.cpp +624 -0
- esphome/components/mixer/speaker/mixer_speaker.h +207 -0
- esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp +7 -13
- esphome/components/mpr121/mpr121.h +2 -0
- esphome/components/mqtt/__init__.py +1 -1
- esphome/components/mqtt/mqtt_client.cpp +7 -1
- esphome/components/mqtt/mqtt_client.h +1 -1
- esphome/components/mqtt/mqtt_climate.cpp +2 -2
- esphome/components/network/ip_address.h +2 -0
- esphome/components/nextion/automation.h +17 -0
- esphome/components/nextion/display.py +42 -17
- esphome/components/nextion/nextion.cpp +4 -10
- esphome/components/nextion/nextion.h +89 -82
- esphome/components/nextion/nextion_commands.cpp +10 -10
- esphome/components/ntc/sensor.py +2 -4
- esphome/components/online_image/__init__.py +98 -46
- esphome/components/online_image/bmp_image.cpp +101 -0
- esphome/components/online_image/bmp_image.h +40 -0
- esphome/components/online_image/image_decoder.cpp +28 -2
- esphome/components/online_image/image_decoder.h +24 -15
- esphome/components/online_image/jpeg_image.cpp +90 -0
- esphome/components/online_image/jpeg_image.h +34 -0
- esphome/components/online_image/online_image.cpp +112 -53
- esphome/components/online_image/online_image.h +24 -7
- esphome/components/online_image/png_image.cpp +7 -3
- esphome/components/online_image/png_image.h +2 -1
- esphome/components/opentherm/__init__.py +73 -7
- esphome/components/opentherm/automation.h +25 -0
- esphome/components/opentherm/const.py +1 -0
- esphome/components/opentherm/generate.py +39 -6
- esphome/components/opentherm/hub.cpp +117 -79
- esphome/components/opentherm/hub.h +31 -15
- esphome/components/opentherm/opentherm.cpp +47 -23
- esphome/components/opentherm/opentherm.h +27 -6
- esphome/components/opentherm/opentherm_macros.h +11 -0
- esphome/components/opentherm/schema.py +78 -1
- esphome/components/opentherm/validate.py +7 -2
- esphome/components/pca6416a/pca6416a.h +2 -0
- esphome/components/pca9554/pca9554.h +2 -0
- esphome/components/pcf8574/pcf8574.h +2 -0
- esphome/components/preferences/__init__.py +2 -4
- esphome/components/preferences/syncer.h +10 -3
- esphome/components/prometheus/prometheus_handler.cpp +313 -0
- esphome/components/prometheus/prometheus_handler.h +48 -7
- esphome/components/psram/psram.cpp +8 -1
- esphome/components/pulse_counter/pulse_counter_sensor.cpp +14 -9
- esphome/components/pulse_counter/pulse_counter_sensor.h +4 -4
- esphome/components/pulse_meter/pulse_meter_sensor.cpp +2 -0
- esphome/components/qspi_dbi/__init__.py +3 -0
- esphome/components/qspi_dbi/display.py +74 -47
- esphome/components/qspi_dbi/models.py +245 -2
- esphome/components/qspi_dbi/qspi_dbi.cpp +9 -16
- esphome/components/qspi_dbi/qspi_dbi.h +2 -2
- esphome/components/remote_base/__init__.py +77 -25
- esphome/components/remote_base/remote_base.cpp +1 -1
- esphome/components/remote_base/remote_base.h +20 -2
- esphome/components/remote_base/toto_protocol.cpp +100 -0
- esphome/components/remote_base/toto_protocol.h +45 -0
- esphome/components/remote_receiver/__init__.py +55 -10
- esphome/components/remote_receiver/remote_receiver.h +36 -3
- esphome/components/remote_receiver/remote_receiver_esp32.cpp +145 -6
- esphome/components/remote_transmitter/__init__.py +62 -4
- esphome/components/remote_transmitter/remote_transmitter.h +21 -2
- esphome/components/remote_transmitter/remote_transmitter_esp32.cpp +140 -4
- esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +3 -3
- esphome/components/remote_transmitter/remote_transmitter_libretiny.cpp +3 -3
- esphome/components/resampler/__init__.py +0 -0
- esphome/components/resampler/speaker/__init__.py +103 -0
- esphome/components/resampler/speaker/resampler_speaker.cpp +318 -0
- esphome/components/resampler/speaker/resampler_speaker.h +107 -0
- esphome/components/resistance/resistance_sensor.h +2 -3
- esphome/components/resistance/sensor.py +2 -9
- esphome/components/rotary_encoder/rotary_encoder.cpp +8 -4
- esphome/components/rp2040/__init__.py +1 -0
- esphome/components/rp2040/gpio.h +1 -0
- esphome/components/rtl87xx/__init__.py +2 -0
- esphome/components/sdl/binary_sensor.py +270 -0
- esphome/components/sdl/sdl_esphome.cpp +16 -0
- esphome/components/sdl/sdl_esphome.h +9 -0
- esphome/components/seeed_mr60bha2/binary_sensor.py +25 -0
- esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +26 -2
- esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +9 -20
- esphome/components/seeed_mr60bha2/sensor.py +9 -1
- esphome/components/sn74hc165/sn74hc165.h +3 -0
- esphome/components/sn74hc595/sn74hc595.h +3 -0
- esphome/components/speaker/__init__.py +5 -4
- esphome/components/speaker/media_player/__init__.py +458 -0
- esphome/components/speaker/media_player/audio_pipeline.cpp +568 -0
- esphome/components/speaker/media_player/audio_pipeline.h +159 -0
- esphome/components/speaker/media_player/automation.h +26 -0
- esphome/components/speaker/media_player/speaker_media_player.cpp +577 -0
- esphome/components/speaker/media_player/speaker_media_player.h +160 -0
- esphome/components/speaker/speaker.h +20 -0
- esphome/components/spi/__init__.py +1 -5
- esphome/components/spi/spi.cpp +7 -1
- esphome/components/spi/spi.h +21 -2
- esphome/components/spi_led_strip/light.py +3 -5
- esphome/components/spi_led_strip/spi_led_strip.cpp +67 -0
- esphome/components/spi_led_strip/spi_led_strip.h +8 -60
- esphome/components/sprinkler/sprinkler.cpp +3 -1
- esphome/components/sx1509/sx1509_gpio_pin.h +2 -0
- esphome/components/tca9555/tca9555.h +2 -0
- esphome/components/toshiba/toshiba.cpp +2 -1
- esphome/components/tuya/light/tuya_light.cpp +4 -2
- esphome/components/uart/uart_component_esp32_arduino.cpp +2 -2
- esphome/components/uart/uart_component_esp_idf.cpp +2 -2
- esphome/components/udp/__init__.py +8 -2
- esphome/components/udp/udp_component.cpp +25 -56
- esphome/components/udp/udp_component.h +3 -0
- esphome/components/uponor_smatrix/sensor/__init__.py +14 -4
- esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.cpp +5 -0
- esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.h +1 -0
- esphome/components/uptime/text_sensor/__init__.py +19 -0
- esphome/components/uptime/text_sensor/uptime_text_sensor.cpp +63 -0
- esphome/components/uptime/text_sensor/uptime_text_sensor.h +25 -0
- esphome/components/voice_assistant/voice_assistant.cpp +24 -14
- esphome/components/voice_assistant/voice_assistant.h +8 -0
- esphome/components/waveshare_epaper/display.py +22 -1
- esphome/components/waveshare_epaper/waveshare_213v3.cpp +9 -3
- esphome/components/waveshare_epaper/waveshare_epaper.cpp +1155 -44
- esphome/components/waveshare_epaper/waveshare_epaper.h +208 -7
- esphome/components/web_server/web_server.cpp +28 -6
- esphome/components/weikai/weikai.h +2 -0
- esphome/components/wifi/__init__.py +6 -6
- esphome/components/wifi/wifi_component.cpp +1 -1
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +30 -1
- esphome/components/wireguard/__init__.py +2 -2
- esphome/components/xl9535/xl9535.h +2 -0
- esphome/components/xxtea/__init__.py +3 -0
- esphome/components/xxtea/xxtea.cpp +46 -0
- esphome/components/xxtea/xxtea.h +26 -0
- esphome/components/yashima/yashima.cpp +2 -1
- esphome/config.py +9 -5
- esphome/config_validation.py +55 -17
- esphome/const.py +7 -10
- esphome/core/__init__.py +6 -13
- esphome/core/base_automation.h +1 -0
- esphome/core/config.py +59 -72
- esphome/core/defines.h +9 -1
- esphome/core/gpio.h +7 -0
- esphome/core/helpers.cpp +19 -15
- esphome/core/helpers.h +57 -8
- esphome/core/log.h +9 -7
- esphome/cpp_generator.py +2 -2
- esphome/espota2.py +3 -2
- esphome/loader.py +12 -4
- esphome/log.py +5 -7
- esphome/yaml_util.py +2 -2
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/METADATA +12 -7
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/RECORD +341 -292
- esphome/components/custom/binary_sensor/custom_binary_sensor.cpp +0 -16
- esphome/components/custom/binary_sensor/custom_binary_sensor.h +0 -26
- esphome/components/custom/climate/custom_climate.h +0 -22
- esphome/components/custom/cover/custom_cover.h +0 -21
- esphome/components/custom/light/custom_light_output.h +0 -24
- esphome/components/custom/output/custom_output.h +0 -37
- esphome/components/custom/sensor/custom_sensor.cpp +0 -16
- esphome/components/custom/sensor/custom_sensor.h +0 -24
- esphome/components/custom/switch/custom_switch.cpp +0 -16
- esphome/components/custom/switch/custom_switch.h +0 -24
- esphome/components/custom/text_sensor/custom_text_sensor.cpp +0 -16
- esphome/components/custom/text_sensor/custom_text_sensor.h +0 -26
- esphome/components/custom_component/custom_component.h +0 -28
- esphome/components/esp32_ble_server/ble_2901.cpp +0 -18
- esphome/components/esp32_ble_server/ble_2901.h +0 -19
- esphome/components/resistance_sampler/__init__.py +0 -6
- esphome/components/resistance_sampler/resistance_sampler.h +0 -10
- esphome/components/uptime/{sensor.py → sensor/__init__.py} +3 -3
- /esphome/components/uptime/{uptime_seconds_sensor.cpp → sensor/uptime_seconds_sensor.cpp} +0 -0
- /esphome/components/uptime/{uptime_seconds_sensor.h → sensor/uptime_seconds_sensor.h} +0 -0
- /esphome/components/uptime/{uptime_timestamp_sensor.cpp → sensor/uptime_timestamp_sensor.cpp} +0 -0
- /esphome/components/uptime/{uptime_timestamp_sensor.h → sensor/uptime_timestamp_sensor.h} +0 -0
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/LICENSE +0 -0
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/WHEEL +0 -0
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/entry_points.txt +0 -0
- {esphome-2024.12.4.dist-info → esphome-2025.2.0b2.dist-info}/top_level.txt +0 -0
esphome/config_validation.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
from contextlib import contextmanager
|
4
4
|
from dataclasses import dataclass
|
5
5
|
from datetime import datetime
|
6
|
+
from ipaddress import AddressValueError, IPv4Address, ip_address
|
6
7
|
import logging
|
7
8
|
import os
|
8
9
|
import re
|
@@ -67,7 +68,6 @@ from esphome.const import (
|
|
67
68
|
from esphome.core import (
|
68
69
|
CORE,
|
69
70
|
HexInt,
|
70
|
-
IPAddress,
|
71
71
|
Lambda,
|
72
72
|
TimePeriod,
|
73
73
|
TimePeriodMicroseconds,
|
@@ -1130,7 +1130,7 @@ def domain(value):
|
|
1130
1130
|
if re.match(vol.DOMAIN_REGEX, value) is not None:
|
1131
1131
|
return value
|
1132
1132
|
try:
|
1133
|
-
return str(
|
1133
|
+
return str(ipaddress(value))
|
1134
1134
|
except Invalid as err:
|
1135
1135
|
raise Invalid(f"Invalid domain: {value}") from err
|
1136
1136
|
|
@@ -1160,21 +1160,29 @@ def ssid(value):
|
|
1160
1160
|
return value
|
1161
1161
|
|
1162
1162
|
|
1163
|
-
def
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
return
|
1163
|
+
def ipv4address(value):
|
1164
|
+
try:
|
1165
|
+
address = IPv4Address(value)
|
1166
|
+
except AddressValueError as exc:
|
1167
|
+
raise Invalid(f"{value} is not a valid IPv4 address") from exc
|
1168
|
+
return address
|
1169
|
+
|
1170
|
+
|
1171
|
+
def ipv4address_multi_broadcast(value):
|
1172
|
+
address = ipv4address(value)
|
1173
|
+
if not (address.is_multicast or (address == IPv4Address("255.255.255.255"))):
|
1174
|
+
raise Invalid(
|
1175
|
+
f"{value} is not a multicasst address nor local broadcast address"
|
1176
|
+
)
|
1177
|
+
return address
|
1178
|
+
|
1179
|
+
|
1180
|
+
def ipaddress(value):
|
1181
|
+
try:
|
1182
|
+
address = ip_address(value)
|
1183
|
+
except ValueError as exc:
|
1184
|
+
raise Invalid(f"{value} is not a valid IP address") from exc
|
1185
|
+
return address
|
1178
1186
|
|
1179
1187
|
|
1180
1188
|
def _valid_topic(value):
|
@@ -1660,6 +1668,12 @@ class SplitDefault(Optional):
|
|
1660
1668
|
esp32_c3=vol.UNDEFINED,
|
1661
1669
|
esp32_c3_arduino=vol.UNDEFINED,
|
1662
1670
|
esp32_c3_idf=vol.UNDEFINED,
|
1671
|
+
esp32_c6=vol.UNDEFINED,
|
1672
|
+
esp32_c6_arduino=vol.UNDEFINED,
|
1673
|
+
esp32_c6_idf=vol.UNDEFINED,
|
1674
|
+
esp32_h2=vol.UNDEFINED,
|
1675
|
+
esp32_h2_arduino=vol.UNDEFINED,
|
1676
|
+
esp32_h2_idf=vol.UNDEFINED,
|
1663
1677
|
rp2040=vol.UNDEFINED,
|
1664
1678
|
bk72xx=vol.UNDEFINED,
|
1665
1679
|
rtl87xx=vol.UNDEFINED,
|
@@ -1691,6 +1705,18 @@ class SplitDefault(Optional):
|
|
1691
1705
|
self._esp32_c3_idf_default = vol.default_factory(
|
1692
1706
|
_get_priority_default(esp32_c3_idf, esp32_c3, esp32_idf, esp32)
|
1693
1707
|
)
|
1708
|
+
self._esp32_c6_arduino_default = vol.default_factory(
|
1709
|
+
_get_priority_default(esp32_c6_arduino, esp32_c6, esp32_arduino, esp32)
|
1710
|
+
)
|
1711
|
+
self._esp32_c6_idf_default = vol.default_factory(
|
1712
|
+
_get_priority_default(esp32_c6_idf, esp32_c6, esp32_idf, esp32)
|
1713
|
+
)
|
1714
|
+
self._esp32_h2_arduino_default = vol.default_factory(
|
1715
|
+
_get_priority_default(esp32_h2_arduino, esp32_h2, esp32_arduino, esp32)
|
1716
|
+
)
|
1717
|
+
self._esp32_h2_idf_default = vol.default_factory(
|
1718
|
+
_get_priority_default(esp32_h2_idf, esp32_h2, esp32_idf, esp32)
|
1719
|
+
)
|
1694
1720
|
self._rp2040_default = vol.default_factory(rp2040)
|
1695
1721
|
self._bk72xx_default = vol.default_factory(bk72xx)
|
1696
1722
|
self._rtl87xx_default = vol.default_factory(rtl87xx)
|
@@ -1704,6 +1730,8 @@ class SplitDefault(Optional):
|
|
1704
1730
|
from esphome.components.esp32 import get_esp32_variant
|
1705
1731
|
from esphome.components.esp32.const import (
|
1706
1732
|
VARIANT_ESP32C3,
|
1733
|
+
VARIANT_ESP32C6,
|
1734
|
+
VARIANT_ESP32H2,
|
1707
1735
|
VARIANT_ESP32S2,
|
1708
1736
|
VARIANT_ESP32S3,
|
1709
1737
|
)
|
@@ -1724,6 +1752,16 @@ class SplitDefault(Optional):
|
|
1724
1752
|
return self._esp32_c3_arduino_default
|
1725
1753
|
if CORE.using_esp_idf:
|
1726
1754
|
return self._esp32_c3_idf_default
|
1755
|
+
elif variant == VARIANT_ESP32C6:
|
1756
|
+
if CORE.using_arduino:
|
1757
|
+
return self._esp32_c6_arduino_default
|
1758
|
+
if CORE.using_esp_idf:
|
1759
|
+
return self._esp32_c6_idf_default
|
1760
|
+
elif variant == VARIANT_ESP32H2:
|
1761
|
+
if CORE.using_arduino:
|
1762
|
+
return self._esp32_h2_arduino_default
|
1763
|
+
if CORE.using_esp_idf:
|
1764
|
+
return self._esp32_h2_idf_default
|
1727
1765
|
else:
|
1728
1766
|
if CORE.using_arduino:
|
1729
1767
|
return self._esp32_arduino_default
|
esphome/const.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"""Constants used by esphome."""
|
2
2
|
|
3
|
-
__version__ = "
|
3
|
+
__version__ = "2025.2.0b2"
|
4
4
|
|
5
5
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
6
6
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
@@ -15,15 +15,6 @@ PLATFORM_LIBRETINY_OLDSTYLE = "libretiny"
|
|
15
15
|
PLATFORM_RP2040 = "rp2040"
|
16
16
|
PLATFORM_RTL87XX = "rtl87xx"
|
17
17
|
|
18
|
-
TARGET_PLATFORMS = [
|
19
|
-
PLATFORM_BK72XX,
|
20
|
-
PLATFORM_ESP32,
|
21
|
-
PLATFORM_ESP8266,
|
22
|
-
PLATFORM_HOST,
|
23
|
-
PLATFORM_LIBRETINY_OLDSTYLE,
|
24
|
-
PLATFORM_RP2040,
|
25
|
-
PLATFORM_RTL87XX,
|
26
|
-
]
|
27
18
|
|
28
19
|
SOURCE_FILE_EXTENSIONS = {".cpp", ".hpp", ".h", ".c", ".tcc", ".ino"}
|
29
20
|
HEADER_FILE_EXTENSIONS = {".h", ".hpp", ".tcc"}
|
@@ -103,6 +94,7 @@ CONF_BRIGHTNESS = "brightness"
|
|
103
94
|
CONF_BRIGHTNESS_LIMITS = "brightness_limits"
|
104
95
|
CONF_BROKER = "broker"
|
105
96
|
CONF_BSSID = "bssid"
|
97
|
+
CONF_BUFFER_DURATION = "buffer_duration"
|
106
98
|
CONF_BUFFER_SIZE = "buffer_size"
|
107
99
|
CONF_BUILD_PATH = "build_path"
|
108
100
|
CONF_BUS_VOLTAGE = "bus_voltage"
|
@@ -490,6 +482,7 @@ CONF_MEMORY_BLOCKS = "memory_blocks"
|
|
490
482
|
CONF_MESSAGE = "message"
|
491
483
|
CONF_METHANE = "methane"
|
492
484
|
CONF_METHOD = "method"
|
485
|
+
CONF_MIC_GAIN = "mic_gain"
|
493
486
|
CONF_MICROPHONE = "microphone"
|
494
487
|
CONF_MIN_BRIGHTNESS = "min_brightness"
|
495
488
|
CONF_MIN_COOLING_OFF_TIME = "min_cooling_off_time"
|
@@ -535,9 +528,11 @@ CONF_NAME_FONT = "name_font"
|
|
535
528
|
CONF_NBITS = "nbits"
|
536
529
|
CONF_NEC = "nec"
|
537
530
|
CONF_NETWORKS = "networks"
|
531
|
+
CONF_NEVER = "never"
|
538
532
|
CONF_NEW_PASSWORD = "new_password"
|
539
533
|
CONF_NITROGEN_DIOXIDE = "nitrogen_dioxide"
|
540
534
|
CONF_NOISE_LEVEL = "noise_level"
|
535
|
+
CONF_NOTIFY = "notify"
|
541
536
|
CONF_NUM_ATTEMPTS = "num_attempts"
|
542
537
|
CONF_NUM_CHANNELS = "num_channels"
|
543
538
|
CONF_NUM_CHIPS = "num_chips"
|
@@ -622,6 +617,7 @@ CONF_OTA = "ota"
|
|
622
617
|
CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature"
|
623
618
|
CONF_OUTPUT = "output"
|
624
619
|
CONF_OUTPUT_ID = "output_id"
|
620
|
+
CONF_OUTPUT_SPEAKER = "output_speaker"
|
625
621
|
CONF_OUTPUTS = "outputs"
|
626
622
|
CONF_OVERSAMPLING = "oversampling"
|
627
623
|
CONF_PACKAGES = "packages"
|
@@ -866,6 +862,7 @@ CONF_TARGET_TEMPERATURE_LOW = "target_temperature_low"
|
|
866
862
|
CONF_TARGET_TEMPERATURE_LOW_COMMAND_TOPIC = "target_temperature_low_command_topic"
|
867
863
|
CONF_TARGET_TEMPERATURE_LOW_STATE_TOPIC = "target_temperature_low_state_topic"
|
868
864
|
CONF_TARGET_TEMPERATURE_STATE_TOPIC = "target_temperature_state_topic"
|
865
|
+
CONF_TASK_STACK_IN_PSRAM = "task_stack_in_psram"
|
869
866
|
CONF_TEMPERATURE = "temperature"
|
870
867
|
CONF_TEMPERATURE_COMPENSATION = "temperature_compensation"
|
871
868
|
CONF_TEMPERATURE_OFFSET = "temperature_offset"
|
esphome/core/__init__.py
CHANGED
@@ -54,16 +54,6 @@ class HexInt(int):
|
|
54
54
|
return f"{sign}0x{value:X}"
|
55
55
|
|
56
56
|
|
57
|
-
class IPAddress:
|
58
|
-
def __init__(self, *args):
|
59
|
-
if len(args) != 4:
|
60
|
-
raise ValueError("IPAddress must consist of 4 items")
|
61
|
-
self.args = args
|
62
|
-
|
63
|
-
def __str__(self):
|
64
|
-
return ".".join(str(x) for x in self.args)
|
65
|
-
|
66
|
-
|
67
57
|
class MACAddress:
|
68
58
|
def __init__(self, *parts):
|
69
59
|
if len(parts) != 6:
|
@@ -592,7 +582,7 @@ class EsphomeCore:
|
|
592
582
|
|
593
583
|
@property
|
594
584
|
def config_dir(self):
|
595
|
-
return os.path.dirname(self.config_path)
|
585
|
+
return os.path.abspath(os.path.dirname(self.config_path))
|
596
586
|
|
597
587
|
@property
|
598
588
|
def data_dir(self):
|
@@ -699,7 +689,7 @@ class EsphomeCore:
|
|
699
689
|
_LOGGER.debug("Adding: %s", expression)
|
700
690
|
return expression
|
701
691
|
|
702
|
-
def add_global(self, expression):
|
692
|
+
def add_global(self, expression, prepend=False):
|
703
693
|
from esphome.cpp_generator import Expression, Statement, statement
|
704
694
|
|
705
695
|
if isinstance(expression, Expression):
|
@@ -708,7 +698,10 @@ class EsphomeCore:
|
|
708
698
|
raise ValueError(
|
709
699
|
f"Add '{expression}' must be expression or statement, not {type(expression)}"
|
710
700
|
)
|
711
|
-
|
701
|
+
if prepend:
|
702
|
+
self.global_statements.insert(0, expression)
|
703
|
+
else:
|
704
|
+
self.global_statements.append(expression)
|
712
705
|
_LOGGER.debug("Adding global: %s", expression)
|
713
706
|
return expression
|
714
707
|
|
esphome/core/base_automation.h
CHANGED
esphome/core/config.py
CHANGED
@@ -1,21 +1,17 @@
|
|
1
1
|
import logging
|
2
2
|
import multiprocessing
|
3
3
|
import os
|
4
|
-
import
|
4
|
+
from pathlib import Path
|
5
5
|
|
6
6
|
from esphome import automation
|
7
7
|
import esphome.codegen as cg
|
8
8
|
import esphome.config_validation as cv
|
9
9
|
from esphome.const import (
|
10
|
-
CONF_ARDUINO_VERSION,
|
11
10
|
CONF_AREA,
|
12
|
-
CONF_BOARD,
|
13
|
-
CONF_BOARD_FLASH_MODE,
|
14
11
|
CONF_BUILD_PATH,
|
15
12
|
CONF_COMMENT,
|
16
13
|
CONF_COMPILE_PROCESS_LIMIT,
|
17
14
|
CONF_ESPHOME,
|
18
|
-
CONF_FRAMEWORK,
|
19
15
|
CONF_FRIENDLY_NAME,
|
20
16
|
CONF_INCLUDES,
|
21
17
|
CONF_LIBRARIES,
|
@@ -30,13 +26,9 @@ from esphome.const import (
|
|
30
26
|
CONF_PLATFORMIO_OPTIONS,
|
31
27
|
CONF_PRIORITY,
|
32
28
|
CONF_PROJECT,
|
33
|
-
CONF_SOURCE,
|
34
29
|
CONF_TRIGGER_ID,
|
35
|
-
CONF_TYPE,
|
36
30
|
CONF_VERSION,
|
37
31
|
KEY_CORE,
|
38
|
-
PLATFORM_ESP8266,
|
39
|
-
TARGET_PLATFORMS,
|
40
32
|
__version__ as ESPHOME_VERSION,
|
41
33
|
)
|
42
34
|
from esphome.core import CORE, coroutine_with_priority
|
@@ -44,7 +36,6 @@ from esphome.helpers import copy_file_if_changed, get_str_env, walk_files
|
|
44
36
|
|
45
37
|
_LOGGER = logging.getLogger(__name__)
|
46
38
|
|
47
|
-
BUILD_FLASH_MODES = ["qio", "qout", "dio", "dout"]
|
48
39
|
StartupTrigger = cg.esphome_ns.class_(
|
49
40
|
"StartupTrigger", cg.Component, automation.Trigger.template()
|
50
41
|
)
|
@@ -58,8 +49,6 @@ ProjectUpdateTrigger = cg.esphome_ns.class_(
|
|
58
49
|
"ProjectUpdateTrigger", cg.Component, automation.Trigger.template(cg.std_string)
|
59
50
|
)
|
60
51
|
|
61
|
-
VERSION_REGEX = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+(?:[ab]\d+)?$")
|
62
|
-
|
63
52
|
|
64
53
|
VALID_INCLUDE_EXTS = {".h", ".hpp", ".tcc", ".ino", ".cpp", ".c"}
|
65
54
|
|
@@ -83,6 +72,9 @@ def validate_hostname(config):
|
|
83
72
|
|
84
73
|
|
85
74
|
def valid_include(value):
|
75
|
+
# Look for "<...>" includes
|
76
|
+
if value.startswith("<") and value.endswith(">"):
|
77
|
+
return value
|
86
78
|
try:
|
87
79
|
return cv.directory(value)
|
88
80
|
except cv.Invalid:
|
@@ -111,7 +103,6 @@ else:
|
|
111
103
|
_compile_process_limit_default = cv.UNDEFINED
|
112
104
|
|
113
105
|
|
114
|
-
CONF_ESP8266_RESTORE_FROM_FLASH = "esp8266_restore_from_flash"
|
115
106
|
CONFIG_SCHEMA = cv.All(
|
116
107
|
cv.Schema(
|
117
108
|
{
|
@@ -175,14 +166,9 @@ PRELOAD_CONFIG_SCHEMA = cv.Schema(
|
|
175
166
|
{
|
176
167
|
cv.Required(CONF_NAME): cv.valid_name,
|
177
168
|
cv.Optional(CONF_BUILD_PATH): cv.string,
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
cv.Optional(CONF_PLATFORM): cv.one_of(*TARGET_PLATFORMS, lower=True),
|
182
|
-
cv.Optional(CONF_BOARD): cv.string_strict,
|
183
|
-
cv.Optional(CONF_ESP8266_RESTORE_FROM_FLASH): cv.valid,
|
184
|
-
cv.Optional(CONF_BOARD_FLASH_MODE): cv.valid,
|
185
|
-
cv.Optional(CONF_ARDUINO_VERSION): cv.valid,
|
169
|
+
cv.Optional(CONF_PLATFORM): cv.invalid(
|
170
|
+
"Please remove the `platform` key from the [esphome] block and use the correct platform component. This style of configuration has now been removed."
|
171
|
+
),
|
186
172
|
cv.Optional(CONF_MIN_VERSION, default=ESPHOME_VERSION): cv.All(
|
187
173
|
cv.version_number, cv.validate_esphome_version
|
188
174
|
),
|
@@ -191,7 +177,31 @@ PRELOAD_CONFIG_SCHEMA = cv.Schema(
|
|
191
177
|
)
|
192
178
|
|
193
179
|
|
194
|
-
def
|
180
|
+
def _is_target_platform(name):
|
181
|
+
from esphome.loader import get_component
|
182
|
+
|
183
|
+
try:
|
184
|
+
if get_component(name, True).is_target_platform:
|
185
|
+
return True
|
186
|
+
except KeyError:
|
187
|
+
pass
|
188
|
+
return False
|
189
|
+
|
190
|
+
|
191
|
+
def _list_target_platforms():
|
192
|
+
target_platforms = []
|
193
|
+
root = Path(__file__).parents[1]
|
194
|
+
for path in (root / "components").iterdir():
|
195
|
+
if not path.is_dir():
|
196
|
+
continue
|
197
|
+
if not (path / "__init__.py").is_file():
|
198
|
+
continue
|
199
|
+
if _is_target_platform(path.name):
|
200
|
+
target_platforms += [path.name]
|
201
|
+
return target_platforms
|
202
|
+
|
203
|
+
|
204
|
+
def preload_core_config(config, result) -> str:
|
195
205
|
with cv.prepend_path(CONF_ESPHOME):
|
196
206
|
conf = PRELOAD_CONFIG_SCHEMA(config[CONF_ESPHOME])
|
197
207
|
|
@@ -204,63 +214,28 @@ def preload_core_config(config, result):
|
|
204
214
|
conf[CONF_BUILD_PATH] = os.path.join(build_path, CORE.name)
|
205
215
|
CORE.build_path = CORE.relative_internal_path(conf[CONF_BUILD_PATH])
|
206
216
|
|
207
|
-
|
208
|
-
newstyle_found = [key for key in TARGET_PLATFORMS if key in config]
|
209
|
-
oldstyle_opts = [
|
210
|
-
CONF_ESP8266_RESTORE_FROM_FLASH,
|
211
|
-
CONF_BOARD_FLASH_MODE,
|
212
|
-
CONF_ARDUINO_VERSION,
|
213
|
-
CONF_BOARD,
|
214
|
-
]
|
217
|
+
target_platforms = []
|
215
218
|
|
216
|
-
|
219
|
+
for domain, _ in config.items():
|
220
|
+
if domain.startswith("."):
|
221
|
+
continue
|
222
|
+
if _is_target_platform(domain):
|
223
|
+
target_platforms += [domain]
|
224
|
+
|
225
|
+
if not target_platforms:
|
217
226
|
raise cv.Invalid(
|
218
227
|
"Platform missing. You must include one of the available platform keys: "
|
219
|
-
+ ", ".join(
|
228
|
+
+ ", ".join(_list_target_platforms()),
|
220
229
|
[CONF_ESPHOME],
|
221
230
|
)
|
222
|
-
if
|
231
|
+
if len(target_platforms) > 1:
|
223
232
|
raise cv.Invalid(
|
224
|
-
f"
|
225
|
-
[
|
233
|
+
f"Found multiple target platform blocks: {', '.join(target_platforms)}. Only one is allowed.",
|
234
|
+
[target_platforms[0]],
|
226
235
|
)
|
227
|
-
|
228
|
-
raise cv.Invalid(
|
229
|
-
f"Found multiple target platform blocks: {', '.join(newstyle_found)}. Only one is allowed.",
|
230
|
-
[newstyle_found[0]],
|
231
|
-
)
|
232
|
-
if newstyle_found:
|
233
|
-
# Convert to newstyle
|
234
|
-
for key in oldstyle_opts:
|
235
|
-
if key in conf:
|
236
|
-
raise cv.Invalid(
|
237
|
-
f"Please move {key} to the [{newstyle_found[0]}] block.",
|
238
|
-
[CONF_ESPHOME, key],
|
239
|
-
)
|
240
|
-
|
241
|
-
if has_oldstyle:
|
242
|
-
plat = conf.pop(CONF_PLATFORM)
|
243
|
-
plat_conf = {}
|
244
|
-
if CONF_ESP8266_RESTORE_FROM_FLASH in conf:
|
245
|
-
plat_conf["restore_from_flash"] = conf.pop(CONF_ESP8266_RESTORE_FROM_FLASH)
|
246
|
-
if CONF_BOARD_FLASH_MODE in conf:
|
247
|
-
plat_conf[CONF_BOARD_FLASH_MODE] = conf.pop(CONF_BOARD_FLASH_MODE)
|
248
|
-
if CONF_ARDUINO_VERSION in conf:
|
249
|
-
plat_conf[CONF_FRAMEWORK] = {}
|
250
|
-
if plat != PLATFORM_ESP8266:
|
251
|
-
plat_conf[CONF_FRAMEWORK][CONF_TYPE] = "arduino"
|
252
|
-
|
253
|
-
try:
|
254
|
-
if conf[CONF_ARDUINO_VERSION] not in ("recommended", "latest", "dev"):
|
255
|
-
cv.Version.parse(conf[CONF_ARDUINO_VERSION])
|
256
|
-
plat_conf[CONF_FRAMEWORK][CONF_VERSION] = conf.pop(CONF_ARDUINO_VERSION)
|
257
|
-
except ValueError:
|
258
|
-
plat_conf[CONF_FRAMEWORK][CONF_SOURCE] = conf.pop(CONF_ARDUINO_VERSION)
|
259
|
-
if CONF_BOARD in conf:
|
260
|
-
plat_conf[CONF_BOARD] = conf.pop(CONF_BOARD)
|
261
|
-
# Insert generated target platform config to main config
|
262
|
-
config[plat] = plat_conf
|
236
|
+
|
263
237
|
config[CONF_ESPHOME] = conf
|
238
|
+
return target_platforms[0]
|
264
239
|
|
265
240
|
|
266
241
|
def include_file(path, basename):
|
@@ -390,7 +365,19 @@ async def to_code(config):
|
|
390
365
|
CORE.add_job(add_arduino_global_workaround)
|
391
366
|
|
392
367
|
if config[CONF_INCLUDES]:
|
393
|
-
|
368
|
+
# Get the <...> includes
|
369
|
+
system_includes = []
|
370
|
+
other_includes = []
|
371
|
+
for include in config[CONF_INCLUDES]:
|
372
|
+
if include.startswith("<") and include.endswith(">"):
|
373
|
+
system_includes.append(include)
|
374
|
+
else:
|
375
|
+
other_includes.append(include)
|
376
|
+
# <...> includes should be at the start
|
377
|
+
for include in system_includes:
|
378
|
+
cg.add_global(cg.RawStatement(f"#include {include}"), prepend=True)
|
379
|
+
# Other includes should be at the end
|
380
|
+
CORE.add_job(add_includes, other_includes)
|
394
381
|
|
395
382
|
if project_conf := config.get(CONF_PROJECT):
|
396
383
|
cg.add_define("ESPHOME_PROJECT_NAME", project_conf[CONF_NAME])
|
esphome/core/defines.h
CHANGED
@@ -14,8 +14,13 @@
|
|
14
14
|
#define ESPHOME_PROJECT_VERSION_30 "v2"
|
15
15
|
#define ESPHOME_VARIANT "ESP32"
|
16
16
|
|
17
|
+
// logger
|
18
|
+
#define ESPHOME_LOG_LEVEL ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
19
|
+
|
17
20
|
// Feature flags
|
18
21
|
#define USE_ALARM_CONTROL_PANEL
|
22
|
+
#define USE_AUDIO_FLAC_SUPPORT
|
23
|
+
#define USE_AUDIO_MP3_SUPPORT
|
19
24
|
#define USE_API
|
20
25
|
#define USE_API_NOISE
|
21
26
|
#define USE_API_PLAINTEXT
|
@@ -49,6 +54,7 @@
|
|
49
54
|
#define USE_LVGL_IMAGE
|
50
55
|
#define USE_LVGL_KEY_LISTENER
|
51
56
|
#define USE_LVGL_KEYBOARD
|
57
|
+
#define USE_LVGL_METER
|
52
58
|
#define USE_LVGL_ROLLER
|
53
59
|
#define USE_LVGL_ROTARY_ENCODER
|
54
60
|
#define USE_LVGL_TOUCHSCREEN
|
@@ -59,7 +65,9 @@
|
|
59
65
|
#define USE_NETWORK
|
60
66
|
#define USE_NEXTION_TFT_UPLOAD
|
61
67
|
#define USE_NUMBER
|
68
|
+
#define USE_ONLINE_IMAGE_BMP_SUPPORT
|
62
69
|
#define USE_ONLINE_IMAGE_PNG_SUPPORT
|
70
|
+
#define USE_ONLINE_IMAGE_JPEG_SUPPORT
|
63
71
|
#define USE_OTA
|
64
72
|
#define USE_OTA_PASSWORD
|
65
73
|
#define USE_OTA_STATE_CALLBACK
|
@@ -119,7 +127,7 @@
|
|
119
127
|
#endif
|
120
128
|
|
121
129
|
#ifdef USE_ESP_IDF
|
122
|
-
#define USE_ESP_IDF_VERSION_CODE VERSION_CODE(
|
130
|
+
#define USE_ESP_IDF_VERSION_CODE VERSION_CODE(5, 1, 5)
|
123
131
|
#endif
|
124
132
|
|
125
133
|
#if defined(USE_ESP32_VARIANT_ESP32S2)
|
esphome/core/gpio.h
CHANGED
@@ -53,6 +53,13 @@ class GPIOPin {
|
|
53
53
|
|
54
54
|
virtual void pin_mode(gpio::Flags flags) = 0;
|
55
55
|
|
56
|
+
/**
|
57
|
+
* @brief Retrieve GPIO pin flags.
|
58
|
+
*
|
59
|
+
* @return The GPIO flags describing the pin mode and properties.
|
60
|
+
*/
|
61
|
+
virtual gpio::Flags get_flags() const = 0;
|
62
|
+
|
56
63
|
virtual bool digital_read() = 0;
|
57
64
|
|
58
65
|
virtual void digital_write(bool value) = 0;
|
esphome/core/helpers.cpp
CHANGED
@@ -45,7 +45,9 @@
|
|
45
45
|
#endif
|
46
46
|
#ifdef USE_ESP32
|
47
47
|
#include "esp32/rom/crc.h"
|
48
|
-
|
48
|
+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 2)
|
49
|
+
#include "esp_mac.h"
|
50
|
+
#endif
|
49
51
|
#include "esp_efuse.h"
|
50
52
|
#include "esp_efuse_table.h"
|
51
53
|
#endif
|
@@ -126,19 +128,21 @@ uint16_t crc16(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t reverse
|
|
126
128
|
}
|
127
129
|
} else
|
128
130
|
#endif
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
131
|
+
{
|
132
|
+
if (reverse_poly == 0xa001) {
|
133
|
+
while (len--) {
|
134
|
+
uint8_t combo = crc ^ (uint8_t) *data++;
|
135
|
+
crc = (crc >> 8) ^ CRC16_A001_LE_LUT_L[combo & 0x0F] ^ CRC16_A001_LE_LUT_H[combo >> 4];
|
136
|
+
}
|
137
|
+
} else {
|
138
|
+
while (len--) {
|
139
|
+
crc ^= *data++;
|
140
|
+
for (uint8_t i = 0; i < 8; i++) {
|
141
|
+
if (crc & 0x0001) {
|
142
|
+
crc = (crc >> 1) ^ reverse_poly;
|
143
|
+
} else {
|
144
|
+
crc >>= 1;
|
145
|
+
}
|
142
146
|
}
|
143
147
|
}
|
144
148
|
}
|
@@ -259,7 +263,7 @@ bool random_bytes(uint8_t *data, size_t len) {
|
|
259
263
|
bool str_equals_case_insensitive(const std::string &a, const std::string &b) {
|
260
264
|
return strcasecmp(a.c_str(), b.c_str()) == 0;
|
261
265
|
}
|
262
|
-
#if
|
266
|
+
#if __cplusplus >= 202002L
|
263
267
|
bool str_startswith(const std::string &str, const std::string &start) { return str.starts_with(start); }
|
264
268
|
bool str_endswith(const std::string &str, const std::string &end) { return str.ends_with(end); }
|
265
269
|
#else
|
esphome/core/helpers.h
CHANGED
@@ -11,6 +11,14 @@
|
|
11
11
|
|
12
12
|
#include "esphome/core/optional.h"
|
13
13
|
|
14
|
+
#ifdef USE_ESP8266
|
15
|
+
#include <Esp.h>
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#ifdef USE_RP2040
|
19
|
+
#include <Arduino.h>
|
20
|
+
#endif
|
21
|
+
|
14
22
|
#ifdef USE_ESP32
|
15
23
|
#include <esp_heap_caps.h>
|
16
24
|
#endif
|
@@ -155,7 +163,7 @@ template<typename T, typename U> T remap(U value, U min, U max, T min_out, T max
|
|
155
163
|
return (value - min) * (max_out - min_out) / (max - min) + min_out;
|
156
164
|
}
|
157
165
|
|
158
|
-
/// Calculate a CRC-8 checksum of \p data with size \p len.
|
166
|
+
/// Calculate a CRC-8 checksum of \p data with size \p len using the CRC-8-Dallas/Maxim polynomial.
|
159
167
|
uint8_t crc8(const uint8_t *data, uint8_t len);
|
160
168
|
|
161
169
|
/// Calculate a CRC-16 checksum of \p data with size \p len.
|
@@ -684,20 +692,23 @@ template<class T> class RAMAllocator {
|
|
684
692
|
};
|
685
693
|
|
686
694
|
RAMAllocator() = default;
|
687
|
-
RAMAllocator(uint8_t flags)
|
695
|
+
RAMAllocator(uint8_t flags) {
|
696
|
+
// default is both external and internal
|
697
|
+
flags &= ALLOC_INTERNAL | ALLOC_EXTERNAL;
|
698
|
+
if (flags != 0)
|
699
|
+
this->flags_ = flags;
|
700
|
+
}
|
688
701
|
template<class U> constexpr RAMAllocator(const RAMAllocator<U> &other) : flags_{other.flags_} {}
|
689
702
|
|
690
703
|
T *allocate(size_t n) {
|
691
704
|
size_t size = n * sizeof(T);
|
692
705
|
T *ptr = nullptr;
|
693
706
|
#ifdef USE_ESP32
|
694
|
-
|
695
|
-
if ((this->flags_ & Flags::ALLOC_EXTERNAL) || ((this->flags_ & Flags::ALLOC_INTERNAL) == 0)) {
|
707
|
+
if (this->flags_ & Flags::ALLOC_EXTERNAL) {
|
696
708
|
ptr = static_cast<T *>(heap_caps_malloc(size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));
|
697
709
|
}
|
698
|
-
|
699
|
-
|
700
|
-
ptr = static_cast<T *>(malloc(size)); // NOLINT(cppcoreguidelines-owning-memory,cppcoreguidelines-no-malloc)
|
710
|
+
if (ptr == nullptr && this->flags_ & Flags::ALLOC_INTERNAL) {
|
711
|
+
ptr = static_cast<T *>(heap_caps_malloc(size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT));
|
701
712
|
}
|
702
713
|
#else
|
703
714
|
// Ignore ALLOC_EXTERNAL/ALLOC_INTERNAL flags if external allocation is not supported
|
@@ -710,8 +721,46 @@ template<class T> class RAMAllocator {
|
|
710
721
|
free(p); // NOLINT(cppcoreguidelines-owning-memory,cppcoreguidelines-no-malloc)
|
711
722
|
}
|
712
723
|
|
724
|
+
/**
|
725
|
+
* Return the total heap space available via this allocator
|
726
|
+
*/
|
727
|
+
size_t get_free_heap_size() const {
|
728
|
+
#ifdef USE_ESP8266
|
729
|
+
return ESP.getFreeHeap(); // NOLINT(readability-static-accessed-through-instance)
|
730
|
+
#elif defined(USE_ESP32)
|
731
|
+
auto max_internal =
|
732
|
+
this->flags_ & ALLOC_INTERNAL ? heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL) : 0;
|
733
|
+
auto max_external =
|
734
|
+
this->flags_ & ALLOC_EXTERNAL ? heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM) : 0;
|
735
|
+
return max_internal + max_external;
|
736
|
+
#elif defined(USE_RP2040)
|
737
|
+
return ::rp2040.getFreeHeap();
|
738
|
+
#elif defined(USE_LIBRETINY)
|
739
|
+
return lt_heap_get_free();
|
740
|
+
#else
|
741
|
+
return 100000;
|
742
|
+
#endif
|
743
|
+
}
|
744
|
+
|
745
|
+
/**
|
746
|
+
* Return the maximum size block this allocator could allocate. This may be an approximation on some platforms
|
747
|
+
*/
|
748
|
+
size_t get_max_free_block_size() const {
|
749
|
+
#ifdef USE_ESP8266
|
750
|
+
return ESP.getMaxFreeBlockSize(); // NOLINT(readability-static-accessed-through-instance)
|
751
|
+
#elif defined(USE_ESP32)
|
752
|
+
auto max_internal =
|
753
|
+
this->flags_ & ALLOC_INTERNAL ? heap_caps_get_largest_free_block(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL) : 0;
|
754
|
+
auto max_external =
|
755
|
+
this->flags_ & ALLOC_EXTERNAL ? heap_caps_get_largest_free_block(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM) : 0;
|
756
|
+
return std::max(max_internal, max_external);
|
757
|
+
#else
|
758
|
+
return this->get_free_heap_size();
|
759
|
+
#endif
|
760
|
+
}
|
761
|
+
|
713
762
|
private:
|
714
|
-
uint8_t flags_{
|
763
|
+
uint8_t flags_{ALLOC_INTERNAL | ALLOC_EXTERNAL};
|
715
764
|
};
|
716
765
|
|
717
766
|
template<class T> using ExternalRAMAllocator = RAMAllocator<T>;
|