esphome 2025.8.4__py3-none-any.whl → 2025.9.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 +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/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 +7 -2
- esphome/components/ethernet/ethernet_component.cpp +49 -3
- esphome/components/ethernet/ethernet_component.h +2 -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_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.h +2 -2
- 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 +4 -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 +67 -10
- esphome/espota2.py +13 -6
- esphome/helpers.py +68 -83
- esphome/resolver.py +67 -0
- esphome/util.py +9 -6
- esphome/wizard.py +39 -26
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/METADATA +9 -9
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/RECORD +364 -333
- /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.0b2.dist-info}/WHEEL +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/entry_points.txt +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/licenses/LICENSE +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/top_level.txt +0 -0
@@ -300,6 +300,7 @@ void EthernetComponent::loop() {
|
|
300
300
|
this->state_ = EthernetComponentState::CONNECTING;
|
301
301
|
this->start_connect_();
|
302
302
|
} else {
|
303
|
+
this->finish_connect_();
|
303
304
|
// When connected and stable, disable the loop to save CPU cycles
|
304
305
|
this->disable_loop();
|
305
306
|
}
|
@@ -486,13 +487,38 @@ void EthernetComponent::got_ip6_event_handler(void *arg, esp_event_base_t event_
|
|
486
487
|
}
|
487
488
|
#endif /* USE_NETWORK_IPV6 */
|
488
489
|
|
490
|
+
void EthernetComponent::finish_connect_() {
|
491
|
+
#if USE_NETWORK_IPV6
|
492
|
+
// Retry IPv6 link-local setup if it failed during initial connect
|
493
|
+
// This handles the case where min_ipv6_addr_count is NOT set (or is 0),
|
494
|
+
// allowing us to reach CONNECTED state with just IPv4.
|
495
|
+
// If IPv6 setup failed in start_connect_() because the interface wasn't ready:
|
496
|
+
// - Bootup timing issues (#10281)
|
497
|
+
// - Cable unplugged/network interruption (#10705)
|
498
|
+
// We can now retry since we're in CONNECTED state and the interface is definitely up.
|
499
|
+
if (!this->ipv6_setup_done_) {
|
500
|
+
esp_err_t err = esp_netif_create_ip6_linklocal(this->eth_netif_);
|
501
|
+
if (err == ESP_OK) {
|
502
|
+
ESP_LOGD(TAG, "IPv6 link-local address created (retry succeeded)");
|
503
|
+
}
|
504
|
+
// Always set the flag to prevent continuous retries
|
505
|
+
// If IPv6 setup fails here with the interface up and stable, it's
|
506
|
+
// likely a persistent issue (IPv6 disabled at router, hardware
|
507
|
+
// limitation, etc.) that won't be resolved by further retries.
|
508
|
+
// The device continues to work with IPv4.
|
509
|
+
this->ipv6_setup_done_ = true;
|
510
|
+
}
|
511
|
+
#endif /* USE_NETWORK_IPV6 */
|
512
|
+
}
|
513
|
+
|
489
514
|
void EthernetComponent::start_connect_() {
|
490
515
|
global_eth_component->got_ipv4_address_ = false;
|
491
516
|
#if USE_NETWORK_IPV6
|
492
517
|
global_eth_component->ipv6_count_ = 0;
|
518
|
+
this->ipv6_setup_done_ = false;
|
493
519
|
#endif /* USE_NETWORK_IPV6 */
|
494
520
|
this->connect_begin_ = millis();
|
495
|
-
this->status_set_warning("waiting for IP configuration");
|
521
|
+
this->status_set_warning(LOG_STR("waiting for IP configuration"));
|
496
522
|
|
497
523
|
esp_err_t err;
|
498
524
|
err = esp_netif_set_hostname(this->eth_netif_, App.get_name().c_str());
|
@@ -545,9 +571,27 @@ void EthernetComponent::start_connect_() {
|
|
545
571
|
}
|
546
572
|
}
|
547
573
|
#if USE_NETWORK_IPV6
|
574
|
+
// Attempt to create IPv6 link-local address
|
575
|
+
// We MUST attempt this here, not just in finish_connect_(), because with
|
576
|
+
// min_ipv6_addr_count set, the component won't reach CONNECTED state without IPv6.
|
577
|
+
// However, this may fail with ESP_FAIL if the interface is not up yet:
|
578
|
+
// - At bootup when link isn't ready (#10281)
|
579
|
+
// - After disconnection/cable unplugged (#10705)
|
580
|
+
// We'll retry in finish_connect_() if it fails here.
|
548
581
|
err = esp_netif_create_ip6_linklocal(this->eth_netif_);
|
549
582
|
if (err != ESP_OK) {
|
550
|
-
|
583
|
+
if (err == ESP_ERR_ESP_NETIF_INVALID_PARAMS) {
|
584
|
+
// This is a programming error, not a transient failure
|
585
|
+
ESPHL_ERROR_CHECK(err, "esp_netif_create_ip6_linklocal invalid parameters");
|
586
|
+
} else {
|
587
|
+
// ESP_FAIL means the interface isn't up yet
|
588
|
+
// This is expected and non-fatal, happens in multiple scenarios:
|
589
|
+
// - During reconnection after network interruptions (#10705)
|
590
|
+
// - At bootup when the link isn't ready yet (#10281)
|
591
|
+
// We'll retry once we reach CONNECTED state and the interface is up
|
592
|
+
ESP_LOGW(TAG, "esp_netif_create_ip6_linklocal failed: %s", esp_err_to_name(err));
|
593
|
+
// Don't mark component as failed - this is a transient error
|
594
|
+
}
|
551
595
|
}
|
552
596
|
#endif /* USE_NETWORK_IPV6 */
|
553
597
|
|
@@ -638,7 +682,9 @@ void EthernetComponent::get_eth_mac_address_raw(uint8_t *mac) {
|
|
638
682
|
std::string EthernetComponent::get_eth_mac_address_pretty() {
|
639
683
|
uint8_t mac[6];
|
640
684
|
get_eth_mac_address_raw(mac);
|
641
|
-
|
685
|
+
char buf[18];
|
686
|
+
format_mac_addr_upper(mac, buf);
|
687
|
+
return std::string(buf);
|
642
688
|
}
|
643
689
|
|
644
690
|
eth_duplex_t EthernetComponent::get_duplex_mode() {
|
@@ -102,6 +102,7 @@ class EthernetComponent : public Component {
|
|
102
102
|
#endif /* LWIP_IPV6 */
|
103
103
|
|
104
104
|
void start_connect_();
|
105
|
+
void finish_connect_();
|
105
106
|
void dump_connect_params_();
|
106
107
|
/// @brief Set `RMII Reference Clock Select` bit for KSZ8081.
|
107
108
|
void ksz8081_set_clock_reference_(esp_eth_mac_t *mac);
|
@@ -144,6 +145,7 @@ class EthernetComponent : public Component {
|
|
144
145
|
bool got_ipv4_address_{false};
|
145
146
|
#if LWIP_IPV6
|
146
147
|
uint8_t ipv6_count_{0};
|
148
|
+
bool ipv6_setup_done_{false};
|
147
149
|
#endif /* LWIP_IPV6 */
|
148
150
|
|
149
151
|
// Pointers at the end (naturally aligned)
|
@@ -17,7 +17,7 @@ from esphome.const import (
|
|
17
17
|
DEVICE_CLASS_EMPTY,
|
18
18
|
DEVICE_CLASS_MOTION,
|
19
19
|
)
|
20
|
-
from esphome.core import CORE, coroutine_with_priority
|
20
|
+
from esphome.core import CORE, CoroPriority, coroutine_with_priority
|
21
21
|
from esphome.core.entity_helpers import entity_duplicate_validator, setup_entity
|
22
22
|
from esphome.cpp_generator import MockObjClass
|
23
23
|
|
@@ -143,6 +143,6 @@ async def event_fire_to_code(config, action_id, template_arg, args):
|
|
143
143
|
return var
|
144
144
|
|
145
145
|
|
146
|
-
@coroutine_with_priority(
|
146
|
+
@coroutine_with_priority(CoroPriority.CORE)
|
147
147
|
async def to_code(config):
|
148
148
|
cg.add_global(event_ns.using)
|
esphome/components/event/event.h
CHANGED
@@ -13,11 +13,11 @@ namespace event {
|
|
13
13
|
#define LOG_EVENT(prefix, type, obj) \
|
14
14
|
if ((obj) != nullptr) { \
|
15
15
|
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
16
|
-
if (!(obj)->
|
17
|
-
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->
|
16
|
+
if (!(obj)->get_icon_ref().empty()) { \
|
17
|
+
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon_ref().c_str()); \
|
18
18
|
} \
|
19
|
-
if (!(obj)->
|
20
|
-
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->
|
19
|
+
if (!(obj)->get_device_class_ref().empty()) { \
|
20
|
+
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class_ref().c_str()); \
|
21
21
|
} \
|
22
22
|
}
|
23
23
|
|
@@ -1,7 +1,13 @@
|
|
1
1
|
#include "factory_reset_button.h"
|
2
|
+
|
3
|
+
#include "esphome/core/defines.h"
|
4
|
+
|
5
|
+
#ifdef USE_OPENTHREAD
|
6
|
+
#include "esphome/components/openthread/openthread.h"
|
7
|
+
#endif
|
8
|
+
#include "esphome/core/application.h"
|
2
9
|
#include "esphome/core/hal.h"
|
3
10
|
#include "esphome/core/log.h"
|
4
|
-
#include "esphome/core/application.h"
|
5
11
|
|
6
12
|
namespace esphome {
|
7
13
|
namespace factory_reset {
|
@@ -13,9 +19,20 @@ void FactoryResetButton::press_action() {
|
|
13
19
|
ESP_LOGI(TAG, "Resetting");
|
14
20
|
// Let MQTT settle a bit
|
15
21
|
delay(100); // NOLINT
|
22
|
+
#ifdef USE_OPENTHREAD
|
23
|
+
openthread::global_openthread_component->on_factory_reset(FactoryResetButton::factory_reset_callback);
|
24
|
+
#else
|
25
|
+
global_preferences->reset();
|
26
|
+
App.safe_reboot();
|
27
|
+
#endif
|
28
|
+
}
|
29
|
+
|
30
|
+
#ifdef USE_OPENTHREAD
|
31
|
+
void FactoryResetButton::factory_reset_callback() {
|
16
32
|
global_preferences->reset();
|
17
33
|
App.safe_reboot();
|
18
34
|
}
|
35
|
+
#endif
|
19
36
|
|
20
37
|
} // namespace factory_reset
|
21
38
|
} // namespace esphome
|
@@ -1,7 +1,9 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
-
#include "esphome/core/
|
3
|
+
#include "esphome/core/defines.h"
|
4
|
+
|
4
5
|
#include "esphome/components/button/button.h"
|
6
|
+
#include "esphome/core/component.h"
|
5
7
|
|
6
8
|
namespace esphome {
|
7
9
|
namespace factory_reset {
|
@@ -9,6 +11,9 @@ namespace factory_reset {
|
|
9
11
|
class FactoryResetButton : public button::Button, public Component {
|
10
12
|
public:
|
11
13
|
void dump_config() override;
|
14
|
+
#ifdef USE_OPENTHREAD
|
15
|
+
static void factory_reset_callback();
|
16
|
+
#endif
|
12
17
|
|
13
18
|
protected:
|
14
19
|
void press_action() override;
|
@@ -1,7 +1,13 @@
|
|
1
1
|
#include "factory_reset_switch.h"
|
2
|
+
|
3
|
+
#include "esphome/core/defines.h"
|
4
|
+
|
5
|
+
#ifdef USE_OPENTHREAD
|
6
|
+
#include "esphome/components/openthread/openthread.h"
|
7
|
+
#endif
|
8
|
+
#include "esphome/core/application.h"
|
2
9
|
#include "esphome/core/hal.h"
|
3
10
|
#include "esphome/core/log.h"
|
4
|
-
#include "esphome/core/application.h"
|
5
11
|
|
6
12
|
namespace esphome {
|
7
13
|
namespace factory_reset {
|
@@ -17,10 +23,21 @@ void FactoryResetSwitch::write_state(bool state) {
|
|
17
23
|
ESP_LOGI(TAG, "Resetting");
|
18
24
|
// Let MQTT settle a bit
|
19
25
|
delay(100); // NOLINT
|
26
|
+
#ifdef USE_OPENTHREAD
|
27
|
+
openthread::global_openthread_component->on_factory_reset(FactoryResetSwitch::factory_reset_callback);
|
28
|
+
#else
|
20
29
|
global_preferences->reset();
|
21
30
|
App.safe_reboot();
|
31
|
+
#endif
|
22
32
|
}
|
23
33
|
}
|
24
34
|
|
35
|
+
#ifdef USE_OPENTHREAD
|
36
|
+
void FactoryResetSwitch::factory_reset_callback() {
|
37
|
+
global_preferences->reset();
|
38
|
+
App.safe_reboot();
|
39
|
+
}
|
40
|
+
#endif
|
41
|
+
|
25
42
|
} // namespace factory_reset
|
26
43
|
} // namespace esphome
|
@@ -1,7 +1,8 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
-
#include "esphome/core/component.h"
|
4
3
|
#include "esphome/components/switch/switch.h"
|
4
|
+
#include "esphome/core/component.h"
|
5
|
+
#include "esphome/core/defines.h"
|
5
6
|
|
6
7
|
namespace esphome {
|
7
8
|
namespace factory_reset {
|
@@ -9,6 +10,9 @@ namespace factory_reset {
|
|
9
10
|
class FactoryResetSwitch : public switch_::Switch, public Component {
|
10
11
|
public:
|
11
12
|
void dump_config() override;
|
13
|
+
#ifdef USE_OPENTHREAD
|
14
|
+
static void factory_reset_callback();
|
15
|
+
#endif
|
12
16
|
|
13
17
|
protected:
|
14
18
|
void write_state(bool state) override;
|
@@ -31,7 +31,7 @@ from esphome.const import (
|
|
31
31
|
CONF_TRIGGER_ID,
|
32
32
|
CONF_WEB_SERVER,
|
33
33
|
)
|
34
|
-
from esphome.core import CORE, coroutine_with_priority
|
34
|
+
from esphome.core import CORE, CoroPriority, coroutine_with_priority
|
35
35
|
from esphome.core.entity_helpers import entity_duplicate_validator, setup_entity
|
36
36
|
|
37
37
|
IS_PLATFORM_COMPONENT = True
|
@@ -398,6 +398,6 @@ async def fan_is_on_off_to_code(config, condition_id, template_arg, args):
|
|
398
398
|
return cg.new_Pvariable(condition_id, template_arg, paren)
|
399
399
|
|
400
400
|
|
401
|
-
@coroutine_with_priority(
|
401
|
+
@coroutine_with_priority(CoroPriority.CORE)
|
402
402
|
async def to_code(config):
|
403
403
|
cg.add_global(fan_ns.using)
|
esphome/components/fan/fan.cpp
CHANGED
@@ -148,7 +148,8 @@ void Fan::publish_state() {
|
|
148
148
|
constexpr uint32_t RESTORE_STATE_VERSION = 0x71700ABA;
|
149
149
|
optional<FanRestoreState> Fan::restore_state_() {
|
150
150
|
FanRestoreState recovered{};
|
151
|
-
this->rtc_ =
|
151
|
+
this->rtc_ =
|
152
|
+
global_preferences->make_preference<FanRestoreState>(this->get_preference_hash() ^ RESTORE_STATE_VERSION);
|
152
153
|
bool restored = this->rtc_.load(&recovered);
|
153
154
|
|
154
155
|
switch (this->restore_mode_) {
|
@@ -11,22 +11,22 @@ static const uint8_t NUMBER_OF_READ_RETRIES = 5;
|
|
11
11
|
void GDK101Component::update() {
|
12
12
|
uint8_t data[2];
|
13
13
|
if (!this->read_dose_1m_(data)) {
|
14
|
-
this->status_set_warning("Failed to read dose 1m");
|
14
|
+
this->status_set_warning(LOG_STR("Failed to read dose 1m"));
|
15
15
|
return;
|
16
16
|
}
|
17
17
|
|
18
18
|
if (!this->read_dose_10m_(data)) {
|
19
|
-
this->status_set_warning("Failed to read dose 10m");
|
19
|
+
this->status_set_warning(LOG_STR("Failed to read dose 10m"));
|
20
20
|
return;
|
21
21
|
}
|
22
22
|
|
23
23
|
if (!this->read_status_(data)) {
|
24
|
-
this->status_set_warning("Failed to read status");
|
24
|
+
this->status_set_warning(LOG_STR("Failed to read status"));
|
25
25
|
return;
|
26
26
|
}
|
27
27
|
|
28
28
|
if (!this->read_measurement_duration_(data)) {
|
29
|
-
this->status_set_warning("Failed to read measurement duration");
|
29
|
+
this->status_set_warning(LOG_STR("Failed to read measurement duration"));
|
30
30
|
return;
|
31
31
|
}
|
32
32
|
this->status_clear_warning();
|
@@ -8,7 +8,7 @@ from esphome.const import (
|
|
8
8
|
CONF_TYPE,
|
9
9
|
CONF_VALUE,
|
10
10
|
)
|
11
|
-
from esphome.core import coroutine_with_priority
|
11
|
+
from esphome.core import CoroPriority, coroutine_with_priority
|
12
12
|
|
13
13
|
CODEOWNERS = ["@esphome/core"]
|
14
14
|
globals_ns = cg.esphome_ns.namespace("globals")
|
@@ -35,7 +35,7 @@ CONFIG_SCHEMA = cv.Schema(
|
|
35
35
|
|
36
36
|
|
37
37
|
# Run with low priority so that namespaces are registered first
|
38
|
-
@coroutine_with_priority(
|
38
|
+
@coroutine_with_priority(CoroPriority.LATE)
|
39
39
|
async def to_code(config):
|
40
40
|
type_ = cg.RawExpression(config[CONF_TYPE])
|
41
41
|
restore = config[CONF_RESTORE_VALUE]
|
@@ -6,6 +6,23 @@ namespace gpio {
|
|
6
6
|
|
7
7
|
static const char *const TAG = "gpio.binary_sensor";
|
8
8
|
|
9
|
+
static const LogString *interrupt_type_to_string(gpio::InterruptType type) {
|
10
|
+
switch (type) {
|
11
|
+
case gpio::INTERRUPT_RISING_EDGE:
|
12
|
+
return LOG_STR("RISING_EDGE");
|
13
|
+
case gpio::INTERRUPT_FALLING_EDGE:
|
14
|
+
return LOG_STR("FALLING_EDGE");
|
15
|
+
case gpio::INTERRUPT_ANY_EDGE:
|
16
|
+
return LOG_STR("ANY_EDGE");
|
17
|
+
default:
|
18
|
+
return LOG_STR("UNKNOWN");
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
static const LogString *gpio_mode_to_string(bool use_interrupt) {
|
23
|
+
return use_interrupt ? LOG_STR("interrupt") : LOG_STR("polling");
|
24
|
+
}
|
25
|
+
|
9
26
|
void IRAM_ATTR GPIOBinarySensorStore::gpio_intr(GPIOBinarySensorStore *arg) {
|
10
27
|
bool new_state = arg->isr_pin_.digital_read();
|
11
28
|
if (new_state != arg->last_state_) {
|
@@ -51,25 +68,9 @@ void GPIOBinarySensor::setup() {
|
|
51
68
|
void GPIOBinarySensor::dump_config() {
|
52
69
|
LOG_BINARY_SENSOR("", "GPIO Binary Sensor", this);
|
53
70
|
LOG_PIN(" Pin: ", this->pin_);
|
54
|
-
|
55
|
-
ESP_LOGCONFIG(TAG, " Mode: %s", mode);
|
71
|
+
ESP_LOGCONFIG(TAG, " Mode: %s", LOG_STR_ARG(gpio_mode_to_string(this->use_interrupt_)));
|
56
72
|
if (this->use_interrupt_) {
|
57
|
-
|
58
|
-
switch (this->interrupt_type_) {
|
59
|
-
case gpio::INTERRUPT_RISING_EDGE:
|
60
|
-
interrupt_type = "RISING_EDGE";
|
61
|
-
break;
|
62
|
-
case gpio::INTERRUPT_FALLING_EDGE:
|
63
|
-
interrupt_type = "FALLING_EDGE";
|
64
|
-
break;
|
65
|
-
case gpio::INTERRUPT_ANY_EDGE:
|
66
|
-
interrupt_type = "ANY_EDGE";
|
67
|
-
break;
|
68
|
-
default:
|
69
|
-
interrupt_type = "UNKNOWN";
|
70
|
-
break;
|
71
|
-
}
|
72
|
-
ESP_LOGCONFIG(TAG, " Interrupt Type: %s", interrupt_type);
|
73
|
+
ESP_LOGCONFIG(TAG, " Interrupt Type: %s", LOG_STR_ARG(interrupt_type_to_string(this->interrupt_type_)));
|
73
74
|
}
|
74
75
|
}
|
75
76
|
|
@@ -4,6 +4,7 @@
|
|
4
4
|
#include <cstdint>
|
5
5
|
#include <cstring>
|
6
6
|
#include <limits>
|
7
|
+
#include <type_traits>
|
7
8
|
#include "esphome/core/hal.h"
|
8
9
|
|
9
10
|
namespace esphome::gpio_expander {
|
@@ -11,18 +12,27 @@ namespace esphome::gpio_expander {
|
|
11
12
|
/// @brief A class to cache the read state of a GPIO expander.
|
12
13
|
/// This class caches reads between GPIO Pins which are on the same bank.
|
13
14
|
/// This means that for reading whole Port (ex. 8 pins) component needs only one
|
14
|
-
/// I2C/SPI read per main loop call. It assumes
|
15
|
+
/// I2C/SPI read per main loop call. It assumes that one bit in byte identifies one GPIO pin.
|
16
|
+
///
|
15
17
|
/// Template parameters:
|
16
|
-
/// T - Type which represents internal register. Could be uint8_t or uint16_t.
|
17
|
-
///
|
18
|
-
///
|
19
|
-
|
18
|
+
/// T - Type which represents internal bank register. Could be uint8_t or uint16_t.
|
19
|
+
/// Choose based on how your I/O expander reads pins:
|
20
|
+
/// * uint8_t: For chips that read banks separately (8 pins at a time)
|
21
|
+
/// Examples: MCP23017 (2x8-bit banks), TCA9555 (2x8-bit banks)
|
22
|
+
/// * uint16_t: For chips that read all pins at once (up to 16 pins)
|
23
|
+
/// Examples: PCF8574/8575 (8/16 pins), PCA9554/9555 (8/16 pins)
|
24
|
+
/// N - Total number of pins (maximum 65535)
|
25
|
+
/// P - Type for pin number parameters (automatically selected based on N:
|
26
|
+
/// uint8_t for N<=256, uint16_t for N>256). Can be explicitly specified
|
27
|
+
/// if needed (e.g., for components like SN74HC165 with >256 pins)
|
28
|
+
template<typename T, uint16_t N, typename P = typename std::conditional<(N > 256), uint16_t, uint8_t>::type>
|
29
|
+
class CachedGpioExpander {
|
20
30
|
public:
|
21
31
|
/// @brief Read the state of the given pin. This will invalidate the cache for the given pin number.
|
22
32
|
/// @param pin Pin number to read
|
23
33
|
/// @return Pin state
|
24
|
-
bool digital_read(
|
25
|
-
const
|
34
|
+
bool digital_read(P pin) {
|
35
|
+
const P bank = pin / BANK_SIZE;
|
26
36
|
const T pin_mask = (1 << (pin % BANK_SIZE));
|
27
37
|
// Check if specific pin cache is valid
|
28
38
|
if (this->read_cache_valid_[bank] & pin_mask) {
|
@@ -38,21 +48,31 @@ template<typename T, T N> class CachedGpioExpander {
|
|
38
48
|
return this->digital_read_cache(pin);
|
39
49
|
}
|
40
50
|
|
41
|
-
void digital_write(
|
51
|
+
void digital_write(P pin, bool value) { this->digital_write_hw(pin, value); }
|
42
52
|
|
43
53
|
protected:
|
44
|
-
/// @brief
|
45
|
-
|
46
|
-
/// @
|
47
|
-
|
48
|
-
///
|
49
|
-
virtual
|
54
|
+
/// @brief Read GPIO bank from hardware into internal state
|
55
|
+
/// @param pin Pin number (used to determine which bank to read)
|
56
|
+
/// @return true if read succeeded, false on communication error
|
57
|
+
/// @note This does NOT return the pin state. It returns whether the read operation succeeded.
|
58
|
+
/// The actual pin state should be returned by digital_read_cache().
|
59
|
+
virtual bool digital_read_hw(P pin) = 0;
|
60
|
+
|
61
|
+
/// @brief Get cached pin value from internal state
|
62
|
+
/// @param pin Pin number to read
|
63
|
+
/// @return Pin state (true = HIGH, false = LOW)
|
64
|
+
virtual bool digital_read_cache(P pin) = 0;
|
65
|
+
|
66
|
+
/// @brief Write GPIO state to hardware
|
67
|
+
/// @param pin Pin number to write
|
68
|
+
/// @param value Pin state to write (true = HIGH, false = LOW)
|
69
|
+
virtual void digital_write_hw(P pin, bool value) = 0;
|
50
70
|
|
51
71
|
/// @brief Invalidate cache. This function should be called in component loop().
|
52
72
|
void reset_pin_cache_() { memset(this->read_cache_valid_, 0x00, CACHE_SIZE_BYTES); }
|
53
73
|
|
54
|
-
static constexpr
|
55
|
-
static constexpr
|
74
|
+
static constexpr uint16_t BITS_PER_BYTE = 8;
|
75
|
+
static constexpr uint16_t BANK_SIZE = sizeof(T) * BITS_PER_BYTE;
|
56
76
|
static constexpr size_t BANKS = N / BANK_SIZE;
|
57
77
|
static constexpr size_t CACHE_SIZE_BYTES = BANKS * sizeof(T);
|
58
78
|
|
@@ -57,11 +57,11 @@ void GroveGasMultichannelV2Component::update() {
|
|
57
57
|
void GroveGasMultichannelV2Component::dump_config() {
|
58
58
|
ESP_LOGCONFIG(TAG, "Grove Multichannel Gas Sensor V2");
|
59
59
|
LOG_I2C_DEVICE(this)
|
60
|
-
LOG_UPDATE_INTERVAL(this)
|
61
|
-
LOG_SENSOR(" ", "Nitrogen Dioxide", this->nitrogen_dioxide_sensor_)
|
62
|
-
LOG_SENSOR(" ", "Ethanol", this->ethanol_sensor_)
|
63
|
-
LOG_SENSOR(" ", "Carbon Monoxide", this->carbon_monoxide_sensor_)
|
64
|
-
LOG_SENSOR(" ", "TVOC", this->tvoc_sensor_)
|
60
|
+
LOG_UPDATE_INTERVAL(this);
|
61
|
+
LOG_SENSOR(" ", "Nitrogen Dioxide", this->nitrogen_dioxide_sensor_);
|
62
|
+
LOG_SENSOR(" ", "Ethanol", this->ethanol_sensor_);
|
63
|
+
LOG_SENSOR(" ", "Carbon Monoxide", this->carbon_monoxide_sensor_);
|
64
|
+
LOG_SENSOR(" ", "TVOC", this->tvoc_sensor_);
|
65
65
|
|
66
66
|
if (this->is_failed()) {
|
67
67
|
switch (this->error_code_) {
|
@@ -20,7 +20,7 @@ static const size_t MAX_BUTTONS = 4; // max number of buttons scanned
|
|
20
20
|
|
21
21
|
#define ERROR_CHECK(err) \
|
22
22
|
if ((err) != i2c::ERROR_OK) { \
|
23
|
-
this->status_set_warning(ESP_LOG_MSG_COMM_FAIL); \
|
23
|
+
this->status_set_warning(LOG_STR(ESP_LOG_MSG_COMM_FAIL)); \
|
24
24
|
return; \
|
25
25
|
}
|
26
26
|
|
@@ -351,7 +351,7 @@ ClimateTraits HaierClimateBase::traits() { return traits_; }
|
|
351
351
|
void HaierClimateBase::initialization() {
|
352
352
|
constexpr uint32_t restore_settings_version = 0xA77D21EF;
|
353
353
|
this->base_rtc_ =
|
354
|
-
global_preferences->make_preference<HaierBaseSettings>(this->
|
354
|
+
global_preferences->make_preference<HaierBaseSettings>(this->get_preference_hash() ^ restore_settings_version);
|
355
355
|
HaierBaseSettings recovered;
|
356
356
|
if (!this->base_rtc_.load(&recovered)) {
|
357
357
|
recovered = {false, true};
|
@@ -516,7 +516,7 @@ void HonClimate::initialization() {
|
|
516
516
|
HaierClimateBase::initialization();
|
517
517
|
constexpr uint32_t restore_settings_version = 0x57EB59DDUL;
|
518
518
|
this->hon_rtc_ =
|
519
|
-
global_preferences->make_preference<HonSettings>(this->
|
519
|
+
global_preferences->make_preference<HonSettings>(this->get_preference_hash() ^ restore_settings_version);
|
520
520
|
HonSettings recovered;
|
521
521
|
if (this->hon_rtc_.load(&recovered)) {
|
522
522
|
this->settings_ = recovered;
|
@@ -42,11 +42,11 @@ void HLW8012Component::dump_config() {
|
|
42
42
|
" Current resistor: %.1f mΩ\n"
|
43
43
|
" Voltage Divider: %.1f",
|
44
44
|
this->change_mode_every_, this->current_resistor_ * 1000.0f, this->voltage_divider_);
|
45
|
-
LOG_UPDATE_INTERVAL(this)
|
46
|
-
LOG_SENSOR(" ", "Voltage", this->voltage_sensor_)
|
47
|
-
LOG_SENSOR(" ", "Current", this->current_sensor_)
|
48
|
-
LOG_SENSOR(" ", "Power", this->power_sensor_)
|
49
|
-
LOG_SENSOR(" ", "Energy", this->energy_sensor_)
|
45
|
+
LOG_UPDATE_INTERVAL(this);
|
46
|
+
LOG_SENSOR(" ", "Voltage", this->voltage_sensor_);
|
47
|
+
LOG_SENSOR(" ", "Current", this->current_sensor_);
|
48
|
+
LOG_SENSOR(" ", "Power", this->power_sensor_);
|
49
|
+
LOG_SENSOR(" ", "Energy", this->energy_sensor_);
|
50
50
|
}
|
51
51
|
float HLW8012Component::get_setup_priority() const { return setup_priority::DATA; }
|
52
52
|
void HLW8012Component::update() {
|
@@ -15,7 +15,7 @@ static const char *const TAG = "honeywellabp2";
|
|
15
15
|
void HONEYWELLABP2Sensor::read_sensor_data() {
|
16
16
|
if (this->read(raw_data_, 7) != i2c::ERROR_OK) {
|
17
17
|
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
18
|
-
this->status_set_warning("couldn't read sensor data");
|
18
|
+
this->status_set_warning(LOG_STR("couldn't read sensor data"));
|
19
19
|
return;
|
20
20
|
}
|
21
21
|
float press_counts = encode_uint24(raw_data_[1], raw_data_[2], raw_data_[3]); // calculate digital pressure counts
|
@@ -31,7 +31,7 @@ void HONEYWELLABP2Sensor::read_sensor_data() {
|
|
31
31
|
void HONEYWELLABP2Sensor::start_measurement() {
|
32
32
|
if (this->write(i2c_cmd_, 3) != i2c::ERROR_OK) {
|
33
33
|
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
34
|
-
this->status_set_warning("couldn't start measurement");
|
34
|
+
this->status_set_warning(LOG_STR("couldn't start measurement"));
|
35
35
|
return;
|
36
36
|
}
|
37
37
|
this->measurement_running_ = true;
|
@@ -40,7 +40,7 @@ void HONEYWELLABP2Sensor::start_measurement() {
|
|
40
40
|
bool HONEYWELLABP2Sensor::is_measurement_ready() {
|
41
41
|
if (this->read(raw_data_, 1) != i2c::ERROR_OK) {
|
42
42
|
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
43
|
-
this->status_set_warning("couldn't check measurement");
|
43
|
+
this->status_set_warning(LOG_STR("couldn't check measurement"));
|
44
44
|
return false;
|
45
45
|
}
|
46
46
|
if ((raw_data_[0] & (0x1 << STATUS_BIT_BUSY)) > 0) {
|
@@ -53,7 +53,7 @@ bool HONEYWELLABP2Sensor::is_measurement_ready() {
|
|
53
53
|
void HONEYWELLABP2Sensor::measurement_timeout() {
|
54
54
|
ESP_LOGE(TAG, "Timeout!");
|
55
55
|
this->measurement_running_ = false;
|
56
|
-
this->status_set_warning("measurement timed out");
|
56
|
+
this->status_set_warning(LOG_STR("measurement timed out"));
|
57
57
|
}
|
58
58
|
|
59
59
|
float HONEYWELLABP2Sensor::get_pressure() { return this->last_pressure_; }
|
@@ -42,9 +42,10 @@ class HostPreferences : public ESPPreferences {
|
|
42
42
|
if (len > 255)
|
43
43
|
return false;
|
44
44
|
this->setup_();
|
45
|
-
|
45
|
+
auto it = this->data.find(key);
|
46
|
+
if (it == this->data.end())
|
46
47
|
return false;
|
47
|
-
auto vec =
|
48
|
+
const auto &vec = it->second;
|
48
49
|
if (vec.size() != len)
|
49
50
|
return false;
|
50
51
|
memcpy(data, vec.data(), len);
|
@@ -11,7 +11,7 @@ void HTE501Component::setup() {
|
|
11
11
|
uint8_t address[] = {0x70, 0x29};
|
12
12
|
uint8_t identification[9];
|
13
13
|
this->write_read(address, sizeof address, identification, sizeof identification);
|
14
|
-
if (identification[8] !=
|
14
|
+
if (identification[8] != crc8(identification, 8, 0xFF, 0x31, true)) {
|
15
15
|
this->error_code_ = CRC_CHECK_FAILED;
|
16
16
|
this->mark_failed();
|
17
17
|
return;
|
@@ -45,7 +45,8 @@ void HTE501Component::update() {
|
|
45
45
|
this->set_timeout(50, [this]() {
|
46
46
|
uint8_t i2c_response[6];
|
47
47
|
this->read(i2c_response, 6);
|
48
|
-
if (i2c_response[2] !=
|
48
|
+
if (i2c_response[2] != crc8(i2c_response, 2, 0xFF, 0x31, true) &&
|
49
|
+
i2c_response[5] != crc8(i2c_response + 3, 2, 0xFF, 0x31, true)) {
|
49
50
|
this->error_code_ = CRC_CHECK_FAILED;
|
50
51
|
this->status_set_warning();
|
51
52
|
return;
|
@@ -66,24 +67,5 @@ void HTE501Component::update() {
|
|
66
67
|
this->status_clear_warning();
|
67
68
|
});
|
68
69
|
}
|
69
|
-
|
70
|
-
unsigned char HTE501Component::calc_crc8_(const unsigned char buf[], unsigned char from, unsigned char to) {
|
71
|
-
unsigned char crc_val = 0xFF;
|
72
|
-
unsigned char i = 0;
|
73
|
-
unsigned char j = 0;
|
74
|
-
for (i = from; i <= to; i++) {
|
75
|
-
int cur_val = buf[i];
|
76
|
-
for (j = 0; j < 8; j++) {
|
77
|
-
if (((crc_val ^ cur_val) & 0x80) != 0) // If MSBs are not equal
|
78
|
-
{
|
79
|
-
crc_val = ((crc_val << 1) ^ 0x31);
|
80
|
-
} else {
|
81
|
-
crc_val = (crc_val << 1);
|
82
|
-
}
|
83
|
-
cur_val = cur_val << 1;
|
84
|
-
}
|
85
|
-
}
|
86
|
-
return crc_val;
|
87
|
-
}
|
88
70
|
} // namespace hte501
|
89
71
|
} // namespace esphome
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
-
#include "esphome/core/component.h"
|
4
|
-
#include "esphome/components/sensor/sensor.h"
|
5
3
|
#include "esphome/components/i2c/i2c.h"
|
4
|
+
#include "esphome/components/sensor/sensor.h"
|
5
|
+
#include "esphome/core/component.h"
|
6
6
|
|
7
7
|
namespace esphome {
|
8
8
|
namespace hte501 {
|
@@ -19,7 +19,6 @@ class HTE501Component : public PollingComponent, public i2c::I2CDevice {
|
|
19
19
|
void update() override;
|
20
20
|
|
21
21
|
protected:
|
22
|
-
unsigned char calc_crc8_(const unsigned char buf[], unsigned char from, unsigned char to);
|
23
22
|
sensor::Sensor *temperature_sensor_;
|
24
23
|
sensor::Sensor *humidity_sensor_;
|
25
24
|
|