esphome 2024.7.2__py3-none-any.whl → 2024.8.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 +15 -81
- esphome/automation.py +1 -1
- esphome/codegen.py +53 -53
- esphome/components/ade7953/sensor.py +1 -1
- esphome/components/ade7953_spi/ade7953_spi.cpp +1 -1
- esphome/components/airthings_wave_plus/airthings_wave_plus.cpp +5 -2
- esphome/components/airthings_wave_plus/airthings_wave_plus.h +2 -0
- esphome/components/airthings_wave_plus/sensor.py +12 -0
- esphome/components/alarm_control_panel/__init__.py +75 -66
- esphome/components/apds9306/__init__.py +4 -0
- esphome/components/apds9306/apds9306.cpp +151 -0
- esphome/components/apds9306/apds9306.h +66 -0
- esphome/components/apds9306/sensor.py +95 -0
- esphome/components/api/__init__.py +80 -52
- esphome/components/api/api_connection.cpp +14 -1
- esphome/components/api/api_pb2.cpp +33 -4
- esphome/components/api/api_pb2.h +8 -1
- esphome/components/api/api_server.cpp +10 -0
- esphome/components/api/api_server.h +3 -0
- esphome/components/atm90e32/__init__.py +7 -0
- esphome/components/atm90e32/atm90e32.cpp +68 -16
- esphome/components/atm90e32/atm90e32.h +20 -7
- esphome/components/atm90e32/atm90e32_reg.h +2 -0
- esphome/components/atm90e32/button/__init__.py +43 -0
- esphome/components/atm90e32/button/atm90e32_button.cpp +20 -0
- esphome/components/atm90e32/button/atm90e32_button.h +27 -0
- esphome/components/atm90e32/sensor.py +15 -11
- esphome/components/bedjet/bedjet_codec.h +1 -1
- esphome/components/binary/light/binary_light_output.h +3 -2
- esphome/components/binary_sensor/__init__.py +5 -5
- esphome/components/ble_client/__init__.py +3 -3
- esphome/components/ble_client/output/__init__.py +1 -1
- esphome/components/ble_client/sensor/__init__.py +4 -3
- esphome/components/ble_client/switch/__init__.py +2 -1
- esphome/components/ble_client/text_sensor/__init__.py +4 -3
- esphome/components/ble_presence/binary_sensor.py +3 -3
- esphome/components/ble_rssi/sensor.py +2 -2
- esphome/components/ble_scanner/text_sensor.py +1 -1
- esphome/components/bluetooth_proxy/__init__.py +3 -3
- esphome/components/bme68x_bsec2/__init__.py +196 -0
- esphome/components/bme68x_bsec2/bme68x_bsec2.cpp +523 -0
- esphome/components/bme68x_bsec2/bme68x_bsec2.h +163 -0
- esphome/components/bme68x_bsec2/sensor.py +130 -0
- esphome/components/bme68x_bsec2/text_sensor.py +33 -0
- esphome/components/bme68x_bsec2_i2c/__init__.py +28 -0
- esphome/components/bme68x_bsec2_i2c/bme68x_bsec2_i2c.cpp +53 -0
- esphome/components/bme68x_bsec2_i2c/bme68x_bsec2_i2c.h +28 -0
- esphome/components/bmp3xx/sensor.py +1 -1
- esphome/components/button/__init__.py +4 -4
- esphome/components/climate/__init__.py +5 -5
- esphome/components/climate/climate.h +1 -1
- esphome/components/cover/__init__.py +8 -8
- esphome/components/cst226/touchscreen/cst226_touchscreen.cpp +11 -7
- esphome/components/cst226/touchscreen/cst226_touchscreen.h +1 -1
- esphome/components/datetime/__init__.py +11 -13
- esphome/components/demo/demo_sensor.h +3 -2
- esphome/components/display/display.cpp +31 -0
- esphome/components/display/display.h +3 -0
- esphome/components/display_menu_base/__init__.py +14 -13
- esphome/components/ens160/sensor.py +1 -1
- esphome/components/esp32/__init__.py +22 -10
- esphome/components/esp32/boards.py +1 -1
- esphome/components/esp32/gpio.py +12 -13
- esphome/components/esp32/gpio_esp32.py +1 -2
- esphome/components/esp32/gpio_esp32_c2.py +1 -2
- esphome/components/esp32/gpio_esp32_c3.py +1 -5
- esphome/components/esp32/gpio_esp32_c6.py +1 -2
- esphome/components/esp32/gpio_esp32_h2.py +1 -2
- esphome/components/esp32/gpio_esp32_s2.py +1 -2
- esphome/components/esp32/gpio_esp32_s3.py +1 -6
- esphome/components/esp32_ble/__init__.py +20 -3
- esphome/components/esp32_ble/ble.cpp +9 -1
- esphome/components/esp32_ble/ble.h +9 -0
- esphome/components/esp32_ble/ble_advertising.cpp +42 -9
- esphome/components/esp32_ble/ble_advertising.h +21 -1
- esphome/components/esp32_ble_beacon/__init__.py +17 -7
- esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +45 -113
- esphome/components/esp32_ble_beacon/esp32_ble_beacon.h +17 -19
- esphome/components/esp32_ble_client/__init__.py +0 -1
- esphome/components/esp32_ble_server/__init__.py +2 -3
- esphome/components/esp32_ble_tracker/__init__.py +2 -2
- esphome/components/esp32_improv/__init__.py +2 -4
- esphome/components/ethernet/__init__.py +17 -17
- esphome/components/ethernet_info/text_sensor.py +2 -2
- esphome/components/event/__init__.py +5 -5
- esphome/components/fan/__init__.py +14 -14
- esphome/components/fan/fan.cpp +2 -2
- esphome/components/fingerprint_grow/fingerprint_grow.cpp +1 -1
- esphome/components/fingerprint_grow/fingerprint_grow.h +1 -1
- esphome/components/graphical_display_menu/__init__.py +11 -8
- esphome/components/haier/haier_base.h +2 -2
- esphome/components/homeassistant/__init__.py +8 -1
- esphome/components/homeassistant/number/__init__.py +33 -0
- esphome/components/homeassistant/number/homeassistant_number.cpp +100 -0
- esphome/components/homeassistant/number/homeassistant_number.h +31 -0
- esphome/components/homeassistant/switch/__init__.py +30 -0
- esphome/components/homeassistant/switch/homeassistant_switch.cpp +59 -0
- esphome/components/homeassistant/switch/homeassistant_switch.h +22 -0
- esphome/components/host/__init__.py +3 -7
- esphome/components/http_request/__init__.py +12 -1
- esphome/components/http_request/http_request_arduino.cpp +2 -2
- esphome/components/http_request/http_request_idf.cpp +11 -2
- esphome/components/http_request/http_request_idf.h +10 -0
- esphome/components/http_request/ota/ota_http_request.cpp +1 -1
- esphome/components/http_request/update/http_request_update.cpp +2 -2
- esphome/components/http_request/update/http_request_update.h +2 -1
- esphome/components/hx711/hx711.cpp +10 -1
- esphome/components/hydreon_rgxx/hydreon_rgxx.cpp +1 -1
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +11 -2
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +2 -0
- esphome/components/ili9xxx/ili9xxx_defines.h +3 -1
- esphome/components/ili9xxx/ili9xxx_display.cpp +9 -22
- esphome/components/ili9xxx/ili9xxx_display.h +5 -7
- esphome/components/ili9xxx/ili9xxx_init.h +4 -4
- esphome/components/improv_base/__init__.py +2 -3
- esphome/components/improv_serial/__init__.py +4 -10
- esphome/components/improv_serial/improv_serial_component.cpp +4 -0
- esphome/components/jsn_sr04t/jsn_sr04t.cpp +18 -1
- esphome/components/jsn_sr04t/jsn_sr04t.h +7 -1
- esphome/components/jsn_sr04t/sensor.py +13 -0
- esphome/components/kalman_combinator/sensor.py +1 -1
- esphome/components/light/__init__.py +16 -15
- esphome/components/light/addressable_light_effect.h +12 -8
- esphome/components/light/automation.h +16 -1
- esphome/components/light/automation.py +21 -0
- esphome/components/light/base_light_effects.h +5 -5
- esphome/components/light/esp_color_correction.h +8 -8
- esphome/components/light/types.py +7 -0
- esphome/components/lock/__init__.py +3 -3
- esphome/components/logger/__init__.py +15 -18
- esphome/components/lvgl/__init__.py +346 -0
- esphome/components/lvgl/automation.py +226 -0
- esphome/components/lvgl/binary_sensor/__init__.py +43 -0
- esphome/components/lvgl/defines.py +508 -0
- esphome/components/lvgl/encoders.py +77 -0
- esphome/components/lvgl/font.cpp +76 -0
- esphome/components/lvgl/helpers.py +49 -0
- esphome/components/lvgl/light/__init__.py +32 -0
- esphome/components/lvgl/light/lvgl_light.h +48 -0
- esphome/components/lvgl/lv_validation.py +303 -0
- esphome/components/lvgl/lvcode.py +349 -0
- esphome/components/lvgl/lvgl_esphome.cpp +407 -0
- esphome/components/lvgl/lvgl_esphome.h +274 -0
- esphome/components/lvgl/lvgl_hal.h +21 -0
- esphome/components/lvgl/number/__init__.py +66 -0
- esphome/components/lvgl/number/lvgl_number.h +34 -0
- esphome/components/lvgl/schemas.py +436 -0
- esphome/components/lvgl/select/__init__.py +55 -0
- esphome/components/lvgl/select/lvgl_select.h +62 -0
- esphome/components/lvgl/sensor/__init__.py +47 -0
- esphome/components/lvgl/styles.py +58 -0
- esphome/components/lvgl/switch/__init__.py +56 -0
- esphome/components/lvgl/switch/lvgl_switch.h +34 -0
- esphome/components/lvgl/text/__init__.py +50 -0
- esphome/components/lvgl/text/lvgl_text.h +34 -0
- esphome/components/lvgl/text_sensor/__init__.py +42 -0
- esphome/components/lvgl/touchscreens.py +45 -0
- esphome/components/lvgl/trigger.py +74 -0
- esphome/components/lvgl/types.py +191 -0
- esphome/components/lvgl/widgets/__init__.py +419 -0
- esphome/components/lvgl/widgets/animimg.py +117 -0
- esphome/components/lvgl/widgets/arc.py +78 -0
- esphome/components/lvgl/widgets/button.py +20 -0
- esphome/components/lvgl/widgets/buttonmatrix.py +275 -0
- esphome/components/lvgl/widgets/checkbox.py +27 -0
- esphome/components/lvgl/widgets/dropdown.py +76 -0
- esphome/components/lvgl/widgets/img.py +85 -0
- esphome/components/lvgl/widgets/keyboard.py +49 -0
- esphome/components/lvgl/widgets/label.py +42 -0
- esphome/components/lvgl/widgets/led.py +29 -0
- esphome/components/lvgl/widgets/line.py +50 -0
- esphome/components/lvgl/widgets/lv_bar.py +55 -0
- esphome/components/lvgl/widgets/meter.py +302 -0
- esphome/components/lvgl/widgets/msgbox.py +134 -0
- esphome/components/lvgl/widgets/obj.py +28 -0
- esphome/components/lvgl/widgets/page.py +113 -0
- esphome/components/lvgl/widgets/roller.py +77 -0
- esphome/components/lvgl/widgets/slider.py +63 -0
- esphome/components/lvgl/widgets/spinbox.py +178 -0
- esphome/components/lvgl/widgets/spinner.py +43 -0
- esphome/components/lvgl/widgets/switch.py +20 -0
- esphome/components/lvgl/widgets/tabview.py +114 -0
- esphome/components/lvgl/widgets/textarea.py +66 -0
- esphome/components/lvgl/widgets/tileview.py +128 -0
- esphome/components/m5stack_8angle/__init__.py +33 -0
- esphome/components/m5stack_8angle/binary_sensor/__init__.py +30 -0
- esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.cpp +17 -0
- esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.h +19 -0
- esphome/components/m5stack_8angle/light/__init__.py +31 -0
- esphome/components/m5stack_8angle/light/m5stack_8angle_light.cpp +45 -0
- esphome/components/m5stack_8angle/light/m5stack_8angle_light.h +37 -0
- esphome/components/m5stack_8angle/m5stack_8angle.cpp +74 -0
- esphome/components/m5stack_8angle/m5stack_8angle.h +34 -0
- esphome/components/m5stack_8angle/sensor/__init__.py +66 -0
- esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.cpp +24 -0
- esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.h +27 -0
- esphome/components/matrix_keypad/matrix_keypad.cpp +2 -0
- esphome/components/max31856/sensor.py +5 -5
- esphome/components/media_player/__init__.py +3 -5
- esphome/components/media_player/automation.h +31 -27
- esphome/components/micro_wake_word/__init__.py +20 -25
- esphome/components/micro_wake_word/streaming_model.cpp +6 -4
- esphome/components/microphone/microphone.h +4 -1
- esphome/components/mitsubishi/mitsubishi.cpp +7 -1
- esphome/components/modbus_controller/__init__.py +26 -2
- esphome/components/modbus_controller/automation.h +19 -0
- esphome/components/modbus_controller/const.py +1 -0
- esphome/components/modbus_controller/modbus_controller.cpp +8 -0
- esphome/components/modbus_controller/modbus_controller.h +3 -0
- esphome/components/mqtt/__init__.py +20 -9
- esphome/components/mqtt/mqtt_alarm_control_panel.cpp +128 -0
- esphome/components/mqtt/mqtt_alarm_control_panel.h +39 -0
- esphome/components/mqtt/mqtt_backend.h +3 -1
- esphome/components/mqtt/mqtt_backend_esp32.cpp +4 -1
- esphome/components/mqtt/mqtt_backend_esp32.h +3 -1
- esphome/components/mqtt/mqtt_backend_esp8266.h +3 -1
- esphome/components/mqtt/mqtt_backend_libretiny.h +3 -1
- esphome/components/mqtt/mqtt_client.cpp +16 -3
- esphome/components/mqtt/mqtt_client.h +5 -1
- esphome/components/mqtt/mqtt_component.cpp +32 -4
- esphome/components/mqtt/mqtt_const.h +2 -0
- esphome/components/network/__init__.py +15 -12
- esphome/components/network/ip_address.h +3 -0
- esphome/components/network/util.cpp +2 -1
- esphome/components/network/util.h +3 -1
- esphome/components/nextion/base_component.py +5 -8
- esphome/components/number/__init__.py +7 -8
- esphome/components/online_image/__init__.py +167 -0
- esphome/components/online_image/image_decoder.cpp +44 -0
- esphome/components/online_image/image_decoder.h +112 -0
- esphome/components/online_image/online_image.cpp +283 -0
- esphome/components/online_image/online_image.h +195 -0
- esphome/components/online_image/png_image.cpp +68 -0
- esphome/components/online_image/png_image.h +33 -0
- esphome/components/ota/__init__.py +8 -4
- esphome/components/pid/pid_climate.h +2 -0
- esphome/components/pmwcs3/pmwcs3.cpp +31 -30
- esphome/components/remote_base/pronto_protocol.cpp +0 -3
- esphome/components/remote_transmitter/remote_transmitter.h +1 -1
- esphome/components/rgbct/rgbct_light_output.h +3 -2
- esphome/components/rgbw/rgbw_light_output.h +3 -2
- esphome/components/rgbww/rgbww_light_output.h +3 -2
- esphome/components/rp2040_pio_led_strip/led_strip.cpp +31 -5
- esphome/components/rp2040_pio_led_strip/led_strip.h +5 -0
- esphome/components/rtttl/rtttl.cpp +108 -21
- esphome/components/rtttl/rtttl.h +15 -6
- esphome/components/select/__init__.py +7 -7
- esphome/components/sensor/__init__.py +29 -10
- esphome/components/sensor/filter.cpp +8 -0
- esphome/components/sensor/filter.h +9 -0
- esphome/components/sml/sml_parser.cpp +48 -22
- esphome/components/socket/socket.cpp +11 -14
- esphome/components/speaker/__init__.py +14 -5
- esphome/components/speaker/automation.h +10 -0
- esphome/components/speaker/speaker.h +9 -0
- esphome/components/spi/spi.cpp +0 -6
- esphome/components/spi/spi.h +2 -19
- esphome/components/spi_led_strip/spi_led_strip.h +5 -4
- esphome/components/sprinkler/sprinkler.cpp +2 -2
- esphome/components/sprinkler/sprinkler.h +1 -1
- esphome/components/switch/__init__.py +3 -3
- esphome/components/text/__init__.py +5 -5
- esphome/components/text_sensor/__init__.py +7 -7
- esphome/components/time/__init__.py +8 -8
- esphome/components/touchscreen/binary_sensor/__init__.py +24 -10
- esphome/components/touchscreen/binary_sensor/touchscreen_binary_sensor.cpp +3 -2
- esphome/components/touchscreen/binary_sensor/touchscreen_binary_sensor.h +4 -2
- esphome/components/uart/uart_component_host.cpp +6 -2
- esphome/components/update/__init__.py +33 -15
- esphome/components/update/automation.h +23 -0
- esphome/components/update/update_entity.h +3 -1
- esphome/components/valve/__init__.py +3 -3
- esphome/components/voice_assistant/__init__.py +7 -8
- esphome/components/wake_on_lan/wake_on_lan.cpp +2 -0
- esphome/components/wake_on_lan/wake_on_lan.h +3 -1
- esphome/components/watchdog/__init__.py +1 -0
- esphome/components/{http_request → watchdog}/watchdog.cpp +0 -2
- esphome/components/{http_request → watchdog}/watchdog.h +0 -2
- esphome/components/waveshare_epaper/waveshare_epaper.cpp +5 -5
- esphome/components/web_server/server_index_v3.h +3615 -3603
- esphome/components/web_server/web_server.cpp +0 -209
- esphome/components/web_server/web_server.h +1 -1
- esphome/components/web_server/web_server_v1.cpp +217 -0
- esphome/components/web_server_base/web_server_base.h +1 -0
- esphome/components/wifi/__init__.py +15 -14
- esphome/components/wifi/wifi_component.cpp +2 -0
- esphome/components/wifi/wifi_component.h +7 -1
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +5 -2
- esphome/components/wifi/wifi_component_esp8266.cpp +2 -0
- esphome/components/wifi/wifi_component_esp_idf.cpp +43 -7
- esphome/components/wifi/wifi_component_libretiny.cpp +2 -0
- esphome/components/wifi/wifi_component_pico_w.cpp +2 -0
- esphome/components/wifi/wpa2_eap.py +6 -7
- esphome/components/wifi_info/text_sensor.py +3 -3
- esphome/components/wifi_info/wifi_info_text_sensor.cpp +2 -0
- esphome/components/wifi_info/wifi_info_text_sensor.h +2 -0
- esphome/components/wifi_signal/sensor.py +1 -1
- esphome/components/wifi_signal/wifi_signal_sensor.cpp +2 -0
- esphome/components/wifi_signal/wifi_signal_sensor.h +2 -1
- esphome/components/xiaomi_ble/xiaomi_ble.cpp +20 -3
- esphome/components/xiaomi_ble/xiaomi_ble.h +1 -0
- esphome/components/xiaomi_lywsd02mmc/__init__.py +0 -0
- esphome/components/xiaomi_lywsd02mmc/sensor.py +77 -0
- esphome/components/xiaomi_lywsd02mmc/xiaomi_lywsd02mmc.cpp +73 -0
- esphome/components/xiaomi_lywsd02mmc/xiaomi_lywsd02mmc.h +37 -0
- esphome/config.py +17 -19
- esphome/config_validation.py +55 -23
- esphome/const.py +25 -9
- esphome/core/__init__.py +17 -14
- esphome/core/application.h +42 -21
- esphome/core/automation.h +5 -3
- esphome/core/base_automation.h +3 -2
- esphome/core/bytebuffer.cpp +134 -0
- esphome/core/bytebuffer.h +96 -0
- esphome/core/color.h +24 -16
- esphome/core/config.py +3 -3
- esphome/core/defines.h +14 -1
- esphome/core/entity_base.h +2 -2
- esphome/core/entity_helpers.py +1 -2
- esphome/core/gpio.h +0 -18
- esphome/core/helpers.h +1 -1
- esphome/core/optional.h +15 -16
- esphome/coroutine.py +1 -1
- esphome/cpp_generator.py +1 -1
- esphome/cpp_helpers.py +3 -5
- esphome/dashboard/core.py +3 -3
- esphome/dashboard/dashboard.py +3 -3
- esphome/dashboard/entries.py +1 -1
- esphome/dashboard/util/file.py +1 -1
- esphome/dashboard/web_server.py +3 -3
- esphome/external_files.py +5 -3
- esphome/final_validate.py +2 -2
- esphome/git.py +4 -4
- esphome/helpers.py +5 -5
- esphome/loader.py +15 -10
- esphome/mqtt.py +4 -8
- esphome/pins.py +6 -6
- esphome/platformio_api.py +5 -5
- esphome/storage_json.py +2 -1
- esphome/types.py +1 -1
- esphome/util.py +2 -3
- esphome/voluptuous_schema.py +1 -0
- esphome/vscode.py +5 -4
- esphome/wizard.py +1 -1
- esphome/writer.py +7 -7
- esphome/yaml_util.py +3 -3
- esphome/zeroconf.py +1 -1
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/METADATA +3 -3
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/RECORD +353 -247
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/LICENSE +0 -0
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/WHEEL +0 -0
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/entry_points.txt +0 -0
- {esphome-2024.7.2.dist-info → esphome-2024.8.0.dist-info}/top_level.txt +0 -0
esphome/__main__.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# PYTHON_ARGCOMPLETE_OK
|
2
2
|
import argparse
|
3
|
+
from datetime import datetime
|
3
4
|
import functools
|
4
5
|
import logging
|
5
6
|
import os
|
6
7
|
import re
|
7
8
|
import sys
|
8
9
|
import time
|
9
|
-
from datetime import datetime
|
10
10
|
|
11
11
|
import argcomplete
|
12
12
|
|
@@ -39,14 +39,14 @@ from esphome.const import (
|
|
39
39
|
)
|
40
40
|
from esphome.core import CORE, EsphomeError, coroutine
|
41
41
|
from esphome.helpers import indent, is_ip_address
|
42
|
+
from esphome.log import Fore, color, setup_log
|
42
43
|
from esphome.util import (
|
44
|
+
get_serial_ports,
|
45
|
+
list_yaml_files,
|
43
46
|
run_external_command,
|
44
47
|
run_external_process,
|
45
48
|
safe_print,
|
46
|
-
list_yaml_files,
|
47
|
-
get_serial_ports,
|
48
49
|
)
|
49
|
-
from esphome.log import color, setup_log, Fore
|
50
50
|
|
51
51
|
_LOGGER = logging.getLogger(__name__)
|
52
52
|
|
@@ -116,6 +116,7 @@ def get_port_type(port):
|
|
116
116
|
|
117
117
|
def run_miniterm(config, port):
|
118
118
|
import serial
|
119
|
+
|
119
120
|
from esphome import platformio_api
|
120
121
|
|
121
122
|
if CONF_LOGGER not in config:
|
@@ -596,9 +597,10 @@ def command_update_all(args):
|
|
596
597
|
|
597
598
|
|
598
599
|
def command_idedata(args, config):
|
599
|
-
from esphome import platformio_api
|
600
600
|
import json
|
601
601
|
|
602
|
+
from esphome import platformio_api
|
603
|
+
|
602
604
|
logging.disable(logging.INFO)
|
603
605
|
logging.disable(logging.WARNING)
|
604
606
|
|
@@ -747,7 +749,14 @@ def parse_args(argv):
|
|
747
749
|
)
|
748
750
|
|
749
751
|
parser = argparse.ArgumentParser(
|
750
|
-
description=f"ESPHome
|
752
|
+
description=f"ESPHome {const.__version__}", parents=[options_parser]
|
753
|
+
)
|
754
|
+
|
755
|
+
parser.add_argument(
|
756
|
+
"--version",
|
757
|
+
action="version",
|
758
|
+
version=f"Version: {const.__version__}",
|
759
|
+
help="Print the ESPHome version and exit.",
|
751
760
|
)
|
752
761
|
|
753
762
|
mqtt_options = argparse.ArgumentParser(add_help=False)
|
@@ -948,67 +957,6 @@ def parse_args(argv):
|
|
948
957
|
# a deprecation warning).
|
949
958
|
arguments = argv[1:]
|
950
959
|
|
951
|
-
# On Python 3.9+ we can simply set exit_on_error=False in the constructor
|
952
|
-
def _raise(x):
|
953
|
-
raise argparse.ArgumentError(None, x)
|
954
|
-
|
955
|
-
# First, try new-style parsing, but don't exit in case of failure
|
956
|
-
try:
|
957
|
-
# duplicate parser so that we can use the original one to raise errors later on
|
958
|
-
current_parser = argparse.ArgumentParser(add_help=False, parents=[parser])
|
959
|
-
current_parser.set_defaults(deprecated_argv_suggestion=None)
|
960
|
-
current_parser.error = _raise
|
961
|
-
return current_parser.parse_args(arguments)
|
962
|
-
except argparse.ArgumentError:
|
963
|
-
pass
|
964
|
-
|
965
|
-
# Second, try compat parsing and rearrange the command-line if it succeeds
|
966
|
-
# Disable argparse's built-in help option and add it manually to prevent this
|
967
|
-
# parser from printing the help messagefor the old format when invoked with -h.
|
968
|
-
compat_parser = argparse.ArgumentParser(parents=[options_parser], add_help=False)
|
969
|
-
compat_parser.add_argument("-h", "--help", action="store_true")
|
970
|
-
compat_parser.add_argument("configuration", nargs="*")
|
971
|
-
compat_parser.add_argument(
|
972
|
-
"command",
|
973
|
-
choices=[
|
974
|
-
"config",
|
975
|
-
"compile",
|
976
|
-
"upload",
|
977
|
-
"logs",
|
978
|
-
"run",
|
979
|
-
"clean-mqtt",
|
980
|
-
"wizard",
|
981
|
-
"mqtt-fingerprint",
|
982
|
-
"version",
|
983
|
-
"clean",
|
984
|
-
"dashboard",
|
985
|
-
"vscode",
|
986
|
-
"update-all",
|
987
|
-
],
|
988
|
-
)
|
989
|
-
|
990
|
-
try:
|
991
|
-
compat_parser.error = _raise
|
992
|
-
result, unparsed = compat_parser.parse_known_args(argv[1:])
|
993
|
-
last_option = len(arguments) - len(unparsed) - 1 - len(result.configuration)
|
994
|
-
unparsed = [
|
995
|
-
"--device" if arg in ("--upload-port", "--serial-port") else arg
|
996
|
-
for arg in unparsed
|
997
|
-
]
|
998
|
-
arguments = (
|
999
|
-
arguments[0:last_option]
|
1000
|
-
+ [result.command]
|
1001
|
-
+ result.configuration
|
1002
|
-
+ unparsed
|
1003
|
-
)
|
1004
|
-
deprecated_argv_suggestion = arguments
|
1005
|
-
except argparse.ArgumentError:
|
1006
|
-
# old-style parsing failed, don't suggest any argument
|
1007
|
-
deprecated_argv_suggestion = None
|
1008
|
-
|
1009
|
-
# Finally, run the new-style parser again with the possibly swapped arguments,
|
1010
|
-
# and let it error out if the command is unparsable.
|
1011
|
-
parser.set_defaults(deprecated_argv_suggestion=deprecated_argv_suggestion)
|
1012
960
|
argcomplete.autocomplete(parser)
|
1013
961
|
return parser.parse_args(arguments)
|
1014
962
|
|
@@ -1023,20 +971,6 @@ def run_esphome(argv):
|
|
1023
971
|
# Show timestamp for dashboard access logs
|
1024
972
|
args.command == "dashboard",
|
1025
973
|
)
|
1026
|
-
if args.deprecated_argv_suggestion is not None and args.command != "vscode":
|
1027
|
-
_LOGGER.warning(
|
1028
|
-
"Calling ESPHome with the configuration before the command is deprecated "
|
1029
|
-
"and will be removed in the future. "
|
1030
|
-
)
|
1031
|
-
_LOGGER.warning("Please instead use:")
|
1032
|
-
_LOGGER.warning(" esphome %s", " ".join(args.deprecated_argv_suggestion))
|
1033
|
-
|
1034
|
-
if sys.version_info < (3, 8, 0):
|
1035
|
-
_LOGGER.error(
|
1036
|
-
"You're running ESPHome with Python <3.8. ESPHome is no longer compatible "
|
1037
|
-
"with this Python version. Please reinstall ESPHome with Python 3.8+"
|
1038
|
-
)
|
1039
|
-
return 1
|
1040
974
|
|
1041
975
|
if args.command in PRE_CONFIG_ACTIONS:
|
1042
976
|
try:
|
esphome/automation.py
CHANGED
esphome/codegen.py
CHANGED
@@ -8,55 +8,78 @@
|
|
8
8
|
# want to break suddenly due to a rename (this file will get backports for features).
|
9
9
|
|
10
10
|
# pylint: disable=unused-import
|
11
|
-
from esphome.cpp_generator import ( # noqa
|
11
|
+
from esphome.cpp_generator import ( # noqa: F401
|
12
|
+
ArrayInitializer,
|
12
13
|
Expression,
|
14
|
+
LineComment,
|
15
|
+
MockObj,
|
16
|
+
MockObjClass,
|
17
|
+
Pvariable,
|
13
18
|
RawExpression,
|
14
19
|
RawStatement,
|
15
|
-
TemplateArguments,
|
16
|
-
StructInitializer,
|
17
|
-
ArrayInitializer,
|
18
|
-
safe_exp,
|
19
20
|
Statement,
|
20
|
-
|
21
|
-
|
22
|
-
static_const_array,
|
23
|
-
statement,
|
24
|
-
variable,
|
25
|
-
with_local_variable,
|
26
|
-
new_variable,
|
27
|
-
Pvariable,
|
28
|
-
new_Pvariable,
|
21
|
+
StructInitializer,
|
22
|
+
TemplateArguments,
|
29
23
|
add,
|
30
|
-
add_global,
|
31
|
-
add_library,
|
32
24
|
add_build_flag,
|
33
25
|
add_define,
|
26
|
+
add_global,
|
27
|
+
add_library,
|
34
28
|
add_platformio_option,
|
35
29
|
get_variable,
|
36
30
|
get_variable_with_full_id,
|
37
|
-
process_lambda,
|
38
31
|
is_template,
|
32
|
+
new_Pvariable,
|
33
|
+
new_variable,
|
34
|
+
process_lambda,
|
35
|
+
progmem_array,
|
36
|
+
safe_exp,
|
37
|
+
statement,
|
38
|
+
static_const_array,
|
39
39
|
templatable,
|
40
|
-
|
41
|
-
|
40
|
+
variable,
|
41
|
+
with_local_variable,
|
42
42
|
)
|
43
|
-
from esphome.cpp_helpers import ( # noqa
|
44
|
-
gpio_pin_expression,
|
45
|
-
register_component,
|
43
|
+
from esphome.cpp_helpers import ( # noqa: F401
|
46
44
|
build_registry_entry,
|
47
45
|
build_registry_list,
|
48
46
|
extract_registry_entry_config,
|
49
|
-
|
47
|
+
gpio_pin_expression,
|
50
48
|
past_safe_mode,
|
49
|
+
register_component,
|
50
|
+
register_parented,
|
51
51
|
)
|
52
|
-
from esphome.cpp_types import ( # noqa
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
from esphome.cpp_types import ( # noqa: F401
|
53
|
+
NAN,
|
54
|
+
App,
|
55
|
+
Application,
|
56
|
+
Component,
|
57
|
+
ComponentPtr,
|
58
|
+
Controller,
|
59
|
+
EntityBase,
|
60
|
+
EntityCategory,
|
61
|
+
ESPTime,
|
62
|
+
GPIOPin,
|
63
|
+
InternalGPIOPin,
|
64
|
+
JsonObject,
|
65
|
+
JsonObjectConst,
|
66
|
+
Parented,
|
67
|
+
PollingComponent,
|
68
|
+
arduino_json_ns,
|
58
69
|
bool_,
|
70
|
+
const_char_ptr,
|
71
|
+
double,
|
72
|
+
esphome_ns,
|
73
|
+
float_,
|
74
|
+
global_ns,
|
75
|
+
gpio_Flags,
|
76
|
+
int16,
|
77
|
+
int32,
|
78
|
+
int64,
|
59
79
|
int_,
|
80
|
+
nullptr,
|
81
|
+
optional,
|
82
|
+
size_t,
|
60
83
|
std_ns,
|
61
84
|
std_shared_ptr,
|
62
85
|
std_string,
|
@@ -66,28 +89,5 @@ from esphome.cpp_types import ( # noqa
|
|
66
89
|
uint16,
|
67
90
|
uint32,
|
68
91
|
uint64,
|
69
|
-
|
70
|
-
int32,
|
71
|
-
int64,
|
72
|
-
size_t,
|
73
|
-
const_char_ptr,
|
74
|
-
NAN,
|
75
|
-
esphome_ns,
|
76
|
-
App,
|
77
|
-
EntityBase,
|
78
|
-
Component,
|
79
|
-
ComponentPtr,
|
80
|
-
PollingComponent,
|
81
|
-
Application,
|
82
|
-
optional,
|
83
|
-
arduino_json_ns,
|
84
|
-
JsonObject,
|
85
|
-
JsonObjectConst,
|
86
|
-
Controller,
|
87
|
-
GPIOPin,
|
88
|
-
InternalGPIOPin,
|
89
|
-
gpio_Flags,
|
90
|
-
EntityCategory,
|
91
|
-
Parented,
|
92
|
-
ESPTime,
|
92
|
+
void,
|
93
93
|
)
|
@@ -60,7 +60,7 @@ bool AdE7953Spi::ade_read_16(uint16_t reg, uint16_t *value) {
|
|
60
60
|
this->write_byte16(reg);
|
61
61
|
this->transfer_byte(0x80);
|
62
62
|
uint8_t recv[2];
|
63
|
-
this->read_array(recv,
|
63
|
+
this->read_array(recv, 2);
|
64
64
|
*value = encode_uint16(recv[0], recv[1]);
|
65
65
|
this->disable();
|
66
66
|
return false;
|
@@ -14,8 +14,6 @@ void AirthingsWavePlus::read_sensors(uint8_t *raw_value, uint16_t value_len) {
|
|
14
14
|
ESP_LOGD(TAG, "version = %d", value->version);
|
15
15
|
|
16
16
|
if (value->version == 1) {
|
17
|
-
ESP_LOGD(TAG, "ambient light = %d", value->ambientLight);
|
18
|
-
|
19
17
|
if (this->humidity_sensor_ != nullptr) {
|
20
18
|
this->humidity_sensor_->publish_state(value->humidity / 2.0f);
|
21
19
|
}
|
@@ -43,6 +41,10 @@ void AirthingsWavePlus::read_sensors(uint8_t *raw_value, uint16_t value_len) {
|
|
43
41
|
if ((this->tvoc_sensor_ != nullptr) && this->is_valid_voc_value_(value->voc)) {
|
44
42
|
this->tvoc_sensor_->publish_state(value->voc);
|
45
43
|
}
|
44
|
+
|
45
|
+
if (this->illuminance_sensor_ != nullptr) {
|
46
|
+
this->illuminance_sensor_->publish_state(value->ambientLight);
|
47
|
+
}
|
46
48
|
} else {
|
47
49
|
ESP_LOGE(TAG, "Invalid payload version (%d != 1, newer version or not a Wave Plus?)", value->version);
|
48
50
|
}
|
@@ -68,6 +70,7 @@ void AirthingsWavePlus::dump_config() {
|
|
68
70
|
LOG_SENSOR(" ", "Radon", this->radon_sensor_);
|
69
71
|
LOG_SENSOR(" ", "Radon Long Term", this->radon_long_term_sensor_);
|
70
72
|
LOG_SENSOR(" ", "CO2", this->co2_sensor_);
|
73
|
+
LOG_SENSOR(" ", "Illuminance", this->illuminance_sensor_);
|
71
74
|
}
|
72
75
|
|
73
76
|
AirthingsWavePlus::AirthingsWavePlus() {
|
@@ -22,6 +22,7 @@ class AirthingsWavePlus : public airthings_wave_base::AirthingsWaveBase {
|
|
22
22
|
void set_radon(sensor::Sensor *radon) { radon_sensor_ = radon; }
|
23
23
|
void set_radon_long_term(sensor::Sensor *radon_long_term) { radon_long_term_sensor_ = radon_long_term; }
|
24
24
|
void set_co2(sensor::Sensor *co2) { co2_sensor_ = co2; }
|
25
|
+
void set_illuminance(sensor::Sensor *illuminance) { illuminance_sensor_ = illuminance; }
|
25
26
|
|
26
27
|
protected:
|
27
28
|
bool is_valid_radon_value_(uint16_t radon);
|
@@ -32,6 +33,7 @@ class AirthingsWavePlus : public airthings_wave_base::AirthingsWaveBase {
|
|
32
33
|
sensor::Sensor *radon_sensor_{nullptr};
|
33
34
|
sensor::Sensor *radon_long_term_sensor_{nullptr};
|
34
35
|
sensor::Sensor *co2_sensor_{nullptr};
|
36
|
+
sensor::Sensor *illuminance_sensor_{nullptr};
|
35
37
|
|
36
38
|
struct WavePlusReadings {
|
37
39
|
uint8_t version;
|
@@ -12,6 +12,9 @@ from esphome.const import (
|
|
12
12
|
CONF_CO2,
|
13
13
|
UNIT_BECQUEREL_PER_CUBIC_METER,
|
14
14
|
UNIT_PARTS_PER_MILLION,
|
15
|
+
CONF_ILLUMINANCE,
|
16
|
+
UNIT_LUX,
|
17
|
+
DEVICE_CLASS_ILLUMINANCE,
|
15
18
|
)
|
16
19
|
|
17
20
|
DEPENDENCIES = airthings_wave_base.DEPENDENCIES
|
@@ -45,6 +48,12 @@ CONFIG_SCHEMA = airthings_wave_base.BASE_SCHEMA.extend(
|
|
45
48
|
device_class=DEVICE_CLASS_CARBON_DIOXIDE,
|
46
49
|
state_class=STATE_CLASS_MEASUREMENT,
|
47
50
|
),
|
51
|
+
cv.Optional(CONF_ILLUMINANCE): sensor.sensor_schema(
|
52
|
+
unit_of_measurement=UNIT_LUX,
|
53
|
+
accuracy_decimals=0,
|
54
|
+
device_class=DEVICE_CLASS_ILLUMINANCE,
|
55
|
+
state_class=STATE_CLASS_MEASUREMENT,
|
56
|
+
),
|
48
57
|
}
|
49
58
|
)
|
50
59
|
|
@@ -62,3 +71,6 @@ async def to_code(config):
|
|
62
71
|
if config_co2 := config.get(CONF_CO2):
|
63
72
|
sens = await sensor.new_sensor(config_co2)
|
64
73
|
cg.add(var.set_co2(sens))
|
74
|
+
if config_illuminance := config.get(CONF_ILLUMINANCE):
|
75
|
+
sens = await sensor.new_sensor(config_illuminance)
|
76
|
+
cg.add(var.set_illuminance(sens))
|
@@ -1,16 +1,17 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
|
-
import esphome.config_validation as cv
|
3
|
-
from esphome.components import web_server
|
4
1
|
from esphome import automation
|
5
2
|
from esphome.automation import maybe_simple_id
|
6
|
-
|
3
|
+
import esphome.codegen as cg
|
4
|
+
from esphome.components import mqtt, web_server
|
5
|
+
import esphome.config_validation as cv
|
7
6
|
from esphome.const import (
|
7
|
+
CONF_CODE,
|
8
8
|
CONF_ID,
|
9
|
+
CONF_MQTT_ID,
|
9
10
|
CONF_ON_STATE,
|
10
11
|
CONF_TRIGGER_ID,
|
11
|
-
CONF_CODE,
|
12
12
|
CONF_WEB_SERVER_ID,
|
13
13
|
)
|
14
|
+
from esphome.core import CORE, coroutine_with_priority
|
14
15
|
from esphome.cpp_helpers import setup_entity
|
15
16
|
|
16
17
|
CODEOWNERS = ["@grahambrown11", "@hwstar"]
|
@@ -77,67 +78,72 @@ AlarmControlPanelCondition = alarm_control_panel_ns.class_(
|
|
77
78
|
"AlarmControlPanelCondition", automation.Condition
|
78
79
|
)
|
79
80
|
|
80
|
-
ALARM_CONTROL_PANEL_SCHEMA =
|
81
|
-
web_server.WEBSERVER_SORTING_SCHEMA
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
81
|
+
ALARM_CONTROL_PANEL_SCHEMA = (
|
82
|
+
cv.ENTITY_BASE_SCHEMA.extend(web_server.WEBSERVER_SORTING_SCHEMA)
|
83
|
+
.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA)
|
84
|
+
.extend(
|
85
|
+
{
|
86
|
+
cv.GenerateID(): cv.declare_id(AlarmControlPanel),
|
87
|
+
cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(
|
88
|
+
mqtt.MQTTAlarmControlPanelComponent
|
89
|
+
),
|
90
|
+
cv.Optional(CONF_ON_STATE): automation.validate_automation(
|
91
|
+
{
|
92
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(StateTrigger),
|
93
|
+
}
|
94
|
+
),
|
95
|
+
cv.Optional(CONF_ON_TRIGGERED): automation.validate_automation(
|
96
|
+
{
|
97
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(TriggeredTrigger),
|
98
|
+
}
|
99
|
+
),
|
100
|
+
cv.Optional(CONF_ON_ARMING): automation.validate_automation(
|
101
|
+
{
|
102
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmingTrigger),
|
103
|
+
}
|
104
|
+
),
|
105
|
+
cv.Optional(CONF_ON_PENDING): automation.validate_automation(
|
106
|
+
{
|
107
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(PendingTrigger),
|
108
|
+
}
|
109
|
+
),
|
110
|
+
cv.Optional(CONF_ON_ARMED_HOME): automation.validate_automation(
|
111
|
+
{
|
112
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmedHomeTrigger),
|
113
|
+
}
|
114
|
+
),
|
115
|
+
cv.Optional(CONF_ON_ARMED_NIGHT): automation.validate_automation(
|
116
|
+
{
|
117
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmedNightTrigger),
|
118
|
+
}
|
119
|
+
),
|
120
|
+
cv.Optional(CONF_ON_ARMED_AWAY): automation.validate_automation(
|
121
|
+
{
|
122
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ArmedAwayTrigger),
|
123
|
+
}
|
124
|
+
),
|
125
|
+
cv.Optional(CONF_ON_DISARMED): automation.validate_automation(
|
126
|
+
{
|
127
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(DisarmedTrigger),
|
128
|
+
}
|
129
|
+
),
|
130
|
+
cv.Optional(CONF_ON_CLEARED): automation.validate_automation(
|
131
|
+
{
|
132
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ClearedTrigger),
|
133
|
+
}
|
134
|
+
),
|
135
|
+
cv.Optional(CONF_ON_CHIME): automation.validate_automation(
|
136
|
+
{
|
137
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ChimeTrigger),
|
138
|
+
}
|
139
|
+
),
|
140
|
+
cv.Optional(CONF_ON_READY): automation.validate_automation(
|
141
|
+
{
|
142
|
+
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(ReadyTrigger),
|
143
|
+
}
|
144
|
+
),
|
145
|
+
}
|
146
|
+
)
|
141
147
|
)
|
142
148
|
|
143
149
|
ALARM_CONTROL_PANEL_ACTION_SCHEMA = maybe_simple_id(
|
@@ -192,6 +198,9 @@ async def setup_alarm_control_panel_core_(var, config):
|
|
192
198
|
if (webserver_id := config.get(CONF_WEB_SERVER_ID)) is not None:
|
193
199
|
web_server_ = await cg.get_variable(webserver_id)
|
194
200
|
web_server.add_entity_to_sorting_list(web_server_, var, config)
|
201
|
+
if mqtt_id := config.get(CONF_MQTT_ID):
|
202
|
+
mqtt_ = cg.new_Pvariable(mqtt_id, var)
|
203
|
+
await mqtt.register_mqtt_component(mqtt_, config)
|
195
204
|
|
196
205
|
|
197
206
|
async def register_alarm_control_panel(var, config):
|