esphome 2025.8.4__py3-none-any.whl → 2025.9.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.
- esphome/__main__.py +177 -105
- esphome/components/absolute_humidity/absolute_humidity.cpp +3 -5
- esphome/components/adc/__init__.py +1 -26
- esphome/components/adc/adc_sensor_esp32.cpp +29 -6
- esphome/components/adc/sensor.py +20 -0
- esphome/components/ade7880/ade7880.cpp +1 -1
- esphome/components/ags10/ags10.cpp +3 -18
- esphome/components/ags10/ags10.h +2 -12
- esphome/components/aht10/aht10.cpp +3 -3
- esphome/components/airthings_ble/__init__.py +2 -2
- esphome/components/alarm_control_panel/__init__.py +2 -2
- esphome/components/am2315c/am2315c.cpp +1 -17
- esphome/components/am2315c/am2315c.h +2 -3
- esphome/components/api/__init__.py +2 -2
- esphome/components/api/api_connection.cpp +38 -34
- esphome/components/api/api_connection.h +20 -40
- esphome/components/api/api_frame_helper.cpp +25 -25
- esphome/components/api/api_frame_helper.h +3 -3
- esphome/components/api/api_frame_helper_noise.cpp +75 -40
- esphome/components/api/api_frame_helper_noise.h +3 -7
- esphome/components/api/api_frame_helper_plaintext.cpp +17 -4
- esphome/components/api/api_frame_helper_plaintext.h +1 -4
- esphome/components/api/api_pb2.cpp +12 -2
- esphome/components/api/api_pb2.h +144 -143
- esphome/components/api/api_pb2_dump.cpp +6 -1
- esphome/components/api/api_pb2_service.cpp +0 -14
- esphome/components/api/api_pb2_service.h +1 -3
- esphome/components/api/client.py +5 -3
- esphome/components/api/proto.cpp +33 -37
- esphome/components/async_tcp/__init__.py +2 -2
- esphome/components/atm90e26/sensor.py +2 -0
- esphome/components/atm90e32/sensor.py +4 -2
- esphome/components/audio_adc/__init__.py +2 -2
- esphome/components/audio_dac/__init__.py +2 -2
- esphome/components/axs15231/touchscreen/axs15231_touchscreen.cpp +1 -1
- esphome/components/bedjet/bedjet_hub.cpp +1 -1
- esphome/components/binary_sensor/__init__.py +2 -2
- esphome/components/binary_sensor/binary_sensor.cpp +13 -0
- esphome/components/binary_sensor/binary_sensor.h +4 -7
- esphome/components/bl0940/__init__.py +6 -1
- esphome/components/bl0940/bl0940.cpp +178 -41
- esphome/components/bl0940/bl0940.h +121 -76
- esphome/components/bl0940/button/__init__.py +27 -0
- esphome/components/bl0940/button/calibration_reset_button.cpp +20 -0
- esphome/components/bl0940/button/calibration_reset_button.h +19 -0
- esphome/components/bl0940/number/__init__.py +94 -0
- esphome/components/bl0940/number/calibration_number.cpp +29 -0
- esphome/components/bl0940/number/calibration_number.h +26 -0
- esphome/components/bl0940/sensor.py +151 -2
- esphome/components/bl0942/bl0942.cpp +1 -1
- esphome/components/ble_client/output/__init__.py +4 -4
- esphome/components/bluetooth_proxy/__init__.py +1 -1
- esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -1
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +15 -7
- esphome/components/bluetooth_proxy/bluetooth_proxy.h +6 -3
- esphome/components/button/__init__.py +2 -2
- esphome/components/button/button.cpp +13 -0
- esphome/components/button/button.h +4 -7
- esphome/components/camera/buffer.h +18 -0
- esphome/components/camera/buffer_impl.cpp +20 -0
- esphome/components/camera/buffer_impl.h +26 -0
- esphome/components/camera/camera.h +43 -0
- esphome/components/camera/encoder.h +69 -0
- esphome/components/camera_encoder/__init__.py +62 -0
- esphome/components/camera_encoder/encoder_buffer_impl.cpp +23 -0
- esphome/components/camera_encoder/encoder_buffer_impl.h +25 -0
- esphome/components/camera_encoder/esp32_camera_jpeg_encoder.cpp +82 -0
- esphome/components/camera_encoder/esp32_camera_jpeg_encoder.h +39 -0
- esphome/components/captive_portal/__init__.py +2 -2
- esphome/components/captive_portal/captive_index.h +77 -97
- esphome/components/captive_portal/captive_portal.cpp +35 -12
- esphome/components/captive_portal/captive_portal.h +3 -3
- esphome/components/ccs811/ccs811.cpp +3 -3
- esphome/components/climate/__init__.py +2 -2
- esphome/components/climate/climate.cpp +1 -1
- esphome/components/cover/__init__.py +5 -5
- esphome/components/cover/cover.cpp +1 -1
- esphome/components/cover/cover.h +2 -2
- esphome/components/dallas_temp/dallas_temp.cpp +2 -2
- esphome/components/datetime/__init__.py +2 -2
- esphome/components/datetime/date_entity.h +2 -2
- esphome/components/datetime/datetime_entity.h +2 -2
- esphome/components/datetime/time_entity.h +2 -2
- esphome/components/debug/debug_esp32.cpp +1 -1
- esphome/components/display/__init__.py +4 -4
- esphome/components/duty_time/duty_time_sensor.cpp +1 -1
- esphome/components/esp32/__init__.py +0 -5
- esphome/components/esp32/gpio.cpp +27 -23
- esphome/components/esp32/gpio.h +26 -11
- esphome/components/esp32/preferences.cpp +8 -4
- esphome/components/esp32_ble/__init__.py +7 -2
- esphome/components/esp32_ble/ble_uuid.cpp +30 -9
- esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +4 -3
- esphome/components/esp32_ble_client/ble_client_base.cpp +7 -3
- esphome/components/esp32_ble_client/ble_client_base.h +8 -5
- esphome/components/esp32_ble_tracker/__init__.py +2 -2
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +11 -47
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +2 -14
- esphome/components/esp8266/__init__.py +2 -2
- esphome/components/esp8266/core.cpp +2 -2
- esphome/components/esp8266/gpio.py +4 -4
- esphome/components/esp8266/preferences.cpp +30 -28
- esphome/components/esphome/ota/__init__.py +2 -2
- esphome/components/esphome/ota/ota_esphome.cpp +21 -19
- esphome/components/esphome/ota/ota_esphome.h +6 -5
- esphome/components/ethernet/__init__.py +18 -2
- esphome/components/ethernet/ethernet_component.cpp +53 -3
- esphome/components/ethernet/ethernet_component.h +4 -0
- esphome/components/event/__init__.py +2 -2
- esphome/components/event/event.h +4 -4
- esphome/components/factory_reset/button/factory_reset_button.cpp +18 -1
- esphome/components/factory_reset/button/factory_reset_button.h +6 -1
- esphome/components/factory_reset/switch/factory_reset_switch.cpp +18 -1
- esphome/components/factory_reset/switch/factory_reset_switch.h +5 -1
- esphome/components/fan/__init__.py +2 -2
- esphome/components/fan/fan.cpp +2 -1
- esphome/components/gdk101/gdk101.cpp +4 -4
- esphome/components/globals/__init__.py +2 -2
- esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp +19 -18
- esphome/components/gpio_expander/cached_gpio.h +36 -16
- esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp +5 -5
- esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +1 -1
- esphome/components/haier/haier_base.cpp +1 -1
- esphome/components/haier/hon_climate.cpp +1 -1
- esphome/components/hlw8012/hlw8012.cpp +5 -5
- esphome/components/honeywellabp2_i2c/honeywellabp2.cpp +4 -4
- esphome/components/host/preferences.h +3 -2
- esphome/components/hte501/hte501.cpp +3 -21
- esphome/components/hte501/hte501.h +2 -3
- esphome/components/http_request/ota/__init__.py +2 -2
- esphome/components/i2c/__init__.py +2 -2
- esphome/components/i2c/i2c.cpp +13 -9
- esphome/components/i2c/i2c_bus.h +36 -6
- esphome/components/i2s_audio/__init__.py +8 -2
- esphome/components/i2s_audio/media_player/__init__.py +1 -1
- esphome/components/i2s_audio/microphone/__init__.py +1 -1
- esphome/components/i2s_audio/speaker/__init__.py +1 -1
- esphome/components/ina2xx_base/__init__.py +4 -2
- esphome/components/inkplate/__init__.py +1 -0
- esphome/components/inkplate/const.py +105 -0
- esphome/components/inkplate/display.py +238 -0
- esphome/components/{inkplate6 → inkplate}/inkplate.cpp +156 -74
- esphome/components/{inkplate6 → inkplate}/inkplate.h +28 -68
- esphome/components/inkplate6/__init__.py +0 -1
- esphome/components/inkplate6/display.py +2 -211
- esphome/components/integration/integration_sensor.cpp +1 -1
- esphome/components/json/__init__.py +2 -2
- esphome/components/lc709203f/lc709203f.cpp +4 -17
- esphome/components/lc709203f/lc709203f.h +2 -3
- esphome/components/ld2420/text_sensor/{text_sensor.cpp → ld2420_text_sensor.cpp} +1 -1
- esphome/components/ld2450/ld2450.cpp +1 -1
- esphome/components/libretiny/preferences.cpp +13 -5
- esphome/components/light/__init__.py +2 -2
- esphome/components/light/addressable_light_effect.h +7 -0
- esphome/components/light/base_light_effects.h +8 -0
- esphome/components/light/light_call.cpp +22 -20
- esphome/components/light/light_effect.cpp +36 -0
- esphome/components/light/light_effect.h +14 -0
- esphome/components/light/light_json_schema.cpp +9 -1
- esphome/components/light/light_state.cpp +2 -2
- esphome/components/light/light_state.h +38 -0
- esphome/components/lock/__init__.py +2 -2
- esphome/components/lock/lock.h +2 -2
- esphome/components/logger/__init__.py +2 -2
- esphome/components/logger/logger.cpp +25 -4
- esphome/components/logger/logger.h +1 -1
- esphome/components/logger/logger_esp32.cpp +16 -8
- esphome/components/logger/logger_esp8266.cpp +11 -3
- esphome/components/logger/logger_libretiny.cpp +13 -3
- esphome/components/logger/logger_rp2040.cpp +14 -3
- esphome/components/logger/logger_zephyr.cpp +15 -4
- esphome/components/lvgl/defines.py +1 -0
- esphome/components/lvgl/hello_world.py +96 -33
- esphome/components/lvgl/number/lvgl_number.h +1 -1
- esphome/components/lvgl/select/lvgl_select.h +1 -1
- esphome/components/lvgl/widgets/__init__.py +0 -1
- esphome/components/lvgl/widgets/spinbox.py +20 -11
- esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.cpp +1 -1
- esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.cpp +1 -1
- esphome/components/mapping/__init__.py +13 -5
- esphome/components/mapping/mapping.h +69 -0
- esphome/components/max17043/max17043.cpp +2 -2
- esphome/components/mcp23016/__init__.py +1 -0
- esphome/components/mcp23016/mcp23016.cpp +20 -5
- esphome/components/mcp23016/mcp23016.h +10 -4
- esphome/components/mcp23x08_base/mcp23x08_base.cpp +1 -1
- esphome/components/mcp23x17_base/mcp23x17_base.cpp +2 -2
- esphome/components/md5/md5.cpp +3 -2
- esphome/components/mdns/__init__.py +2 -2
- esphome/components/mdns/mdns_component.cpp +145 -54
- esphome/components/media_player/__init__.py +2 -2
- esphome/components/micro_wake_word/__init__.py +2 -2
- esphome/components/microphone/__init__.py +2 -2
- esphome/components/mipi/__init__.py +77 -33
- esphome/components/mipi_rgb/__init__.py +2 -0
- esphome/components/mipi_rgb/display.py +321 -0
- esphome/components/mipi_rgb/mipi_rgb.cpp +388 -0
- esphome/components/mipi_rgb/mipi_rgb.h +127 -0
- esphome/components/mipi_rgb/models/guition.py +24 -0
- esphome/components/mipi_rgb/models/lilygo.py +228 -0
- esphome/components/mipi_rgb/models/rpi.py +9 -0
- esphome/components/mipi_rgb/models/st7701s.py +214 -0
- esphome/components/mipi_rgb/models/waveshare.py +64 -0
- esphome/components/mipi_spi/models/jc.py +229 -0
- esphome/components/mlx90614/mlx90614.cpp +1 -16
- esphome/components/mlx90614/mlx90614.h +0 -1
- esphome/components/mqtt/__init__.py +2 -2
- esphome/components/mqtt/mqtt_client.cpp +1 -1
- esphome/components/mqtt/mqtt_sensor.cpp +7 -2
- esphome/components/ms5611/ms5611.cpp +7 -6
- esphome/components/network/__init__.py +2 -2
- esphome/components/nextion/nextion_upload.cpp +4 -1
- esphome/components/nrf52/__init__.py +49 -6
- esphome/components/nrf52/const.py +1 -0
- esphome/components/nrf52/dfu.cpp +51 -0
- esphome/components/nrf52/dfu.h +24 -0
- esphome/components/ntc/ntc.cpp +1 -1
- esphome/components/number/__init__.py +2 -2
- esphome/components/number/automation.cpp +1 -1
- esphome/components/number/number.cpp +21 -0
- esphome/components/number/number.h +4 -13
- esphome/components/opentherm/hub.h +6 -6
- esphome/components/opentherm/number/{number.cpp → opentherm_number.cpp} +2 -2
- esphome/components/opentherm/output/{output.cpp → opentherm_output.cpp} +1 -1
- esphome/components/opentherm/switch/{switch.cpp → opentherm_switch.cpp} +1 -1
- esphome/components/openthread/openthread.cpp +41 -7
- esphome/components/openthread/openthread.h +11 -0
- esphome/components/ota/__init__.py +2 -2
- esphome/components/pca6416a/__init__.py +1 -0
- esphome/components/pca6416a/pca6416a.cpp +20 -5
- esphome/components/pca6416a/pca6416a.h +12 -5
- esphome/components/pca9554/__init__.py +2 -1
- esphome/components/pca9554/pca9554.cpp +12 -18
- esphome/components/pca9554/pca9554.h +10 -9
- esphome/components/pcf8574/__init__.py +1 -0
- esphome/components/pcf8574/pcf8574.cpp +14 -5
- esphome/components/pcf8574/pcf8574.h +13 -6
- esphome/components/pi4ioe5v6408/pi4ioe5v6408.cpp +7 -7
- esphome/components/pipsolar/__init__.py +3 -3
- esphome/components/pipsolar/output/__init__.py +4 -4
- esphome/components/pulse_width/pulse_width.cpp +2 -2
- esphome/components/qmp6988/qmp6988.cpp +81 -126
- esphome/components/qmp6988/qmp6988.h +31 -37
- esphome/components/radon_eye_ble/__init__.py +2 -2
- esphome/components/remote_base/__init__.py +6 -8
- esphome/components/rotary_encoder/rotary_encoder.cpp +1 -1
- esphome/components/rp2040/__init__.py +2 -2
- esphome/components/runtime_stats/runtime_stats.cpp +10 -23
- esphome/components/runtime_stats/runtime_stats.h +4 -10
- esphome/components/safe_mode/__init__.py +2 -2
- esphome/components/safe_mode/safe_mode.cpp +33 -31
- esphome/components/script/script.cpp +6 -0
- esphome/components/script/script.h +19 -5
- esphome/components/sdm_meter/sensor.py +3 -1
- esphome/components/select/__init__.py +2 -2
- esphome/components/select/select.cpp +3 -3
- esphome/components/select/select.h +2 -2
- esphome/components/select/select_call.cpp +1 -1
- esphome/components/sen5x/sen5x.cpp +57 -55
- esphome/components/sen5x/sen5x.h +21 -15
- esphome/components/sen5x/sensor.py +67 -44
- esphome/components/sensirion_common/i2c_sensirion.cpp +18 -47
- esphome/components/sensirion_common/i2c_sensirion.h +39 -55
- esphome/components/sensor/__init__.py +2 -2
- esphome/components/sensor/automation.h +1 -1
- esphome/components/sensor/sensor.cpp +34 -6
- esphome/components/sensor/sensor.h +4 -21
- esphome/components/sgp30/sgp30.cpp +34 -35
- esphome/components/sgp30/sgp30.h +11 -10
- esphome/components/sgp4x/sgp4x.cpp +2 -2
- esphome/components/shelly_dimmer/light.py +7 -7
- esphome/components/sht4x/sht4x.cpp +1 -1
- esphome/components/sntp/sntp_component.cpp +36 -9
- esphome/components/sntp/sntp_component.h +7 -0
- esphome/components/sound_level/sound_level.cpp +1 -1
- esphome/components/speaker/__init__.py +2 -2
- esphome/components/speaker/media_player/__init__.py +2 -2
- esphome/components/speaker/media_player/speaker_media_player.cpp +1 -1
- esphome/components/spi/__init__.py +2 -2
- esphome/components/sprinkler/sprinkler.cpp +1 -1
- esphome/components/sps30/sps30.cpp +18 -23
- esphome/components/sps30/sps30.h +3 -3
- esphome/components/status_led/__init__.py +2 -2
- esphome/components/stepper/__init__.py +2 -2
- esphome/components/switch/__init__.py +2 -2
- esphome/components/switch/switch.cpp +5 -5
- esphome/components/sx1509/__init__.py +1 -1
- esphome/components/sx1509/sx1509.cpp +12 -7
- esphome/components/sx1509/sx1509.h +11 -4
- esphome/components/tca9555/tca9555.cpp +5 -5
- esphome/components/tee501/tee501.cpp +2 -21
- esphome/components/tee501/tee501.h +2 -4
- esphome/components/template/alarm_control_panel/template_alarm_control_panel.cpp +1 -1
- esphome/components/template/datetime/template_date.cpp +1 -1
- esphome/components/template/datetime/template_datetime.cpp +2 -2
- esphome/components/template/datetime/template_time.cpp +1 -1
- esphome/components/template/number/template_number.cpp +1 -1
- esphome/components/template/select/template_select.cpp +1 -1
- esphome/components/template/text/template_text.cpp +1 -1
- esphome/components/text/__init__.py +2 -2
- esphome/components/text/text.h +2 -2
- esphome/components/text_sensor/__init__.py +2 -2
- esphome/components/text_sensor/text_sensor.h +4 -4
- esphome/components/thermostat/climate.py +11 -7
- esphome/components/thermostat/thermostat_climate.cpp +237 -206
- esphome/components/thermostat/thermostat_climate.h +52 -41
- esphome/components/time/__init__.py +2 -2
- esphome/components/tmp1075/tmp1075.cpp +1 -1
- esphome/components/total_daily_energy/total_daily_energy.cpp +1 -1
- esphome/components/touchscreen/__init__.py +2 -2
- esphome/components/tuya/number/tuya_number.cpp +1 -1
- esphome/components/udp/udp_component.cpp +3 -3
- esphome/components/ufire_ec/ufire_ec.cpp +4 -4
- esphome/components/ufire_ise/ufire_ise.cpp +4 -4
- esphome/components/update/__init__.py +2 -2
- esphome/components/usb_uart/usb_uart.cpp +1 -1
- esphome/components/valve/__init__.py +5 -5
- esphome/components/valve/valve.cpp +1 -1
- esphome/components/valve/valve.h +2 -2
- esphome/components/wake_on_lan/wake_on_lan.cpp +2 -2
- esphome/components/waveshare_epaper/waveshare_213v3.cpp +1 -1
- esphome/components/web_server/__init__.py +2 -2
- esphome/components/web_server/ota/__init__.py +2 -2
- esphome/components/web_server/ota/ota_web_server.cpp +11 -0
- esphome/components/web_server/server_index_v2.h +149 -149
- esphome/components/web_server/web_server.cpp +58 -12
- esphome/components/web_server_base/__init__.py +2 -2
- esphome/components/wifi/__init__.py +5 -5
- esphome/components/wifi/wifi_component.cpp +4 -4
- esphome/components/wifi/wifi_component_esp_idf.cpp +2 -0
- esphome/components/wifi_info/wifi_info_text_sensor.h +3 -2
- esphome/config_validation.py +2 -2
- esphome/const.py +3 -1
- esphome/core/__init__.py +1 -0
- esphome/core/application.cpp +89 -51
- esphome/core/application.h +1 -0
- esphome/core/component.cpp +41 -19
- esphome/core/component.h +17 -13
- esphome/core/config.py +7 -7
- esphome/core/defines.h +5 -0
- esphome/core/entity_base.cpp +22 -8
- esphome/core/entity_base.h +43 -0
- esphome/core/helpers.cpp +34 -20
- esphome/core/helpers.h +33 -3
- esphome/core/ring_buffer.cpp +6 -2
- esphome/core/ring_buffer.h +2 -1
- esphome/core/scheduler.cpp +178 -97
- esphome/core/scheduler.h +67 -36
- esphome/core/time.cpp +6 -20
- esphome/coroutine.py +80 -3
- esphome/cpp_generator.py +13 -0
- esphome/cpp_helpers.py +2 -2
- esphome/dashboard/web_server.py +69 -15
- esphome/espota2.py +13 -6
- esphome/helpers.py +68 -83
- esphome/resolver.py +67 -0
- esphome/util.py +9 -6
- esphome/wizard.py +81 -34
- esphome/writer.py +13 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0.dist-info}/METADATA +9 -9
- {esphome-2025.8.4.dist-info → esphome-2025.9.0.dist-info}/RECORD +369 -338
- /esphome/components/ld2420/text_sensor/{text_sensor.h → ld2420_text_sensor.h} +0 -0
- /esphome/components/opentherm/number/{number.h → opentherm_number.h} +0 -0
- /esphome/components/opentherm/output/{output.h → opentherm_output.h} +0 -0
- /esphome/components/opentherm/switch/{switch.h → opentherm_switch.h} +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0.dist-info}/WHEEL +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0.dist-info}/entry_points.txt +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0.dist-info}/licenses/LICENSE +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/core/helpers.h"
|
4
|
+
#include "esphome/core/log.h"
|
5
|
+
#include <map>
|
6
|
+
#include <string>
|
7
|
+
|
8
|
+
namespace esphome::mapping {
|
9
|
+
|
10
|
+
using alloc_string_t = std::basic_string<char, std::char_traits<char>, RAMAllocator<char>>;
|
11
|
+
|
12
|
+
/**
|
13
|
+
*
|
14
|
+
* Mapping class with custom allocator.
|
15
|
+
* Additionally, when std::string is used as key or value, it will be replaced with a custom string type
|
16
|
+
* that uses RAMAllocator.
|
17
|
+
* @tparam K The type of the key in the mapping.
|
18
|
+
* @tparam V The type of the value in the mapping. Should be a basic type or pointer.
|
19
|
+
*/
|
20
|
+
|
21
|
+
static const char *const TAG = "mapping";
|
22
|
+
|
23
|
+
template<typename K, typename V> class Mapping {
|
24
|
+
public:
|
25
|
+
// Constructor
|
26
|
+
Mapping() = default;
|
27
|
+
|
28
|
+
using key_t = const std::conditional_t<std::is_same_v<K, std::string>,
|
29
|
+
alloc_string_t, // if K is std::string, custom string type
|
30
|
+
K>;
|
31
|
+
using value_t = std::conditional_t<std::is_same_v<V, std::string>,
|
32
|
+
alloc_string_t, // if V is std::string, custom string type
|
33
|
+
V>;
|
34
|
+
|
35
|
+
void set(const K &key, const V &value) { this->map_[key_t{key}] = value; }
|
36
|
+
|
37
|
+
V get(const K &key) const {
|
38
|
+
auto it = this->map_.find(key_t{key});
|
39
|
+
if (it != this->map_.end()) {
|
40
|
+
return V{it->second};
|
41
|
+
}
|
42
|
+
if constexpr (std::is_pointer_v<K>) {
|
43
|
+
esph_log_e(TAG, "Key '%p' not found in mapping", key);
|
44
|
+
} else if constexpr (std::is_same_v<K, std::string>) {
|
45
|
+
esph_log_e(TAG, "Key '%s' not found in mapping", key.c_str());
|
46
|
+
} else {
|
47
|
+
esph_log_e(TAG, "Key '%s' not found in mapping", to_string(key).c_str());
|
48
|
+
}
|
49
|
+
return {};
|
50
|
+
}
|
51
|
+
|
52
|
+
// index map overload
|
53
|
+
V operator[](K key) { return this->get(key); }
|
54
|
+
|
55
|
+
// convenience function for strings to get a C-style string
|
56
|
+
template<typename T = V, std::enable_if_t<std::is_same_v<T, std::string>, int> = 0>
|
57
|
+
const char *operator[](K key) const {
|
58
|
+
auto it = this->map_.find(key_t{key});
|
59
|
+
if (it != this->map_.end()) {
|
60
|
+
return it->second.c_str(); // safe since value remains in map
|
61
|
+
}
|
62
|
+
return "";
|
63
|
+
}
|
64
|
+
|
65
|
+
protected:
|
66
|
+
std::map<key_t, value_t, std::less<key_t>, RAMAllocator<std::pair<key_t, value_t>>> map_;
|
67
|
+
};
|
68
|
+
|
69
|
+
} // namespace esphome::mapping
|
@@ -22,7 +22,7 @@ void MAX17043Component::update() {
|
|
22
22
|
|
23
23
|
if (this->voltage_sensor_ != nullptr) {
|
24
24
|
if (!this->read_byte_16(MAX17043_VCELL, &raw_voltage)) {
|
25
|
-
this->status_set_warning("Unable to read MAX17043_VCELL");
|
25
|
+
this->status_set_warning(LOG_STR("Unable to read MAX17043_VCELL"));
|
26
26
|
} else {
|
27
27
|
float voltage = (1.25 * (float) (raw_voltage >> 4)) / 1000.0;
|
28
28
|
this->voltage_sensor_->publish_state(voltage);
|
@@ -31,7 +31,7 @@ void MAX17043Component::update() {
|
|
31
31
|
}
|
32
32
|
if (this->battery_remaining_sensor_ != nullptr) {
|
33
33
|
if (!this->read_byte_16(MAX17043_SOC, &raw_percent)) {
|
34
|
-
this->status_set_warning("Unable to read MAX17043_SOC");
|
34
|
+
this->status_set_warning(LOG_STR("Unable to read MAX17043_SOC"));
|
35
35
|
} else {
|
36
36
|
float percent = (float) ((raw_percent >> 8) + 0.003906f * (raw_percent & 0x00ff));
|
37
37
|
this->battery_remaining_sensor_->publish_state(percent);
|
@@ -22,14 +22,29 @@ void MCP23016::setup() {
|
|
22
22
|
this->write_reg_(MCP23016_IODIR0, 0xFF);
|
23
23
|
this->write_reg_(MCP23016_IODIR1, 0xFF);
|
24
24
|
}
|
25
|
-
|
26
|
-
|
25
|
+
|
26
|
+
void MCP23016::loop() {
|
27
|
+
// Invalidate cache at the start of each loop
|
28
|
+
this->reset_pin_cache_();
|
29
|
+
}
|
30
|
+
bool MCP23016::digital_read_hw(uint8_t pin) {
|
27
31
|
uint8_t reg_addr = pin < 8 ? MCP23016_GP0 : MCP23016_GP1;
|
28
32
|
uint8_t value = 0;
|
29
|
-
this->read_reg_(reg_addr, &value)
|
30
|
-
|
33
|
+
if (!this->read_reg_(reg_addr, &value)) {
|
34
|
+
return false;
|
35
|
+
}
|
36
|
+
|
37
|
+
// Update the appropriate part of input_mask_
|
38
|
+
if (pin < 8) {
|
39
|
+
this->input_mask_ = (this->input_mask_ & 0xFF00) | value;
|
40
|
+
} else {
|
41
|
+
this->input_mask_ = (this->input_mask_ & 0x00FF) | (uint16_t(value) << 8);
|
42
|
+
}
|
43
|
+
return true;
|
31
44
|
}
|
32
|
-
|
45
|
+
|
46
|
+
bool MCP23016::digital_read_cache(uint8_t pin) { return this->input_mask_ & (1 << pin); }
|
47
|
+
void MCP23016::digital_write_hw(uint8_t pin, bool value) {
|
33
48
|
uint8_t reg_addr = pin < 8 ? MCP23016_OLAT0 : MCP23016_OLAT1;
|
34
49
|
this->update_reg_(pin, value, reg_addr);
|
35
50
|
}
|
@@ -3,6 +3,7 @@
|
|
3
3
|
#include "esphome/core/component.h"
|
4
4
|
#include "esphome/core/hal.h"
|
5
5
|
#include "esphome/components/i2c/i2c.h"
|
6
|
+
#include "esphome/components/gpio_expander/cached_gpio.h"
|
6
7
|
|
7
8
|
namespace esphome {
|
8
9
|
namespace mcp23016 {
|
@@ -24,19 +25,22 @@ enum MCP23016GPIORegisters {
|
|
24
25
|
MCP23016_IOCON1 = 0x0B,
|
25
26
|
};
|
26
27
|
|
27
|
-
class MCP23016 : public Component, public i2c::I2CDevice {
|
28
|
+
class MCP23016 : public Component, public i2c::I2CDevice, public gpio_expander::CachedGpioExpander<uint8_t, 16> {
|
28
29
|
public:
|
29
30
|
MCP23016() = default;
|
30
31
|
|
31
32
|
void setup() override;
|
32
|
-
|
33
|
-
bool digital_read(uint8_t pin);
|
34
|
-
void digital_write(uint8_t pin, bool value);
|
33
|
+
void loop() override;
|
35
34
|
void pin_mode(uint8_t pin, gpio::Flags flags);
|
36
35
|
|
37
36
|
float get_setup_priority() const override;
|
38
37
|
|
39
38
|
protected:
|
39
|
+
// Virtual methods from CachedGpioExpander
|
40
|
+
bool digital_read_hw(uint8_t pin) override;
|
41
|
+
bool digital_read_cache(uint8_t pin) override;
|
42
|
+
void digital_write_hw(uint8_t pin, bool value) override;
|
43
|
+
|
40
44
|
// read a given register
|
41
45
|
bool read_reg_(uint8_t reg, uint8_t *value);
|
42
46
|
// write a value to a given register
|
@@ -46,6 +50,8 @@ class MCP23016 : public Component, public i2c::I2CDevice {
|
|
46
50
|
|
47
51
|
uint8_t olat_0_{0x00};
|
48
52
|
uint8_t olat_1_{0x00};
|
53
|
+
// Cache for input values (16-bit combined for both banks)
|
54
|
+
uint16_t input_mask_{0x00};
|
49
55
|
};
|
50
56
|
|
51
57
|
class MCP23016GPIOPin : public GPIOPin {
|
@@ -8,7 +8,7 @@ static const char *const TAG = "mcp23x08_base";
|
|
8
8
|
|
9
9
|
bool MCP23X08Base::digital_read_hw(uint8_t pin) {
|
10
10
|
if (!this->read_reg(mcp23x08_base::MCP23X08_GPIO, &this->input_mask_)) {
|
11
|
-
this->status_set_warning(ESP_LOG_MSG_COMM_FAIL);
|
11
|
+
this->status_set_warning(LOG_STR(ESP_LOG_MSG_COMM_FAIL));
|
12
12
|
return false;
|
13
13
|
}
|
14
14
|
return true;
|
@@ -11,13 +11,13 @@ bool MCP23X17Base::digital_read_hw(uint8_t pin) {
|
|
11
11
|
uint8_t data;
|
12
12
|
if (pin < 8) {
|
13
13
|
if (!this->read_reg(mcp23x17_base::MCP23X17_GPIOA, &data)) {
|
14
|
-
this->status_set_warning(ESP_LOG_MSG_COMM_FAIL);
|
14
|
+
this->status_set_warning(LOG_STR(ESP_LOG_MSG_COMM_FAIL));
|
15
15
|
return false;
|
16
16
|
}
|
17
17
|
this->input_mask_ = encode_uint16(this->input_mask_ >> 8, data);
|
18
18
|
} else {
|
19
19
|
if (!this->read_reg(mcp23x17_base::MCP23X17_GPIOB, &data)) {
|
20
|
-
this->status_set_warning(ESP_LOG_MSG_COMM_FAIL);
|
20
|
+
this->status_set_warning(LOG_STR(ESP_LOG_MSG_COMM_FAIL));
|
21
21
|
return false;
|
22
22
|
}
|
23
23
|
this->input_mask_ = encode_uint16(data, this->input_mask_ & 0xFF);
|
esphome/components/md5/md5.cpp
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#include <cstdio>
|
2
1
|
#include <cstring>
|
3
2
|
#include "md5.h"
|
4
3
|
#ifdef USE_MD5
|
@@ -44,7 +43,9 @@ void MD5Digest::get_bytes(uint8_t *output) { memcpy(output, this->digest_, 16);
|
|
44
43
|
|
45
44
|
void MD5Digest::get_hex(char *output) {
|
46
45
|
for (size_t i = 0; i < 16; i++) {
|
47
|
-
|
46
|
+
uint8_t byte = this->digest_[i];
|
47
|
+
output[i * 2] = format_hex_char(byte >> 4);
|
48
|
+
output[i * 2 + 1] = format_hex_char(byte & 0x0F);
|
48
49
|
}
|
49
50
|
}
|
50
51
|
|
@@ -11,7 +11,7 @@ from esphome.const import (
|
|
11
11
|
CONF_SERVICES,
|
12
12
|
PlatformFramework,
|
13
13
|
)
|
14
|
-
from esphome.core import CORE, coroutine_with_priority
|
14
|
+
from esphome.core import CORE, CoroPriority, coroutine_with_priority
|
15
15
|
|
16
16
|
CODEOWNERS = ["@esphome/core"]
|
17
17
|
DEPENDENCIES = ["network"]
|
@@ -72,7 +72,7 @@ def mdns_service(
|
|
72
72
|
)
|
73
73
|
|
74
74
|
|
75
|
-
@coroutine_with_priority(
|
75
|
+
@coroutine_with_priority(CoroPriority.COMMUNICATION)
|
76
76
|
async def to_code(config):
|
77
77
|
if config[CONF_DISABLED] is True:
|
78
78
|
return
|
@@ -5,6 +5,30 @@
|
|
5
5
|
#include "esphome/core/version.h"
|
6
6
|
#include "mdns_component.h"
|
7
7
|
|
8
|
+
#ifdef USE_ESP8266
|
9
|
+
#include <pgmspace.h>
|
10
|
+
// Macro to define strings in PROGMEM on ESP8266, regular memory on other platforms
|
11
|
+
#define MDNS_STATIC_CONST_CHAR(name, value) static const char name[] PROGMEM = value
|
12
|
+
// Helper to get string from PROGMEM - returns a temporary std::string
|
13
|
+
// Only define this function if we have services that will use it
|
14
|
+
#if defined(USE_API) || defined(USE_PROMETHEUS) || defined(USE_WEBSERVER) || defined(USE_MDNS_EXTRA_SERVICES)
|
15
|
+
static std::string mdns_string_p(const char *src) {
|
16
|
+
char buf[64];
|
17
|
+
strncpy_P(buf, src, sizeof(buf) - 1);
|
18
|
+
buf[sizeof(buf) - 1] = '\0';
|
19
|
+
return std::string(buf);
|
20
|
+
}
|
21
|
+
#define MDNS_STR(name) mdns_string_p(name)
|
22
|
+
#else
|
23
|
+
// If no services are configured, we still need the fallback service but it uses string literals
|
24
|
+
#define MDNS_STR(name) std::string(name)
|
25
|
+
#endif
|
26
|
+
#else
|
27
|
+
// On non-ESP8266 platforms, use regular const char*
|
28
|
+
#define MDNS_STATIC_CONST_CHAR(name, value) static constexpr const char *name = value
|
29
|
+
#define MDNS_STR(name) name
|
30
|
+
#endif
|
31
|
+
|
8
32
|
#ifdef USE_API
|
9
33
|
#include "esphome/components/api/api_server.h"
|
10
34
|
#endif
|
@@ -21,103 +45,168 @@ static const char *const TAG = "mdns";
|
|
21
45
|
#define USE_WEBSERVER_PORT 80 // NOLINT
|
22
46
|
#endif
|
23
47
|
|
48
|
+
// Define all constant strings using the macro
|
49
|
+
MDNS_STATIC_CONST_CHAR(SERVICE_ESPHOMELIB, "_esphomelib");
|
50
|
+
MDNS_STATIC_CONST_CHAR(SERVICE_TCP, "_tcp");
|
51
|
+
MDNS_STATIC_CONST_CHAR(SERVICE_PROMETHEUS, "_prometheus-http");
|
52
|
+
MDNS_STATIC_CONST_CHAR(SERVICE_HTTP, "_http");
|
53
|
+
|
54
|
+
MDNS_STATIC_CONST_CHAR(TXT_FRIENDLY_NAME, "friendly_name");
|
55
|
+
MDNS_STATIC_CONST_CHAR(TXT_VERSION, "version");
|
56
|
+
MDNS_STATIC_CONST_CHAR(TXT_MAC, "mac");
|
57
|
+
MDNS_STATIC_CONST_CHAR(TXT_PLATFORM, "platform");
|
58
|
+
MDNS_STATIC_CONST_CHAR(TXT_BOARD, "board");
|
59
|
+
MDNS_STATIC_CONST_CHAR(TXT_NETWORK, "network");
|
60
|
+
MDNS_STATIC_CONST_CHAR(TXT_API_ENCRYPTION, "api_encryption");
|
61
|
+
MDNS_STATIC_CONST_CHAR(TXT_API_ENCRYPTION_SUPPORTED, "api_encryption_supported");
|
62
|
+
MDNS_STATIC_CONST_CHAR(TXT_PROJECT_NAME, "project_name");
|
63
|
+
MDNS_STATIC_CONST_CHAR(TXT_PROJECT_VERSION, "project_version");
|
64
|
+
MDNS_STATIC_CONST_CHAR(TXT_PACKAGE_IMPORT_URL, "package_import_url");
|
65
|
+
|
66
|
+
MDNS_STATIC_CONST_CHAR(PLATFORM_ESP8266, "ESP8266");
|
67
|
+
MDNS_STATIC_CONST_CHAR(PLATFORM_ESP32, "ESP32");
|
68
|
+
MDNS_STATIC_CONST_CHAR(PLATFORM_RP2040, "RP2040");
|
69
|
+
|
70
|
+
MDNS_STATIC_CONST_CHAR(NETWORK_WIFI, "wifi");
|
71
|
+
MDNS_STATIC_CONST_CHAR(NETWORK_ETHERNET, "ethernet");
|
72
|
+
MDNS_STATIC_CONST_CHAR(NETWORK_THREAD, "thread");
|
73
|
+
|
24
74
|
void MDNSComponent::compile_records_() {
|
25
75
|
this->hostname_ = App.get_name();
|
26
76
|
|
27
|
-
|
77
|
+
// Calculate exact capacity needed for services vector
|
78
|
+
size_t services_count = 0;
|
79
|
+
#ifdef USE_API
|
80
|
+
if (api::global_api_server != nullptr) {
|
81
|
+
services_count++;
|
82
|
+
}
|
83
|
+
#endif
|
84
|
+
#ifdef USE_PROMETHEUS
|
85
|
+
services_count++;
|
86
|
+
#endif
|
87
|
+
#ifdef USE_WEBSERVER
|
88
|
+
services_count++;
|
89
|
+
#endif
|
90
|
+
#ifdef USE_MDNS_EXTRA_SERVICES
|
91
|
+
services_count += this->services_extra_.size();
|
92
|
+
#endif
|
93
|
+
// Reserve for fallback service if needed
|
94
|
+
if (services_count == 0) {
|
95
|
+
services_count = 1;
|
96
|
+
}
|
97
|
+
this->services_.reserve(services_count);
|
98
|
+
|
28
99
|
#ifdef USE_API
|
29
100
|
if (api::global_api_server != nullptr) {
|
30
|
-
|
31
|
-
service
|
32
|
-
service.
|
101
|
+
this->services_.emplace_back();
|
102
|
+
auto &service = this->services_.back();
|
103
|
+
service.service_type = MDNS_STR(SERVICE_ESPHOMELIB);
|
104
|
+
service.proto = MDNS_STR(SERVICE_TCP);
|
33
105
|
service.port = api::global_api_server->get_port();
|
34
|
-
|
35
|
-
|
106
|
+
|
107
|
+
const std::string &friendly_name = App.get_friendly_name();
|
108
|
+
bool friendly_name_empty = friendly_name.empty();
|
109
|
+
|
110
|
+
// Calculate exact capacity for txt_records
|
111
|
+
size_t txt_count = 3; // version, mac, board (always present)
|
112
|
+
if (!friendly_name_empty) {
|
113
|
+
txt_count++; // friendly_name
|
36
114
|
}
|
37
|
-
|
38
|
-
|
39
|
-
const char *platform = nullptr;
|
40
|
-
#ifdef USE_ESP8266
|
41
|
-
platform = "ESP8266";
|
115
|
+
#if defined(USE_ESP8266) || defined(USE_ESP32) || defined(USE_RP2040) || defined(USE_LIBRETINY)
|
116
|
+
txt_count++; // platform
|
42
117
|
#endif
|
43
|
-
#
|
44
|
-
|
118
|
+
#if defined(USE_WIFI) || defined(USE_ETHERNET) || defined(USE_OPENTHREAD)
|
119
|
+
txt_count++; // network
|
45
120
|
#endif
|
46
|
-
#ifdef
|
47
|
-
|
121
|
+
#ifdef USE_API_NOISE
|
122
|
+
txt_count++; // api_encryption or api_encryption_supported
|
48
123
|
#endif
|
49
|
-
#ifdef
|
50
|
-
|
124
|
+
#ifdef ESPHOME_PROJECT_NAME
|
125
|
+
txt_count += 2; // project_name and project_version
|
51
126
|
#endif
|
52
|
-
|
53
|
-
|
127
|
+
#ifdef USE_DASHBOARD_IMPORT
|
128
|
+
txt_count++; // package_import_url
|
129
|
+
#endif
|
130
|
+
|
131
|
+
auto &txt_records = service.txt_records;
|
132
|
+
txt_records.reserve(txt_count);
|
133
|
+
|
134
|
+
if (!friendly_name_empty) {
|
135
|
+
txt_records.push_back({MDNS_STR(TXT_FRIENDLY_NAME), friendly_name});
|
54
136
|
}
|
137
|
+
txt_records.push_back({MDNS_STR(TXT_VERSION), ESPHOME_VERSION});
|
138
|
+
txt_records.push_back({MDNS_STR(TXT_MAC), get_mac_address()});
|
55
139
|
|
56
|
-
|
140
|
+
#ifdef USE_ESP8266
|
141
|
+
txt_records.push_back({MDNS_STR(TXT_PLATFORM), MDNS_STR(PLATFORM_ESP8266)});
|
142
|
+
#elif defined(USE_ESP32)
|
143
|
+
txt_records.push_back({MDNS_STR(TXT_PLATFORM), MDNS_STR(PLATFORM_ESP32)});
|
144
|
+
#elif defined(USE_RP2040)
|
145
|
+
txt_records.push_back({MDNS_STR(TXT_PLATFORM), MDNS_STR(PLATFORM_RP2040)});
|
146
|
+
#elif defined(USE_LIBRETINY)
|
147
|
+
txt_records.emplace_back(MDNSTXTRecord{"platform", lt_cpu_get_model_name()});
|
148
|
+
#endif
|
149
|
+
|
150
|
+
txt_records.push_back({MDNS_STR(TXT_BOARD), ESPHOME_BOARD});
|
57
151
|
|
58
152
|
#if defined(USE_WIFI)
|
59
|
-
|
153
|
+
txt_records.push_back({MDNS_STR(TXT_NETWORK), MDNS_STR(NETWORK_WIFI)});
|
60
154
|
#elif defined(USE_ETHERNET)
|
61
|
-
|
155
|
+
txt_records.push_back({MDNS_STR(TXT_NETWORK), MDNS_STR(NETWORK_ETHERNET)});
|
62
156
|
#elif defined(USE_OPENTHREAD)
|
63
|
-
|
157
|
+
txt_records.push_back({MDNS_STR(TXT_NETWORK), MDNS_STR(NETWORK_THREAD)});
|
64
158
|
#endif
|
65
159
|
|
66
160
|
#ifdef USE_API_NOISE
|
161
|
+
MDNS_STATIC_CONST_CHAR(NOISE_ENCRYPTION, "Noise_NNpsk0_25519_ChaChaPoly_SHA256");
|
67
162
|
if (api::global_api_server->get_noise_ctx()->has_psk()) {
|
68
|
-
|
163
|
+
txt_records.push_back({MDNS_STR(TXT_API_ENCRYPTION), MDNS_STR(NOISE_ENCRYPTION)});
|
69
164
|
} else {
|
70
|
-
|
165
|
+
txt_records.push_back({MDNS_STR(TXT_API_ENCRYPTION_SUPPORTED), MDNS_STR(NOISE_ENCRYPTION)});
|
71
166
|
}
|
72
167
|
#endif
|
73
168
|
|
74
169
|
#ifdef ESPHOME_PROJECT_NAME
|
75
|
-
|
76
|
-
|
170
|
+
txt_records.push_back({MDNS_STR(TXT_PROJECT_NAME), ESPHOME_PROJECT_NAME});
|
171
|
+
txt_records.push_back({MDNS_STR(TXT_PROJECT_VERSION), ESPHOME_PROJECT_VERSION});
|
77
172
|
#endif // ESPHOME_PROJECT_NAME
|
78
173
|
|
79
174
|
#ifdef USE_DASHBOARD_IMPORT
|
80
|
-
|
175
|
+
txt_records.push_back({MDNS_STR(TXT_PACKAGE_IMPORT_URL), dashboard_import::get_package_import_url()});
|
81
176
|
#endif
|
82
|
-
|
83
|
-
this->services_.push_back(service);
|
84
177
|
}
|
85
178
|
#endif // USE_API
|
86
179
|
|
87
180
|
#ifdef USE_PROMETHEUS
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
this->services_.push_back(service);
|
94
|
-
}
|
181
|
+
this->services_.emplace_back();
|
182
|
+
auto &prom_service = this->services_.back();
|
183
|
+
prom_service.service_type = MDNS_STR(SERVICE_PROMETHEUS);
|
184
|
+
prom_service.proto = MDNS_STR(SERVICE_TCP);
|
185
|
+
prom_service.port = USE_WEBSERVER_PORT;
|
95
186
|
#endif
|
96
187
|
|
97
188
|
#ifdef USE_WEBSERVER
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
this->services_.push_back(service);
|
104
|
-
}
|
189
|
+
this->services_.emplace_back();
|
190
|
+
auto &web_service = this->services_.back();
|
191
|
+
web_service.service_type = MDNS_STR(SERVICE_HTTP);
|
192
|
+
web_service.proto = MDNS_STR(SERVICE_TCP);
|
193
|
+
web_service.port = USE_WEBSERVER_PORT;
|
105
194
|
#endif
|
106
195
|
|
107
196
|
#ifdef USE_MDNS_EXTRA_SERVICES
|
108
197
|
this->services_.insert(this->services_.end(), this->services_extra_.begin(), this->services_extra_.end());
|
109
198
|
#endif
|
110
199
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
200
|
+
#if !defined(USE_API) && !defined(USE_PROMETHEUS) && !defined(USE_WEBSERVER) && !defined(USE_MDNS_EXTRA_SERVICES)
|
201
|
+
// Publish "http" service if not using native API or any other services
|
202
|
+
// This is just to have *some* mDNS service so that .local resolution works
|
203
|
+
this->services_.emplace_back();
|
204
|
+
auto &fallback_service = this->services_.back();
|
205
|
+
fallback_service.service_type = "_http";
|
206
|
+
fallback_service.proto = "_tcp";
|
207
|
+
fallback_service.port = USE_WEBSERVER_PORT;
|
208
|
+
fallback_service.txt_records.emplace_back(MDNSTXTRecord{"version", ESPHOME_VERSION});
|
209
|
+
#endif
|
121
210
|
}
|
122
211
|
|
123
212
|
void MDNSComponent::dump_config() {
|
@@ -125,6 +214,7 @@ void MDNSComponent::dump_config() {
|
|
125
214
|
"mDNS:\n"
|
126
215
|
" Hostname: %s",
|
127
216
|
this->hostname_.c_str());
|
217
|
+
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
128
218
|
ESP_LOGV(TAG, " Services:");
|
129
219
|
for (const auto &service : this->services_) {
|
130
220
|
ESP_LOGV(TAG, " - %s, %s, %d", service.service_type.c_str(), service.proto.c_str(),
|
@@ -134,6 +224,7 @@ void MDNSComponent::dump_config() {
|
|
134
224
|
const_cast<TemplatableValue<std::string> &>(record.value).value().c_str());
|
135
225
|
}
|
136
226
|
}
|
227
|
+
#endif
|
137
228
|
}
|
138
229
|
|
139
230
|
std::vector<MDNSService> MDNSComponent::get_services() { return this->services_; }
|
@@ -14,7 +14,7 @@ from esphome.const import (
|
|
14
14
|
)
|
15
15
|
from esphome.core import CORE
|
16
16
|
from esphome.core.entity_helpers import entity_duplicate_validator, setup_entity
|
17
|
-
from esphome.coroutine import coroutine_with_priority
|
17
|
+
from esphome.coroutine import CoroPriority, coroutine_with_priority
|
18
18
|
from esphome.cpp_generator import MockObjClass
|
19
19
|
|
20
20
|
CODEOWNERS = ["@jesserockz"]
|
@@ -303,7 +303,7 @@ async def media_player_volume_set_action(config, action_id, template_arg, args):
|
|
303
303
|
return var
|
304
304
|
|
305
305
|
|
306
|
-
@coroutine_with_priority(
|
306
|
+
@coroutine_with_priority(CoroPriority.CORE)
|
307
307
|
async def to_code(config):
|
308
308
|
cg.add_global(media_player_ns.using)
|
309
309
|
cg.add_define("USE_MEDIA_PLAYER")
|
@@ -201,7 +201,7 @@ def _validate_manifest_version(manifest_data):
|
|
201
201
|
else:
|
202
202
|
raise cv.Invalid("Invalid manifest version")
|
203
203
|
else:
|
204
|
-
raise cv.Invalid("Invalid manifest file, missing 'version' key
|
204
|
+
raise cv.Invalid("Invalid manifest file, missing 'version' key")
|
205
205
|
|
206
206
|
|
207
207
|
def _process_http_source(config):
|
@@ -421,7 +421,7 @@ def _feature_step_size_validate(config):
|
|
421
421
|
if features_step_size is None:
|
422
422
|
features_step_size = model_step_size
|
423
423
|
elif features_step_size != model_step_size:
|
424
|
-
raise cv.Invalid("Cannot load models with different features step sizes
|
424
|
+
raise cv.Invalid("Cannot load models with different features step sizes")
|
425
425
|
|
426
426
|
|
427
427
|
FINAL_VALIDATE_SCHEMA = cv.All(
|
@@ -12,7 +12,7 @@ from esphome.const import (
|
|
12
12
|
CONF_TRIGGER_ID,
|
13
13
|
)
|
14
14
|
from esphome.core import CORE
|
15
|
-
from esphome.coroutine import coroutine_with_priority
|
15
|
+
from esphome.coroutine import CoroPriority, coroutine_with_priority
|
16
16
|
|
17
17
|
AUTO_LOAD = ["audio"]
|
18
18
|
CODEOWNERS = ["@jesserockz", "@kahrendt"]
|
@@ -213,7 +213,7 @@ automation.register_condition(
|
|
213
213
|
)(microphone_action)
|
214
214
|
|
215
215
|
|
216
|
-
@coroutine_with_priority(
|
216
|
+
@coroutine_with_priority(CoroPriority.CORE)
|
217
217
|
async def to_code(config):
|
218
218
|
cg.add_global(microphone_ns.using)
|
219
219
|
cg.add_define("USE_MICROPHONE")
|