esphome 2024.11.2__py3-none-any.whl → 2024.12.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 +1 -1
- esphome/components/adc/adc_sensor.h +7 -8
- esphome/components/adc/adc_sensor_common.cpp +24 -0
- esphome/components/adc/{adc_sensor.cpp → adc_sensor_esp32.cpp} +10 -179
- esphome/components/adc/adc_sensor_esp8266.cpp +58 -0
- esphome/components/adc/adc_sensor_libretiny.cpp +48 -0
- esphome/components/adc/adc_sensor_rp2040.cpp +93 -0
- esphome/components/alarm_control_panel/alarm_control_panel_call.cpp +3 -4
- esphome/components/animation/__init__.py +1 -2
- esphome/components/apds9306/apds9306.cpp +2 -1
- esphome/components/audio/audio.h +1 -1
- esphome/components/bk72xx/__init__.py +1 -1
- esphome/components/cse7766/cse7766.cpp +1 -1
- esphome/components/datetime/datetime_entity.cpp +1 -3
- esphome/components/deep_sleep/deep_sleep_esp32.cpp +2 -2
- esphome/components/dht/dht.cpp +2 -1
- esphome/components/display/display.cpp +10 -6
- esphome/components/display/display.h +14 -0
- esphome/components/display_menu_base/__init__.py +0 -2
- esphome/components/display_menu_base/display_menu_base.cpp +1 -1
- esphome/components/dsmr/dsmr.cpp +1 -1
- esphome/components/esp32/__init__.py +100 -22
- esphome/components/esp32/boards.py +222 -14
- esphome/components/esp32_ble/__init__.py +22 -2
- esphome/components/esp32_ble/ble.cpp +39 -12
- esphome/components/esp32_ble/ble.h +2 -0
- esphome/components/esp32_ble/ble_advertising.cpp +1 -1
- esphome/components/esp32_ble/ble_uuid.cpp +9 -10
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +4 -1
- esphome/components/esp32_camera_web_server/camera_web_server.h +1 -1
- esphome/components/esp32_rmt_led_strip/light.py +3 -3
- esphome/components/esp8266/__init__.py +5 -7
- esphome/components/ezo/ezo.cpp +14 -26
- esphome/components/font/__init__.py +10 -25
- esphome/components/font/font.cpp +5 -3
- esphome/components/graphical_display_menu/__init__.py +2 -0
- esphome/components/haier/hon_climate.cpp +79 -80
- esphome/components/hbridge/switch/__init__.py +44 -0
- esphome/components/hbridge/switch/hbridge_switch.cpp +95 -0
- esphome/components/hbridge/switch/hbridge_switch.h +50 -0
- esphome/components/hitachi_ac344/hitachi_ac344.cpp +4 -2
- esphome/components/hitachi_ac424/hitachi_ac424.cpp +4 -2
- esphome/components/homeassistant/number/homeassistant_number.cpp +3 -0
- esphome/components/hx711/hx711.cpp +1 -1
- esphome/components/hx711/hx711.h +1 -1
- esphome/components/i2c/i2c_bus_esp_idf.cpp +2 -2
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +61 -59
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -17
- esphome/components/ili9xxx/display.py +1 -2
- esphome/components/ili9xxx/ili9xxx_display.cpp +3 -2
- esphome/components/image/__init__.py +1 -2
- esphome/components/logger/logger.cpp +1 -1
- esphome/components/ltr501/ltr501.cpp +1 -1
- esphome/components/lvgl/defines.py +9 -2
- esphome/components/lvgl/lv_validation.py +8 -3
- esphome/components/lvgl/lvgl_esphome.cpp +1 -1
- esphome/components/lvgl/lvgl_esphome.h +19 -0
- esphome/components/lvgl/widgets/animimg.py +12 -17
- esphome/components/lvgl/widgets/img.py +1 -3
- esphome/components/lvgl/widgets/line.py +6 -0
- esphome/components/lvgl/widgets/msgbox.py +2 -1
- esphome/components/matrix_keypad/__init__.py +15 -3
- esphome/components/matrix_keypad/matrix_keypad.cpp +4 -0
- esphome/components/matrix_keypad/matrix_keypad.h +5 -0
- esphome/components/max31865/max31865.cpp +4 -2
- esphome/components/modbus_controller/modbus_controller.cpp +24 -24
- esphome/components/modbus_controller/modbus_controller.h +22 -22
- esphome/components/modbus_controller/number/modbus_number.cpp +8 -8
- esphome/components/modbus_controller/number/modbus_number.h +4 -4
- esphome/components/modbus_controller/output/modbus_output.cpp +7 -6
- esphome/components/modbus_controller/output/modbus_output.h +5 -5
- esphome/components/modbus_controller/select/modbus_select.cpp +4 -3
- esphome/components/modbus_controller/select/modbus_select.h +4 -4
- esphome/components/modbus_controller/switch/modbus_switch.cpp +5 -5
- esphome/components/modbus_controller/switch/modbus_switch.h +2 -2
- esphome/components/mqtt/__init__.py +4 -0
- esphome/components/mqtt/mqtt_alarm_control_panel.cpp +2 -5
- esphome/components/mqtt/mqtt_backend_esp32.cpp +3 -3
- esphome/components/mqtt/mqtt_client.cpp +4 -0
- esphome/components/mqtt/mqtt_client.h +6 -0
- esphome/components/mqtt/mqtt_climate.cpp +13 -3
- esphome/components/mqtt/mqtt_sensor.cpp +2 -0
- esphome/components/network/ip_address.h +1 -1
- esphome/components/nextion/__init__.py +2 -0
- esphome/components/nextion/automation.h +76 -0
- esphome/components/nextion/base_component.py +1 -0
- esphome/components/nextion/binary_sensor/__init__.py +43 -2
- esphome/components/nextion/display.py +15 -0
- esphome/components/nextion/nextion.cpp +8 -5
- esphome/components/nextion/nextion.h +7 -0
- esphome/components/nextion/nextion_upload_idf.cpp +2 -2
- esphome/components/nextion/sensor/__init__.py +38 -5
- esphome/components/nextion/switch/__init__.py +38 -2
- esphome/components/nextion/text_sensor/__init__.py +37 -2
- esphome/components/nfc/ndef_record.cpp +3 -3
- esphome/components/online_image/__init__.py +1 -0
- esphome/components/online_image/png_image.cpp +4 -0
- esphome/components/opentherm/hub.cpp +6 -7
- esphome/components/opentherm/opentherm.cpp +18 -34
- esphome/components/opentherm/opentherm.h +4 -5
- esphome/components/ota/automation.h +1 -1
- esphome/components/output/float_output.cpp +1 -1
- esphome/components/pca6416a/pca6416a.cpp +5 -3
- esphome/components/pca9554/pca9554.cpp +4 -4
- esphome/components/pipsolar/pipsolar.cpp +2 -2
- esphome/components/pipsolar/switch/pipsolar_switch.cpp +2 -2
- esphome/components/pn532/pn532_mifare_ultralight.cpp +2 -2
- esphome/components/pn7150/pn7150_mifare_ultralight.cpp +2 -2
- esphome/components/pn7160/pn7160_mifare_ultralight.cpp +2 -2
- esphome/components/qmc5883l/qmc5883l.cpp +45 -19
- esphome/components/qmc5883l/qmc5883l.h +1 -1
- esphome/components/qspi_dbi/qspi_dbi.cpp +2 -1
- esphome/components/remote_base/raw_protocol.cpp +1 -1
- esphome/components/remote_receiver/__init__.py +5 -6
- esphome/components/rotary_encoder/rotary_encoder.cpp +3 -1
- esphome/components/rp2040/__init__.py +1 -1
- esphome/components/rtl87xx/__init__.py +1 -1
- esphome/components/safe_mode/automation.h +1 -1
- esphome/components/seeed_mr60bha2/__init__.py +41 -0
- esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +173 -0
- esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +61 -0
- esphome/components/seeed_mr60bha2/sensor.py +57 -0
- esphome/components/seeed_mr60fda2/__init__.py +41 -0
- esphome/components/seeed_mr60fda2/binary_sensor.py +33 -0
- esphome/components/seeed_mr60fda2/button/__init__.py +45 -0
- esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.cpp +9 -0
- esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.h +18 -0
- esphome/components/seeed_mr60fda2/button/reset_radar_button.cpp +9 -0
- esphome/components/seeed_mr60fda2/button/reset_radar_button.h +18 -0
- esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp +368 -0
- esphome/components/seeed_mr60fda2/seeed_mr60fda2.h +101 -0
- esphome/components/seeed_mr60fda2/select/__init__.py +59 -0
- esphome/components/seeed_mr60fda2/select/height_threshold_select.cpp +15 -0
- esphome/components/seeed_mr60fda2/select/height_threshold_select.h +18 -0
- esphome/components/seeed_mr60fda2/select/install_height_select.cpp +15 -0
- esphome/components/seeed_mr60fda2/select/install_height_select.h +18 -0
- esphome/components/seeed_mr60fda2/select/sensitivity_select.cpp +15 -0
- esphome/components/seeed_mr60fda2/select/sensitivity_select.h +18 -0
- esphome/components/sen5x/sensor.py +5 -6
- esphome/components/sgp30/sensor.py +8 -9
- esphome/components/sgp30/sgp30.cpp +2 -6
- esphome/components/shelly_dimmer/shelly_dimmer.cpp +1 -1
- esphome/components/sim800l/sim800l.cpp +1 -1
- esphome/components/sntp/sntp_component.cpp +14 -20
- esphome/components/sntp/sntp_component.h +6 -9
- esphome/components/sntp/time.py +4 -7
- esphome/components/sprinkler/sprinkler.cpp +2 -2
- esphome/components/st7735/st7735.cpp +1 -1
- esphome/components/st7789v/st7789v.cpp +1 -1
- esphome/components/st7920/st7920.cpp +2 -3
- esphome/components/stepper/stepper.h +0 -1
- esphome/components/sun_gtil2/sun_gtil2.cpp +1 -1
- esphome/components/switch/binary_sensor/__init__.py +31 -0
- esphome/components/switch/binary_sensor/switch_binary_sensor.cpp +17 -0
- esphome/components/switch/binary_sensor/switch_binary_sensor.h +22 -0
- esphome/components/sx1509/sx1509_gpio_pin.cpp +2 -1
- esphome/components/sx1509/sx1509_gpio_pin.h +5 -5
- esphome/components/uart/uart.h +1 -1
- esphome/components/udp/udp_component.cpp +32 -16
- esphome/components/ufire_ec/sensor.py +4 -4
- esphome/components/uln2003/uln2003.cpp +4 -1
- esphome/components/waveshare_epaper/display.py +8 -0
- esphome/components/waveshare_epaper/waveshare_epaper.cpp +191 -0
- esphome/components/waveshare_epaper/waveshare_epaper.h +56 -0
- esphome/components/wiegand/__init__.py +3 -4
- esphome/components/wifi/__init__.py +42 -0
- esphome/components/wifi/wifi_component.cpp +2 -2
- esphome/components/wifi/wifi_component.h +82 -1
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +1 -1
- esphome/components/wifi/wifi_component_esp8266.cpp +1 -1
- esphome/components/wifi/wifi_component_esp_idf.cpp +1 -1
- esphome/components/wifi/wifi_component_libretiny.cpp +1 -1
- esphome/components/wifi/wifi_component_pico_w.cpp +1 -1
- esphome/components/wireguard/wireguard.cpp +2 -2
- esphome/components/xiaomi_ble/xiaomi_ble.cpp +1 -1
- esphome/config_validation.py +15 -11
- esphome/const.py +11 -1
- esphome/core/component.cpp +1 -1
- esphome/core/config.py +1 -2
- esphome/core/defines.h +3 -1
- esphome/core/helpers.cpp +20 -2
- esphome/core/helpers.h +10 -1
- esphome/core/optional.h +2 -2
- esphome/core/time.cpp +19 -15
- esphome/core/time.h +1 -3
- esphome/dashboard/web_server.py +6 -0
- {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/METADATA +4 -4
- {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/RECORD +192 -162
- {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/LICENSE +0 -0
- {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/WHEEL +0 -0
- {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/entry_points.txt +0 -0
- {esphome-2024.11.2.dist-info → esphome-2024.12.0.dist-info}/top_level.txt +0 -0
esphome/const.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"""Constants used by esphome."""
|
2
2
|
|
3
|
-
__version__ = "2024.
|
3
|
+
__version__ = "2024.12.0"
|
4
4
|
|
5
5
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
6
6
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
@@ -131,7 +131,9 @@ CONF_CLIENT_CERTIFICATE = "client_certificate"
|
|
131
131
|
CONF_CLIENT_CERTIFICATE_KEY = "client_certificate_key"
|
132
132
|
CONF_CLIENT_ID = "client_id"
|
133
133
|
CONF_CLK_PIN = "clk_pin"
|
134
|
+
CONF_CLOCK_DIVIDER = "clock_divider"
|
134
135
|
CONF_CLOCK_PIN = "clock_pin"
|
136
|
+
CONF_CLOCK_RESOLUTION = "clock_resolution"
|
135
137
|
CONF_CLOSE_ACTION = "close_action"
|
136
138
|
CONF_CLOSE_DURATION = "close_duration"
|
137
139
|
CONF_CLOSE_ENDSTOP = "close_endstop"
|
@@ -528,6 +530,7 @@ CONF_MULTIPLE = "multiple"
|
|
528
530
|
CONF_MULTIPLEXER = "multiplexer"
|
529
531
|
CONF_MULTIPLY = "multiply"
|
530
532
|
CONF_NAME = "name"
|
533
|
+
CONF_NAME_ADD_MAC_SUFFIX = "name_add_mac_suffix"
|
531
534
|
CONF_NAME_FONT = "name_font"
|
532
535
|
CONF_NBITS = "nbits"
|
533
536
|
CONF_NEC = "nec"
|
@@ -574,6 +577,7 @@ CONF_ON_FINGER_SCAN_UNMATCHED = "on_finger_scan_unmatched"
|
|
574
577
|
CONF_ON_FINISHED_WRITE = "on_finished_write"
|
575
578
|
CONF_ON_IDLE = "on_idle"
|
576
579
|
CONF_ON_JSON_MESSAGE = "on_json_message"
|
580
|
+
CONF_ON_KEY = "on_key"
|
577
581
|
CONF_ON_LOCK = "on_lock"
|
578
582
|
CONF_ON_LOOP = "on_loop"
|
579
583
|
CONF_ON_MESSAGE = "on_message"
|
@@ -690,6 +694,7 @@ CONF_PRIORITY = "priority"
|
|
690
694
|
CONF_PROJECT = "project"
|
691
695
|
CONF_PROTOCOL = "protocol"
|
692
696
|
CONF_PUBLISH_INITIAL_STATE = "publish_initial_state"
|
697
|
+
CONF_PUBLISH_NAN_AS_NONE = "publish_nan_as_none"
|
693
698
|
CONF_PULL_MODE = "pull_mode"
|
694
699
|
CONF_PULLDOWN = "pulldown"
|
695
700
|
CONF_PULLUP = "pullup"
|
@@ -736,6 +741,7 @@ CONF_RGB_ORDER = "rgb_order"
|
|
736
741
|
CONF_RGBW = "rgbw"
|
737
742
|
CONF_RISING_EDGE = "rising_edge"
|
738
743
|
CONF_RMT_CHANNEL = "rmt_channel"
|
744
|
+
CONF_RMT_SYMBOLS = "rmt_symbols"
|
739
745
|
CONF_ROTATION = "rotation"
|
740
746
|
CONF_ROW = "row"
|
741
747
|
CONF_RS_PIN = "rs_pin"
|
@@ -861,6 +867,7 @@ CONF_TARGET_TEMPERATURE_LOW_COMMAND_TOPIC = "target_temperature_low_command_topi
|
|
861
867
|
CONF_TARGET_TEMPERATURE_LOW_STATE_TOPIC = "target_temperature_low_state_topic"
|
862
868
|
CONF_TARGET_TEMPERATURE_STATE_TOPIC = "target_temperature_state_topic"
|
863
869
|
CONF_TEMPERATURE = "temperature"
|
870
|
+
CONF_TEMPERATURE_COMPENSATION = "temperature_compensation"
|
864
871
|
CONF_TEMPERATURE_OFFSET = "temperature_offset"
|
865
872
|
CONF_TEMPERATURE_SOURCE = "temperature_source"
|
866
873
|
CONF_TEMPERATURE_STEP = "temperature_step"
|
@@ -914,6 +921,7 @@ CONF_UPDATE_ON_BOOT = "update_on_boot"
|
|
914
921
|
CONF_URL = "url"
|
915
922
|
CONF_USE_ABBREVIATIONS = "use_abbreviations"
|
916
923
|
CONF_USE_ADDRESS = "use_address"
|
924
|
+
CONF_USE_DMA = "use_dma"
|
917
925
|
CONF_USE_FAHRENHEIT = "use_fahrenheit"
|
918
926
|
CONF_USERNAME = "username"
|
919
927
|
CONF_UUID = "uuid"
|
@@ -998,6 +1006,7 @@ ICON_GRAIN = "mdi:grain"
|
|
998
1006
|
ICON_GYROSCOPE_X = "mdi:axis-x-rotate-clockwise"
|
999
1007
|
ICON_GYROSCOPE_Y = "mdi:axis-y-rotate-clockwise"
|
1000
1008
|
ICON_GYROSCOPE_Z = "mdi:axis-z-rotate-clockwise"
|
1009
|
+
ICON_HEART_PULSE = "mdi:heart-pulse"
|
1001
1010
|
ICON_HEATING_COIL = "mdi:heating-coil"
|
1002
1011
|
ICON_KEY_PLUS = "mdi:key-plus"
|
1003
1012
|
ICON_LIGHTBULB = "mdi:lightbulb"
|
@@ -1037,6 +1046,7 @@ ICON_WEATHER_WINDY = "mdi:weather-windy"
|
|
1037
1046
|
ICON_WIFI = "mdi:wifi"
|
1038
1047
|
|
1039
1048
|
UNIT_AMPERE = "A"
|
1049
|
+
UNIT_BEATS_PER_MINUTE = "bpm"
|
1040
1050
|
UNIT_BECQUEREL_PER_CUBIC_METER = "Bq/m³"
|
1041
1051
|
UNIT_BYTES = "B"
|
1042
1052
|
UNIT_CELSIUS = "°C"
|
esphome/core/component.cpp
CHANGED
@@ -67,7 +67,7 @@ bool Component::cancel_retry(const std::string &name) { // NOLINT
|
|
67
67
|
}
|
68
68
|
|
69
69
|
void Component::set_timeout(const std::string &name, uint32_t timeout, std::function<void()> &&f) { // NOLINT
|
70
|
-
|
70
|
+
App.scheduler.set_timeout(this, name, timeout, std::move(f));
|
71
71
|
}
|
72
72
|
|
73
73
|
bool Component::cancel_timeout(const std::string &name) { // NOLINT
|
esphome/core/config.py
CHANGED
@@ -21,6 +21,7 @@ from esphome.const import (
|
|
21
21
|
CONF_LIBRARIES,
|
22
22
|
CONF_MIN_VERSION,
|
23
23
|
CONF_NAME,
|
24
|
+
CONF_NAME_ADD_MAC_SUFFIX,
|
24
25
|
CONF_ON_BOOT,
|
25
26
|
CONF_ON_LOOP,
|
26
27
|
CONF_ON_SHUTDOWN,
|
@@ -59,8 +60,6 @@ ProjectUpdateTrigger = cg.esphome_ns.class_(
|
|
59
60
|
|
60
61
|
VERSION_REGEX = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+(?:[ab]\d+)?$")
|
61
62
|
|
62
|
-
CONF_NAME_ADD_MAC_SUFFIX = "name_add_mac_suffix"
|
63
|
-
|
64
63
|
|
65
64
|
VALID_INCLUDE_EXTS = {".h", ".hpp", ".tcc", ".ino", ".cpp", ".c"}
|
66
65
|
|
esphome/core/defines.h
CHANGED
@@ -84,7 +84,6 @@
|
|
84
84
|
|
85
85
|
// Arduino-specific feature flags
|
86
86
|
#ifdef USE_ARDUINO
|
87
|
-
#define USE_CAPTIVE_PORTAL
|
88
87
|
#define USE_PROMETHEUS
|
89
88
|
#define USE_WIFI_WPA2_EAP
|
90
89
|
#endif
|
@@ -97,6 +96,7 @@
|
|
97
96
|
// ESP32-specific feature flags
|
98
97
|
#ifdef USE_ESP32
|
99
98
|
#define USE_BLUETOOTH_PROXY
|
99
|
+
#define USE_CAPTIVE_PORTAL
|
100
100
|
#define USE_ESP32_BLE
|
101
101
|
#define USE_ESP32_BLE_CLIENT
|
102
102
|
#define USE_ESP32_BLE_SERVER
|
@@ -135,6 +135,7 @@
|
|
135
135
|
#ifdef USE_ESP8266
|
136
136
|
#define USE_ADC_SENSOR_VCC
|
137
137
|
#define USE_ARDUINO_VERSION_CODE VERSION_CODE(3, 1, 2)
|
138
|
+
#define USE_CAPTIVE_PORTAL
|
138
139
|
#define USE_ESP8266_PREFERENCES_FLASH
|
139
140
|
#define USE_HTTP_REQUEST_ESP8266_HTTPS
|
140
141
|
#define USE_SOCKET_IMPL_LWIP_TCP
|
@@ -159,6 +160,7 @@
|
|
159
160
|
#endif
|
160
161
|
|
161
162
|
#ifdef USE_LIBRETINY
|
163
|
+
#define USE_CAPTIVE_PORTAL
|
162
164
|
#define USE_SOCKET_IMPL_LWIP_SOCKETS
|
163
165
|
#define USE_WEBSERVER
|
164
166
|
#define USE_WEBSERVER_PORT 80 // NOLINT
|
esphome/core/helpers.cpp
CHANGED
@@ -259,10 +259,15 @@ bool random_bytes(uint8_t *data, size_t len) {
|
|
259
259
|
bool str_equals_case_insensitive(const std::string &a, const std::string &b) {
|
260
260
|
return strcasecmp(a.c_str(), b.c_str()) == 0;
|
261
261
|
}
|
262
|
+
#if ESP_IDF_VERSION_MAJOR >= 5
|
263
|
+
bool str_startswith(const std::string &str, const std::string &start) { return str.starts_with(start); }
|
264
|
+
bool str_endswith(const std::string &str, const std::string &end) { return str.ends_with(end); }
|
265
|
+
#else
|
262
266
|
bool str_startswith(const std::string &str, const std::string &start) { return str.rfind(start, 0) == 0; }
|
263
267
|
bool str_endswith(const std::string &str, const std::string &end) {
|
264
268
|
return str.rfind(end) == (str.size() - end.size());
|
265
269
|
}
|
270
|
+
#endif
|
266
271
|
std::string str_truncate(const std::string &str, size_t length) {
|
267
272
|
return str.length() > length ? str.substr(0, length) : str;
|
268
273
|
}
|
@@ -293,7 +298,7 @@ std::string str_sanitize(const std::string &str) {
|
|
293
298
|
std::replace_if(
|
294
299
|
out.begin(), out.end(),
|
295
300
|
[](const char &c) {
|
296
|
-
return
|
301
|
+
return c != '-' && c != '_' && (c < '0' || c > '9') && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z');
|
297
302
|
},
|
298
303
|
'_');
|
299
304
|
return out;
|
@@ -397,6 +402,18 @@ std::string format_hex_pretty(const uint16_t *data, size_t length) {
|
|
397
402
|
}
|
398
403
|
std::string format_hex_pretty(const std::vector<uint16_t> &data) { return format_hex_pretty(data.data(), data.size()); }
|
399
404
|
|
405
|
+
std::string format_bin(const uint8_t *data, size_t length) {
|
406
|
+
std::string result;
|
407
|
+
result.resize(length * 8);
|
408
|
+
for (size_t byte_idx = 0; byte_idx < length; byte_idx++) {
|
409
|
+
for (size_t bit_idx = 0; bit_idx < 8; bit_idx++) {
|
410
|
+
result[byte_idx * 8 + bit_idx] = ((data[byte_idx] >> (7 - bit_idx)) & 1) + '0';
|
411
|
+
}
|
412
|
+
}
|
413
|
+
|
414
|
+
return result;
|
415
|
+
}
|
416
|
+
|
400
417
|
ParseOnOffState parse_on_off(const char *str, const char *on, const char *off) {
|
401
418
|
if (on == nullptr && strcasecmp(str, "on") == 0)
|
402
419
|
return PARSE_ON;
|
@@ -750,7 +767,8 @@ bool mac_address_is_valid(const uint8_t *mac) {
|
|
750
767
|
return !(is_all_zeros || is_all_ones);
|
751
768
|
}
|
752
769
|
|
753
|
-
void delay_microseconds_safe(uint32_t us) {
|
770
|
+
void IRAM_ATTR HOT delay_microseconds_safe(uint32_t us) {
|
771
|
+
// avoids CPU locks that could trigger WDT or affect WiFi/BT stability
|
754
772
|
uint32_t start = micros();
|
755
773
|
|
756
774
|
const uint32_t lag = 5000; // microseconds, specifies the maximum time for a CPU busy-loop.
|
esphome/core/helpers.h
CHANGED
@@ -420,6 +420,14 @@ template<typename T, enable_if_t<std::is_unsigned<T>::value, int> = 0> std::stri
|
|
420
420
|
return format_hex_pretty(reinterpret_cast<uint8_t *>(&val), sizeof(T));
|
421
421
|
}
|
422
422
|
|
423
|
+
/// Format the byte array \p data of length \p len in binary.
|
424
|
+
std::string format_bin(const uint8_t *data, size_t length);
|
425
|
+
/// Format an unsigned integer in binary, starting with the most significant byte.
|
426
|
+
template<typename T, enable_if_t<std::is_unsigned<T>::value, int> = 0> std::string format_bin(T val) {
|
427
|
+
val = convert_big_endian(val);
|
428
|
+
return format_bin(reinterpret_cast<uint8_t *>(&val), sizeof(T));
|
429
|
+
}
|
430
|
+
|
423
431
|
/// Return values for parse_on_off().
|
424
432
|
enum ParseOnOffState {
|
425
433
|
PARSE_NONE = 0,
|
@@ -557,7 +565,8 @@ class Mutex {
|
|
557
565
|
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
|
558
566
|
SemaphoreHandle_t handle_;
|
559
567
|
#else
|
560
|
-
|
568
|
+
// d-pointer to store private data on new platforms
|
569
|
+
void *handle_; // NOLINT(clang-diagnostic-unused-private-field)
|
561
570
|
#endif
|
562
571
|
};
|
563
572
|
|
esphome/core/optional.h
CHANGED
@@ -59,7 +59,7 @@ template<typename T> class optional { // NOLINT
|
|
59
59
|
return *this;
|
60
60
|
}
|
61
61
|
|
62
|
-
void swap(optional &rhs) {
|
62
|
+
void swap(optional &rhs) noexcept {
|
63
63
|
using std::swap;
|
64
64
|
if (has_value() && rhs.has_value()) {
|
65
65
|
swap(**this, *rhs);
|
@@ -206,7 +206,7 @@ template<typename T, typename U> inline bool operator>=(U const &v, optional<T>
|
|
206
206
|
|
207
207
|
// Specialized algorithms
|
208
208
|
|
209
|
-
template<typename T> void swap(optional<T> &x, optional<T> &y) { x.swap(y); }
|
209
|
+
template<typename T> void swap(optional<T> &x, optional<T> &y) noexcept { x.swap(y); }
|
210
210
|
|
211
211
|
// Convenience function to create an optional.
|
212
212
|
|
esphome/core/time.cpp
CHANGED
@@ -5,20 +5,18 @@
|
|
5
5
|
|
6
6
|
namespace esphome {
|
7
7
|
|
8
|
-
bool is_leap_year(uint32_t year) { return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0); }
|
9
|
-
|
10
8
|
uint8_t days_in_month(uint8_t month, uint16_t year) {
|
11
9
|
static const uint8_t DAYS_IN_MONTH[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
12
|
-
|
13
|
-
if (month == 2 && is_leap_year(year))
|
10
|
+
if (month == 2 && (year % 4 == 0))
|
14
11
|
return 29;
|
15
|
-
return
|
12
|
+
return DAYS_IN_MONTH[month];
|
16
13
|
}
|
17
14
|
|
18
15
|
size_t ESPTime::strftime(char *buffer, size_t buffer_len, const char *format) {
|
19
16
|
struct tm c_tm = this->to_c_tm();
|
20
17
|
return ::strftime(buffer, buffer_len, format, &c_tm);
|
21
18
|
}
|
19
|
+
|
22
20
|
ESPTime ESPTime::from_c_tm(struct tm *c_tm, time_t c_time) {
|
23
21
|
ESPTime res{};
|
24
22
|
res.second = uint8_t(c_tm->tm_sec);
|
@@ -33,6 +31,7 @@ ESPTime ESPTime::from_c_tm(struct tm *c_tm, time_t c_time) {
|
|
33
31
|
res.timestamp = c_time;
|
34
32
|
return res;
|
35
33
|
}
|
34
|
+
|
36
35
|
struct tm ESPTime::to_c_tm() {
|
37
36
|
struct tm c_tm {};
|
38
37
|
c_tm.tm_sec = this->second;
|
@@ -46,6 +45,7 @@ struct tm ESPTime::to_c_tm() {
|
|
46
45
|
c_tm.tm_isdst = this->is_dst;
|
47
46
|
return c_tm;
|
48
47
|
}
|
48
|
+
|
49
49
|
std::string ESPTime::strftime(const std::string &format) {
|
50
50
|
std::string timestr;
|
51
51
|
timestr.resize(format.size() * 4);
|
@@ -142,6 +142,7 @@ void ESPTime::increment_second() {
|
|
142
142
|
this->year++;
|
143
143
|
}
|
144
144
|
}
|
145
|
+
|
145
146
|
void ESPTime::increment_day() {
|
146
147
|
this->timestamp += 86400;
|
147
148
|
|
@@ -159,23 +160,22 @@ void ESPTime::increment_day() {
|
|
159
160
|
this->year++;
|
160
161
|
}
|
161
162
|
}
|
163
|
+
|
162
164
|
void ESPTime::recalc_timestamp_utc(bool use_day_of_year) {
|
163
165
|
time_t res = 0;
|
164
|
-
|
165
166
|
if (!this->fields_in_range()) {
|
166
167
|
this->timestamp = -1;
|
167
168
|
return;
|
168
169
|
}
|
169
170
|
|
170
171
|
for (int i = 1970; i < this->year; i++)
|
171
|
-
res +=
|
172
|
+
res += (i % 4 == 0) ? 366 : 365;
|
172
173
|
|
173
174
|
if (use_day_of_year) {
|
174
175
|
res += this->day_of_year - 1;
|
175
176
|
} else {
|
176
177
|
for (int i = 1; i < this->month; i++)
|
177
178
|
res += days_in_month(i, this->year);
|
178
|
-
|
179
179
|
res += this->day_of_month - 1;
|
180
180
|
}
|
181
181
|
|
@@ -188,13 +188,17 @@ void ESPTime::recalc_timestamp_utc(bool use_day_of_year) {
|
|
188
188
|
this->timestamp = res;
|
189
189
|
}
|
190
190
|
|
191
|
-
void ESPTime::recalc_timestamp_local(
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
191
|
+
void ESPTime::recalc_timestamp_local() {
|
192
|
+
struct tm tm;
|
193
|
+
|
194
|
+
tm.tm_year = this->year - 1900;
|
195
|
+
tm.tm_mon = this->month - 1;
|
196
|
+
tm.tm_mday = this->day_of_month;
|
197
|
+
tm.tm_hour = this->hour;
|
198
|
+
tm.tm_min = this->minute;
|
199
|
+
tm.tm_sec = this->second;
|
200
|
+
|
201
|
+
this->timestamp = mktime(&tm);
|
198
202
|
}
|
199
203
|
|
200
204
|
int32_t ESPTime::timezone_offset() {
|
esphome/core/time.h
CHANGED
@@ -9,8 +9,6 @@ namespace esphome {
|
|
9
9
|
|
10
10
|
template<typename T> bool increment_time_value(T ¤t, uint16_t begin, uint16_t end);
|
11
11
|
|
12
|
-
bool is_leap_year(uint32_t year);
|
13
|
-
|
14
12
|
uint8_t days_in_month(uint8_t month, uint16_t year);
|
15
13
|
|
16
14
|
/// A more user-friendly version of struct tm from time.h
|
@@ -100,7 +98,7 @@ struct ESPTime {
|
|
100
98
|
void recalc_timestamp_utc(bool use_day_of_year = true);
|
101
99
|
|
102
100
|
/// Recalculate the timestamp field from the other fields of this ESPTime instance assuming local fields.
|
103
|
-
void recalc_timestamp_local(
|
101
|
+
void recalc_timestamp_local();
|
104
102
|
|
105
103
|
/// Convert this ESPTime instance back to a tm struct.
|
106
104
|
struct tm to_c_tm();
|
esphome/dashboard/web_server.py
CHANGED
@@ -108,6 +108,12 @@ def is_authenticated(handler: BaseHandler) -> bool:
|
|
108
108
|
return True
|
109
109
|
|
110
110
|
if settings.using_auth:
|
111
|
+
if auth_header := handler.request.headers.get("Authorization"):
|
112
|
+
assert isinstance(auth_header, str)
|
113
|
+
if auth_header.startswith("Basic "):
|
114
|
+
auth_decoded = base64.b64decode(auth_header[6:]).decode()
|
115
|
+
username, password = auth_decoded.split(":", 1)
|
116
|
+
return settings.check_password(username, password)
|
111
117
|
return handler.get_secure_cookie(AUTH_COOKIE_NAME) == COOKIE_AUTHENTICATED_YES
|
112
118
|
|
113
119
|
return True
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: esphome
|
3
|
-
Version: 2024.
|
4
|
-
Summary:
|
3
|
+
Version: 2024.12.0
|
4
|
+
Summary: ESPHome is a system to configure your microcontrollers by simple yet powerful configuration files and control them remotely through Home Automation systems.
|
5
5
|
Author-email: The ESPHome Authors <esphome@nabucasa.com>
|
6
6
|
License: MIT
|
7
7
|
Project-URL: Documentation, https://esphome.io
|
@@ -36,7 +36,7 @@ Requires-Dist: pyserial ==3.5
|
|
36
36
|
Requires-Dist: platformio ==6.1.16
|
37
37
|
Requires-Dist: esptool ==4.7.0
|
38
38
|
Requires-Dist: click ==8.1.7
|
39
|
-
Requires-Dist: esphome-dashboard ==
|
39
|
+
Requires-Dist: esphome-dashboard ==20241217.1
|
40
40
|
Requires-Dist: aioesphomeapi ==24.6.2
|
41
41
|
Requires-Dist: zeroconf ==0.132.2
|
42
42
|
Requires-Dist: puremagic ==1.27
|
@@ -50,7 +50,7 @@ Requires-Dist: argcomplete >=2.0.0
|
|
50
50
|
Requires-Dist: async-timeout ==4.0.3 ; python_version <= "3.10"
|
51
51
|
Provides-Extra: dev
|
52
52
|
Requires-Dist: clang-format ==13.0.1 ; extra == 'dev'
|
53
|
-
Requires-Dist: clang-tidy ==
|
53
|
+
Requires-Dist: clang-tidy ==18.1.8 ; extra == 'dev'
|
54
54
|
Requires-Dist: yamllint ==1.35.1 ; extra == 'dev'
|
55
55
|
Provides-Extra: displays
|
56
56
|
Requires-Dist: cairosvg ==2.7.1 ; extra == 'displays'
|